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

refactor: enhance and fix cimpl & admin #149

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 9 additions & 3 deletions confluent_kafka-stubs/_model/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,23 @@ from __future__ import annotations

# standard library
from enum import Enum
from typing import TYPE_CHECKING, ClassVar
from typing import ClassVar

if TYPE_CHECKING:
from ..cimpl import TopicPartition
from ..cimpl import TopicPartition

class Node:
id: ClassVar[int]
id_string: ClassVar[str]
host: ClassVar[str]
port: ClassVar[int]
rack: ClassVar[str]

def __init__(self, id: int, host: str, port: int, rack: str | None = None) -> None: ...

class ConsumerGroupTopicPartitions:
group_id: ClassVar[str]
topic_partitions: ClassVar[list["TopicPartition"]]

def __init__(self, group_id: str, topic_partitions: list["TopicPartition"] | None = None) -> None: ...

class ConsumerGroupState(Enum):
Expand Down
4 changes: 2 additions & 2 deletions confluent_kafka-stubs/admin/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class AdminClient(_AdminClientImpl):
def delete_topics(
self, topics: list[str], operation_timeout: float = 0, request_timeout: float = 1000.0
) -> dict[str, "Future[NewTopic | None]"]: ...
def list_topics(self, *args, **kwargs) -> list["TopicMetadata | None"]: ...
def list_topics(self, topic: str | None = None, timeout: float = -1) -> "ClusterMetadata": ...
def list_groups(self, *args, **kwargs) -> "ListConsumerGroupsResult | None": ...
def create_partitions(
self, new_partitions: list["NewPartitions"], operation_timeout: float = 0, request_timeout: float = 1000.0
Expand Down Expand Up @@ -105,7 +105,7 @@ class AdminClient(_AdminClientImpl):
list_consumer_group_offsets_request: list["ConsumerGroupTopicPartitions"],
require_stable: bool = False,
request_timeout: float = 1000.0,
) -> dict[str, "Future[ListConsumerGroupsResult]"]: ...
) -> dict[str, "Future[ConsumerGroupTopicPartitions]"]: ...
def alter_consumer_group_offsets(
self,
alter_consumer_group_offsets_request: list["ConsumerGroupTopicPartitions"],
Expand Down
2 changes: 1 addition & 1 deletion confluent_kafka-stubs/admin/_metadata.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ClusterMetadata:
cluster_id: ClassVar[str]
controller_id: ClassVar[int] = -1
brokers: ClassVar[dict[int, "BrokerMetadata"] | None] = None
topics: ClassVar[dict[int, "TopicMetadata"] | None] = None
topics: ClassVar[dict[str, "TopicMetadata"] | None] = None
orig_broker_id: ClassVar[int] = -1
orig_broker_name: ClassVar[str] = ""

Expand Down
12 changes: 12 additions & 0 deletions confluent_kafka-stubs/cimpl.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ class Message:
def __len__(self) -> int: ...

class NewTopic:
topic: ClassVar[str]
num_partitions: ClassVar[int]
replication_factor: ClassVar[int]
replica_assignment: ClassVar[list[list[str]]]
config: ClassVar[dict[str, str] | None]

def __init__(
self,
topic: str,
Expand Down Expand Up @@ -356,6 +362,12 @@ class NewPartitions:
def __ne__(self, other: "NewPartitions") -> bool: ...

class TopicPartition:
topic: ClassVar[str]
partition: ClassVar[int]
offset: ClassVar[int]
metadata: ClassVar[str | None]
leader_epoch: ClassVar[int | None]

def __init__(
self,
topic: str,
Expand Down
Loading