Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add typing to aiokafka/cluster.py #1024

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion aiokafka/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import time
from concurrent.futures import Future
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Expand All @@ -22,7 +23,6 @@
from typing_extensions import TypeAlias, TypedDict

from aiokafka import errors as Errors
from aiokafka.client import CoordinationType
from aiokafka.conn import collect_hosts
from aiokafka.protocol.commit import (
GroupCoordinatorResponse_v0,
Expand All @@ -38,6 +38,9 @@
)
from aiokafka.structs import BrokerMetadata, PartitionMetadata, TopicPartition

if TYPE_CHECKING:
from aiokafka.client import CoordinationType
Comment on lines +41 to +42
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about moving ConnectionGroup and CoordinationType to structs.py instead? Also, I see that they just namespace classes, so it's meaningless to use them in type declarations. Probably we need to make them enums?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, create aiokafka/enums.py for common enums.


ListenerCallable: TypeAlias = Callable[["ClusterMetadata"], None]
NodeId: TypeAlias = Union[str, int]

Expand Down
Loading