types-kafka-python 2.3.0.20260523__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. kafka-stubs/METADATA.toml +2 -0
  2. kafka-stubs/__init__.pyi +13 -0
  3. kafka-stubs/admin/__init__.pyi +30 -0
  4. kafka-stubs/admin/acl_resource.pyi +91 -0
  5. kafka-stubs/admin/client.pyi +114 -0
  6. kafka-stubs/admin/config_resource.pyi +12 -0
  7. kafka-stubs/admin/new_partitions.pyi +6 -0
  8. kafka-stubs/admin/new_topic.pyi +16 -0
  9. kafka-stubs/cli/__init__.pyi +0 -0
  10. kafka-stubs/cli/admin/__init__.pyi +3 -0
  11. kafka-stubs/cli/admin/cluster/__init__.pyi +3 -0
  12. kafka-stubs/cli/admin/cluster/describe.pyi +3 -0
  13. kafka-stubs/cli/admin/configs/__init__.pyi +3 -0
  14. kafka-stubs/cli/admin/configs/describe.pyi +5 -0
  15. kafka-stubs/cli/admin/consumer_groups/__init__.pyi +3 -0
  16. kafka-stubs/cli/admin/consumer_groups/delete.pyi +3 -0
  17. kafka-stubs/cli/admin/consumer_groups/describe.pyi +3 -0
  18. kafka-stubs/cli/admin/consumer_groups/list.pyi +3 -0
  19. kafka-stubs/cli/admin/consumer_groups/list_offsets.pyi +3 -0
  20. kafka-stubs/cli/admin/log_dirs/__init__.pyi +3 -0
  21. kafka-stubs/cli/admin/log_dirs/describe.pyi +3 -0
  22. kafka-stubs/cli/admin/topics/__init__.pyi +3 -0
  23. kafka-stubs/cli/admin/topics/create.pyi +5 -0
  24. kafka-stubs/cli/admin/topics/delete.pyi +3 -0
  25. kafka-stubs/cli/admin/topics/describe.pyi +3 -0
  26. kafka-stubs/cli/admin/topics/list.pyi +3 -0
  27. kafka-stubs/cli/consumer/__init__.pyi +3 -0
  28. kafka-stubs/cli/producer/__init__.pyi +3 -0
  29. kafka-stubs/client_async.pyi +56 -0
  30. kafka-stubs/cluster.pyi +36 -0
  31. kafka-stubs/codec.pyi +25 -0
  32. kafka-stubs/conn.pyi +70 -0
  33. kafka-stubs/consumer/__init__.pyi +3 -0
  34. kafka-stubs/consumer/fetcher.pyi +150 -0
  35. kafka-stubs/consumer/group.pyi +143 -0
  36. kafka-stubs/consumer/subscription_state.pyi +112 -0
  37. kafka-stubs/coordinator/__init__.pyi +0 -0
  38. kafka-stubs/coordinator/assignors/__init__.pyi +0 -0
  39. kafka-stubs/coordinator/assignors/abstract.pyi +15 -0
  40. kafka-stubs/coordinator/assignors/range.pyi +15 -0
  41. kafka-stubs/coordinator/assignors/roundrobin.pyi +15 -0
  42. kafka-stubs/coordinator/assignors/sticky/__init__.pyi +0 -0
  43. kafka-stubs/coordinator/assignors/sticky/partition_movements.pyi +18 -0
  44. kafka-stubs/coordinator/assignors/sticky/sorted_set.pyi +13 -0
  45. kafka-stubs/coordinator/assignors/sticky/sticky_assignor.pyi +59 -0
  46. kafka-stubs/coordinator/base.pyi +86 -0
  47. kafka-stubs/coordinator/consumer.pyi +31 -0
  48. kafka-stubs/coordinator/heartbeat.pyi +22 -0
  49. kafka-stubs/coordinator/protocol.pyi +17 -0
  50. kafka-stubs/coordinator/subscription.pyi +13 -0
  51. kafka-stubs/errors.pyi +822 -0
  52. kafka-stubs/future.pyi +19 -0
  53. kafka-stubs/metrics/__init__.pyi +10 -0
  54. kafka-stubs/metrics/compound_stat.pyi +13 -0
  55. kafka-stubs/metrics/dict_reporter.pyi +15 -0
  56. kafka-stubs/metrics/kafka_metric.pyi +13 -0
  57. kafka-stubs/metrics/measurable.pyi +9 -0
  58. kafka-stubs/metrics/measurable_stat.pyi +6 -0
  59. kafka-stubs/metrics/metric_config.pyi +13 -0
  60. kafka-stubs/metrics/metric_name.pyi +13 -0
  61. kafka-stubs/metrics/metrics.pyi +24 -0
  62. kafka-stubs/metrics/metrics_reporter.pyi +13 -0
  63. kafka-stubs/metrics/quota.pyi +13 -0
  64. kafka-stubs/metrics/stat.pyi +5 -0
  65. kafka-stubs/metrics/stats/__init__.pyi +12 -0
  66. kafka-stubs/metrics/stats/avg.pyi +6 -0
  67. kafka-stubs/metrics/stats/count.pyi +6 -0
  68. kafka-stubs/metrics/stats/histogram.pyi +21 -0
  69. kafka-stubs/metrics/stats/max_stat.pyi +6 -0
  70. kafka-stubs/metrics/stats/min_stat.pyi +6 -0
  71. kafka-stubs/metrics/stats/percentile.pyi +6 -0
  72. kafka-stubs/metrics/stats/percentiles.pyi +21 -0
  73. kafka-stubs/metrics/stats/rate.pyi +28 -0
  74. kafka-stubs/metrics/stats/sampled_stat.pyi +26 -0
  75. kafka-stubs/metrics/stats/sensor.pyi +10 -0
  76. kafka-stubs/metrics/stats/total.pyi +6 -0
  77. kafka-stubs/partitioner/__init__.pyi +3 -0
  78. kafka-stubs/partitioner/default.pyi +5 -0
  79. kafka-stubs/producer/__init__.pyi +3 -0
  80. kafka-stubs/producer/future.pyi +37 -0
  81. kafka-stubs/producer/kafka.pyi +110 -0
  82. kafka-stubs/producer/producer_batch.pyi +42 -0
  83. kafka-stubs/producer/record_accumulator.pyi +45 -0
  84. kafka-stubs/producer/sender.pyi +47 -0
  85. kafka-stubs/producer/transaction_manager.pyi +187 -0
  86. kafka-stubs/protocol/__init__.pyi +3 -0
  87. kafka-stubs/protocol/abstract.pyi +9 -0
  88. kafka-stubs/protocol/add_offsets_to_txn.pyi +39 -0
  89. kafka-stubs/protocol/add_partitions_to_txn.pyi +39 -0
  90. kafka-stubs/protocol/admin.pyi +506 -0
  91. kafka-stubs/protocol/api.pyi +37 -0
  92. kafka-stubs/protocol/api_versions.pyi +70 -0
  93. kafka-stubs/protocol/broker_api_versions.pyi +3 -0
  94. kafka-stubs/protocol/commit.pyi +166 -0
  95. kafka-stubs/protocol/end_txn.pyi +39 -0
  96. kafka-stubs/protocol/fetch.pyi +143 -0
  97. kafka-stubs/protocol/find_coordinator.pyi +39 -0
  98. kafka-stubs/protocol/frame.pyi +6 -0
  99. kafka-stubs/protocol/group.pyi +229 -0
  100. kafka-stubs/protocol/init_producer_id.pyi +28 -0
  101. kafka-stubs/protocol/list_offsets.pyi +85 -0
  102. kafka-stubs/protocol/message.pyi +43 -0
  103. kafka-stubs/protocol/metadata.pyi +123 -0
  104. kafka-stubs/protocol/offset_for_leader_epoch.pyi +61 -0
  105. kafka-stubs/protocol/parser.pyi +11 -0
  106. kafka-stubs/protocol/produce.pyi +103 -0
  107. kafka-stubs/protocol/sasl_authenticate.pyi +28 -0
  108. kafka-stubs/protocol/sasl_handshake.pyi +28 -0
  109. kafka-stubs/protocol/struct.pyi +14 -0
  110. kafka-stubs/protocol/txn_offset_commit.pyi +39 -0
  111. kafka-stubs/protocol/types.pyi +115 -0
  112. kafka-stubs/py.typed +0 -0
  113. kafka-stubs/record/__init__.pyi +3 -0
  114. kafka-stubs/record/_crc32c.pyi +8 -0
  115. kafka-stubs/record/abc.pyi +60 -0
  116. kafka-stubs/record/default_records.pyi +155 -0
  117. kafka-stubs/record/legacy_records.pyi +86 -0
  118. kafka-stubs/record/memory_records.pyi +44 -0
  119. kafka-stubs/record/util.pyi +5 -0
  120. kafka-stubs/sasl/__init__.pyi +6 -0
  121. kafka-stubs/sasl/abc.pyi +14 -0
  122. kafka-stubs/sasl/gssapi.pyi +16 -0
  123. kafka-stubs/sasl/msk.pyi +33 -0
  124. kafka-stubs/sasl/oauth.pyi +23 -0
  125. kafka-stubs/sasl/plain.pyi +15 -0
  126. kafka-stubs/sasl/scram.pyi +40 -0
  127. kafka-stubs/sasl/sspi.pyi +17 -0
  128. kafka-stubs/serializer/__init__.pyi +1 -0
  129. kafka-stubs/serializer/abstract.pyi +15 -0
  130. kafka-stubs/socks5_wrapper.pyi +25 -0
  131. kafka-stubs/structs.pyi +53 -0
  132. kafka-stubs/util.pyi +38 -0
  133. kafka-stubs/version.pyi +1 -0
  134. types_kafka_python-2.3.0.20260523.dist-info/METADATA +38 -0
  135. types_kafka_python-2.3.0.20260523.dist-info/RECORD +138 -0
  136. types_kafka_python-2.3.0.20260523.dist-info/WHEEL +5 -0
  137. types_kafka_python-2.3.0.20260523.dist-info/licenses/LICENSE +237 -0
  138. types_kafka_python-2.3.0.20260523.dist-info/top_level.txt +1 -0
@@ -0,0 +1,150 @@
1
+ from _typeshed import Incomplete
2
+ from typing import ClassVar, NamedTuple
3
+
4
+ import kafka.errors as Errors
5
+
6
+ log: Incomplete
7
+ READ_UNCOMMITTED: int
8
+ READ_COMMITTED: int
9
+ ISOLATION_LEVEL_CONFIG: Incomplete
10
+
11
+ class ConsumerRecord(NamedTuple):
12
+ topic: str
13
+ partition: int
14
+ leader_epoch: int | None
15
+ offset: int
16
+ timestamp: int
17
+ timestamp_type: int
18
+ key: Incomplete
19
+ value: Incomplete
20
+ headers: list[tuple[str, bytes]]
21
+ checksum: int | None
22
+ serialized_key_size: int
23
+ serialized_value_size: int
24
+ serialized_header_size: int
25
+
26
+ class CompletedFetch(NamedTuple):
27
+ topic_partition: Incomplete
28
+ fetched_offset: Incomplete
29
+ response_version: Incomplete
30
+ partition_data: Incomplete
31
+ metric_aggregator: Incomplete
32
+
33
+ class ExceptionMetadata(NamedTuple):
34
+ partition: Incomplete
35
+ fetched_offset: Incomplete
36
+ exception: Incomplete
37
+
38
+ class NoOffsetForPartitionError(Errors.KafkaError): ...
39
+ class RecordTooLargeError(Errors.KafkaError): ...
40
+
41
+ class Fetcher:
42
+ DEFAULT_CONFIG: Incomplete
43
+ config: Incomplete
44
+ def __init__(self, client, subscriptions, **configs) -> None: ...
45
+ def send_fetches(self): ...
46
+ def in_flight_fetches(self): ...
47
+ def reset_offsets_if_needed(self): ...
48
+ def offsets_by_times(self, timestamps, timeout_ms=None): ...
49
+ def beginning_offsets(self, partitions, timeout_ms): ...
50
+ def end_offsets(self, partitions, timeout_ms): ...
51
+ def beginning_or_end_offset(self, partitions, timestamp, timeout_ms): ...
52
+ def fetched_records(self, max_records=None, update_offsets: bool = True): ...
53
+ def close(self) -> None: ...
54
+
55
+ class PartitionRecords:
56
+ fetch_offset: Incomplete
57
+ topic_partition: Incomplete
58
+ leader_epoch: int
59
+ next_fetch_offset: Incomplete
60
+ bytes_read: int
61
+ records_read: int
62
+ isolation_level: Incomplete
63
+ aborted_producer_ids: Incomplete
64
+ aborted_transactions: Incomplete
65
+ metric_aggregator: Incomplete
66
+ check_crcs: Incomplete
67
+ record_iterator: Incomplete
68
+ on_drain: Incomplete
69
+ def __init__(
70
+ self,
71
+ fetch_offset,
72
+ tp,
73
+ records,
74
+ key_deserializer=None,
75
+ value_deserializer=None,
76
+ check_crcs: bool = True,
77
+ isolation_level=0,
78
+ aborted_transactions=None,
79
+ metric_aggregator=None,
80
+ on_drain=...,
81
+ ) -> None: ...
82
+ def __bool__(self) -> bool: ...
83
+ __nonzero__ = __bool__
84
+ def drain(self) -> None: ...
85
+ def take(self, n=None): ...
86
+
87
+ class FetchSessionHandler:
88
+ node_id: Incomplete
89
+ next_metadata: Incomplete
90
+ session_partitions: Incomplete
91
+ def __init__(self, node_id) -> None: ...
92
+ def build_next(self, next_partitions): ...
93
+ def handle_response(self, response): ...
94
+ def handle_error(self, _exception) -> None: ...
95
+
96
+ class FetchMetadata:
97
+ MAX_EPOCH: int
98
+ INVALID_SESSION_ID: int
99
+ THROTTLED_SESSION_ID: int
100
+ INITIAL_EPOCH: int
101
+ FINAL_EPOCH: int
102
+ INITIAL: ClassVar[FetchMetadata]
103
+ LEGACY: ClassVar[FetchMetadata]
104
+ session_id: Incomplete
105
+ epoch: Incomplete
106
+ def __init__(self, session_id, epoch) -> None: ...
107
+ @property
108
+ def is_full(self): ...
109
+ @classmethod
110
+ def next_epoch(cls, prev_epoch): ...
111
+ def next_close_existing(self): ...
112
+ @classmethod
113
+ def new_incremental(cls, session_id): ...
114
+ def next_incremental(self): ...
115
+
116
+ class FetchRequestData:
117
+ def __init__(self, to_send, to_forget, metadata) -> None: ...
118
+ @property
119
+ def metadata(self): ...
120
+ @property
121
+ def id(self): ...
122
+ @property
123
+ def epoch(self): ...
124
+ @property
125
+ def to_send(self): ...
126
+ @property
127
+ def to_forget(self): ...
128
+
129
+ class FetchMetrics:
130
+ total_bytes: int
131
+ total_records: int
132
+ def __init__(self) -> None: ...
133
+
134
+ class FetchResponseMetricAggregator:
135
+ sensors: Incomplete
136
+ unrecorded_partitions: Incomplete
137
+ fetch_metrics: Incomplete
138
+ topic_fetch_metrics: Incomplete
139
+ def __init__(self, sensors, partitions) -> None: ...
140
+ def record(self, partition, num_bytes, num_records) -> None: ...
141
+
142
+ class FetchManagerMetrics:
143
+ metrics: Incomplete
144
+ group_name: Incomplete
145
+ bytes_fetched: Incomplete
146
+ records_fetched: Incomplete
147
+ fetch_latency: Incomplete
148
+ records_fetch_lag: Incomplete
149
+ def __init__(self, metrics, prefix) -> None: ...
150
+ def record_topic_fetch_metrics(self, topic, num_bytes, num_records) -> None: ...
@@ -0,0 +1,143 @@
1
+ import selectors
2
+ import ssl
3
+ from _typeshed import Incomplete
4
+ from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence
5
+ from typing import Literal, TypeAlias, TypedDict, overload, type_check_only
6
+ from typing_extensions import Self, Unpack
7
+
8
+ from kafka.consumer.fetcher import ConsumerRecord
9
+ from kafka.consumer.subscription_state import ConsumerRebalanceListener
10
+ from kafka.future import Future
11
+ from kafka.serializer.abstract import Deserializer
12
+ from kafka.structs import OffsetAndMetadata, OffsetAndTimestamp, TopicPartition
13
+
14
+ _ApiVersion: TypeAlias = tuple[int, ...]
15
+ _BootstrapServers: TypeAlias = str | Sequence[str]
16
+ _CommitCallback: TypeAlias = Callable[[Mapping[TopicPartition, OffsetAndMetadata], object], object]
17
+ _ConsumerDeserializer: TypeAlias = Deserializer | Callable[[bytes | None], object]
18
+ _KafkaClientFactory: TypeAlias = Callable[..., object]
19
+ _SaslMechanism: TypeAlias = Literal["PLAIN", "GSSAPI", "OAUTHBEARER", "SCRAM-SHA-256", "SCRAM-SHA-512"]
20
+ _SecurityProtocol: TypeAlias = Literal["PLAINTEXT", "SSL", "SASL_PLAINTEXT", "SASL_SSL"]
21
+ _SocketOption: TypeAlias = tuple[int, int, int]
22
+
23
+ @type_check_only
24
+ class _KafkaConsumerConfig(TypedDict, total=False):
25
+ bootstrap_servers: _BootstrapServers
26
+ client_id: str
27
+ group_id: str | None
28
+ group_instance_id: str | None
29
+ key_deserializer: _ConsumerDeserializer | None
30
+ value_deserializer: _ConsumerDeserializer | None
31
+ enable_incremental_fetch_sessions: bool
32
+ fetch_max_wait_ms: int
33
+ fetch_min_bytes: int
34
+ fetch_max_bytes: int
35
+ max_partition_fetch_bytes: int
36
+ request_timeout_ms: int
37
+ retry_backoff_ms: int
38
+ reconnect_backoff_ms: int
39
+ reconnect_backoff_max_ms: int
40
+ max_in_flight_requests_per_connection: int
41
+ auto_offset_reset: Literal["earliest", "latest", "smallest", "largest"]
42
+ enable_auto_commit: bool
43
+ auto_commit_interval_ms: int
44
+ default_offset_commit_callback: _CommitCallback
45
+ check_crcs: bool
46
+ isolation_level: Literal["read_uncommitted", "read_committed"]
47
+ allow_auto_create_topics: bool
48
+ metadata_max_age_ms: int
49
+ partition_assignment_strategy: Sequence[type[object]]
50
+ max_poll_records: int
51
+ max_poll_interval_ms: int
52
+ session_timeout_ms: int
53
+ heartbeat_interval_ms: int
54
+ receive_buffer_bytes: int | None
55
+ send_buffer_bytes: int | None
56
+ socket_options: Sequence[_SocketOption]
57
+ sock_chunk_bytes: int
58
+ sock_chunk_buffer_count: int
59
+ consumer_timeout_ms: int | float
60
+ security_protocol: _SecurityProtocol
61
+ ssl_context: ssl.SSLContext | None
62
+ ssl_check_hostname: bool
63
+ ssl_cafile: str | None
64
+ ssl_certfile: str | None
65
+ ssl_keyfile: str | None
66
+ ssl_crlfile: str | None
67
+ ssl_password: str | None
68
+ ssl_ciphers: str | None
69
+ api_version: _ApiVersion | None
70
+ api_version_auto_timeout_ms: int
71
+ connections_max_idle_ms: int
72
+ metric_reporters: Sequence[type[object]]
73
+ metrics_enabled: bool
74
+ metrics_num_samples: int
75
+ metrics_sample_window_ms: int
76
+ metric_group_prefix: str
77
+ selector: type[selectors.BaseSelector]
78
+ exclude_internal_topics: bool
79
+ sasl_mechanism: _SaslMechanism | None
80
+ sasl_plain_username: str | None
81
+ sasl_plain_password: str | None
82
+ sasl_kerberos_name: object | None
83
+ sasl_kerberos_service_name: str
84
+ sasl_kerberos_domain_name: str | None
85
+ sasl_oauth_token_provider: object | None
86
+ socks5_proxy: str | None
87
+ kafka_client: _KafkaClientFactory
88
+
89
+ log: Incomplete
90
+
91
+ class KafkaConsumer(Iterator[ConsumerRecord]):
92
+ DEFAULT_CONFIG: Incomplete
93
+ DEFAULT_SESSION_TIMEOUT_MS_0_9: int
94
+ config: Incomplete
95
+ def __init__(self, *topics: str, **configs: Unpack[_KafkaConsumerConfig]) -> None: ...
96
+ def bootstrap_connected(self): ...
97
+ def assign(self, partitions: Iterable[TopicPartition]) -> None: ...
98
+ def assignment(self) -> set[TopicPartition]: ...
99
+ def close(self, autocommit: bool = True, timeout_ms: int | None = None) -> None: ...
100
+ def commit_async(
101
+ self, offsets: Mapping[TopicPartition, OffsetAndMetadata] | None = None, callback: _CommitCallback | None = None
102
+ ) -> Future: ...
103
+ def commit(
104
+ self, offsets: Mapping[TopicPartition, OffsetAndMetadata] | None = None, timeout_ms: int | None = None
105
+ ) -> None: ...
106
+
107
+ @overload
108
+ def committed(
109
+ self, partition: TopicPartition, metadata: Literal[False] = False, timeout_ms: int | None = None
110
+ ) -> int | None: ...
111
+ @overload
112
+ def committed(
113
+ self, partition: TopicPartition, metadata: Literal[True], timeout_ms: int | None = None
114
+ ) -> OffsetAndMetadata | None: ...
115
+ @overload
116
+ def committed(
117
+ self, partition: TopicPartition, metadata: bool, timeout_ms: int | None = None
118
+ ) -> int | OffsetAndMetadata | None: ...
119
+
120
+ def topics(self) -> set[str]: ...
121
+ def partitions_for_topic(self, topic: str) -> set[int]: ...
122
+ def poll(
123
+ self, timeout_ms: int = 0, max_records: int | None = None, update_offsets: bool = True
124
+ ) -> dict[TopicPartition, list[ConsumerRecord]]: ...
125
+ def position(self, partition: TopicPartition, timeout_ms: int | None = None) -> int | None: ...
126
+ def highwater(self, partition: TopicPartition) -> int | None: ...
127
+ def pause(self, *partitions: TopicPartition) -> None: ...
128
+ def paused(self) -> set[TopicPartition]: ...
129
+ def resume(self, *partitions: TopicPartition) -> None: ...
130
+ def seek(self, partition: TopicPartition, offset: int) -> None: ...
131
+ def seek_to_beginning(self, *partitions: TopicPartition) -> None: ...
132
+ def seek_to_end(self, *partitions: TopicPartition) -> None: ...
133
+ def subscribe(
134
+ self, topics: Iterable[str] = (), pattern: str | None = None, listener: ConsumerRebalanceListener | None = None
135
+ ) -> None: ...
136
+ def subscription(self) -> set[str]: ...
137
+ def unsubscribe(self) -> None: ...
138
+ def metrics(self, raw: bool = False) -> dict[str, dict[str, object]] | dict[object, object] | None: ...
139
+ def offsets_for_times(self, timestamps: Mapping[TopicPartition, int]) -> dict[TopicPartition, OffsetAndTimestamp | None]: ...
140
+ def beginning_offsets(self, partitions: Iterable[TopicPartition]) -> dict[TopicPartition, int]: ...
141
+ def end_offsets(self, partitions: Iterable[TopicPartition]) -> dict[TopicPartition, int]: ...
142
+ def __iter__(self) -> Self: ...
143
+ def __next__(self) -> ConsumerRecord: ...
@@ -0,0 +1,112 @@
1
+ import abc
2
+ from _typeshed import Incomplete
3
+ from enum import IntEnum
4
+
5
+ from kafka.util import synchronized
6
+
7
+ log: Incomplete
8
+
9
+ class SubscriptionType(IntEnum):
10
+ NONE = 0
11
+ AUTO_TOPICS = 1
12
+ AUTO_PATTERN = 2
13
+ USER_ASSIGNED = 3
14
+
15
+ class SubscriptionState:
16
+ subscription: Incomplete
17
+ subscription_type: Incomplete
18
+ subscribed_pattern: Incomplete
19
+ assignment: Incomplete
20
+ rebalance_listener: Incomplete
21
+ listeners: Incomplete
22
+ def __init__(self, offset_reset_strategy: str = "earliest") -> None: ...
23
+ @synchronized
24
+ def subscribe(self, topics=(), pattern=None, listener=None) -> None: ...
25
+ @synchronized
26
+ def change_subscription(self, topics) -> None: ...
27
+ @synchronized
28
+ def group_subscribe(self, topics) -> None: ...
29
+ @synchronized
30
+ def reset_group_subscription(self) -> None: ...
31
+ @synchronized
32
+ def assign_from_user(self, partitions) -> None: ...
33
+ @synchronized
34
+ def assign_from_subscribed(self, assignments) -> None: ...
35
+ @synchronized
36
+ def unsubscribe(self) -> None: ...
37
+ @synchronized
38
+ def group_subscription(self): ...
39
+ @synchronized
40
+ def seek(self, partition, offset) -> None: ...
41
+ @synchronized
42
+ def assigned_partitions(self): ...
43
+ @synchronized
44
+ def paused_partitions(self): ...
45
+ @synchronized
46
+ def fetchable_partitions(self): ...
47
+ @synchronized
48
+ def partitions_auto_assigned(self): ...
49
+ @synchronized
50
+ def all_consumed_offsets(self): ...
51
+ @synchronized
52
+ def request_offset_reset(self, partition, offset_reset_strategy=None) -> None: ...
53
+ @synchronized
54
+ def set_reset_pending(self, partitions, next_allowed_reset_time) -> None: ...
55
+ @synchronized
56
+ def has_default_offset_reset_policy(self): ...
57
+ @synchronized
58
+ def is_offset_reset_needed(self, partition): ...
59
+ @synchronized
60
+ def has_all_fetch_positions(self): ...
61
+ @synchronized
62
+ def missing_fetch_positions(self): ...
63
+ @synchronized
64
+ def has_valid_position(self, partition): ...
65
+ @synchronized
66
+ def reset_missing_positions(self) -> None: ...
67
+ @synchronized
68
+ def partitions_needing_reset(self): ...
69
+ @synchronized
70
+ def is_assigned(self, partition): ...
71
+ @synchronized
72
+ def is_paused(self, partition): ...
73
+ @synchronized
74
+ def is_fetchable(self, partition): ...
75
+ @synchronized
76
+ def pause(self, partition) -> None: ...
77
+ @synchronized
78
+ def resume(self, partition) -> None: ...
79
+ @synchronized
80
+ def reset_failed(self, partitions, next_retry_time) -> None: ...
81
+ @synchronized
82
+ def move_partition_to_end(self, partition) -> None: ...
83
+ @synchronized
84
+ def position(self, partition): ...
85
+
86
+ class TopicPartitionState:
87
+ paused: bool
88
+ reset_strategy: Incomplete
89
+ highwater: Incomplete
90
+ drop_pending_record_batch: bool
91
+ next_allowed_retry_time: Incomplete
92
+ def __init__(self) -> None: ...
93
+ position: Incomplete
94
+ def reset(self, strategy) -> None: ...
95
+ def is_reset_allowed(self): ...
96
+ @property
97
+ def awaiting_reset(self): ...
98
+ def set_reset_pending(self, next_allowed_retry_time) -> None: ...
99
+ def reset_failed(self, next_allowed_retry_time) -> None: ...
100
+ @property
101
+ def has_valid_position(self): ...
102
+ def is_missing_position(self): ...
103
+ def seek(self, offset) -> None: ...
104
+ def pause(self) -> None: ...
105
+ def resume(self) -> None: ...
106
+ def is_fetchable(self): ...
107
+
108
+ class ConsumerRebalanceListener(metaclass=abc.ABCMeta):
109
+ @abc.abstractmethod
110
+ def on_partitions_revoked(self, revoked): ...
111
+ @abc.abstractmethod
112
+ def on_partitions_assigned(self, assigned): ...
File without changes
File without changes
@@ -0,0 +1,15 @@
1
+ import abc
2
+ from _typeshed import Incomplete
3
+
4
+ log: Incomplete
5
+
6
+ class AbstractPartitionAssignor(metaclass=abc.ABCMeta):
7
+ @property
8
+ @abc.abstractmethod
9
+ def name(self): ...
10
+ @abc.abstractmethod
11
+ def assign(self, cluster, members): ...
12
+ @abc.abstractmethod
13
+ def metadata(self, topics): ...
14
+ @abc.abstractmethod
15
+ def on_assignment(self, assignment): ...
@@ -0,0 +1,15 @@
1
+ from _typeshed import Incomplete
2
+
3
+ from kafka.coordinator.assignors.abstract import AbstractPartitionAssignor
4
+
5
+ log: Incomplete
6
+
7
+ class RangePartitionAssignor(AbstractPartitionAssignor):
8
+ name: str
9
+ version: int
10
+ @classmethod
11
+ def assign(cls, cluster, group_subscriptions): ...
12
+ @classmethod
13
+ def metadata(cls, topics): ...
14
+ @classmethod
15
+ def on_assignment(cls, assignment) -> None: ...
@@ -0,0 +1,15 @@
1
+ from _typeshed import Incomplete
2
+
3
+ from kafka.coordinator.assignors.abstract import AbstractPartitionAssignor
4
+
5
+ log: Incomplete
6
+
7
+ class RoundRobinPartitionAssignor(AbstractPartitionAssignor):
8
+ name: str
9
+ version: int
10
+ @classmethod
11
+ def assign(cls, cluster, group_subscriptions): ...
12
+ @classmethod
13
+ def metadata(cls, topics): ...
14
+ @classmethod
15
+ def on_assignment(cls, assignment) -> None: ...
File without changes
@@ -0,0 +1,18 @@
1
+ from _typeshed import Incomplete
2
+ from typing import NamedTuple
3
+
4
+ log: Incomplete
5
+
6
+ class ConsumerPair(NamedTuple):
7
+ src_member_id: Incomplete
8
+ dst_member_id: Incomplete
9
+
10
+ def is_sublist(source, target): ...
11
+
12
+ class PartitionMovements:
13
+ partition_movements_by_topic: Incomplete
14
+ partition_movements: Incomplete
15
+ def __init__(self) -> None: ...
16
+ def move_partition(self, partition, old_consumer, new_consumer) -> None: ...
17
+ def get_partition_to_be_moved(self, partition, old_consumer, new_consumer): ...
18
+ def are_sticky(self): ...
@@ -0,0 +1,13 @@
1
+ from _typeshed import Incomplete
2
+
3
+ class SortedSet:
4
+ def __init__(self, iterable=None, key=None) -> None: ...
5
+ def first(self): ...
6
+ def last(self): ...
7
+ def pop_last(self): ...
8
+ def add(self, value): ...
9
+ def remove(self, value): ...
10
+ def __contains__(self, value) -> bool: ...
11
+ def __iter__(self): ...
12
+ __nonzero__: Incomplete
13
+ __bool__: Incomplete
@@ -0,0 +1,59 @@
1
+ from _typeshed import Incomplete
2
+ from typing import NamedTuple
3
+
4
+ from kafka.coordinator.assignors.abstract import AbstractPartitionAssignor
5
+ from kafka.protocol.struct import Struct
6
+
7
+ log: Incomplete
8
+
9
+ class ConsumerGenerationPair(NamedTuple):
10
+ consumer: Incomplete
11
+ generation: Incomplete
12
+
13
+ def has_identical_list_elements(list_): ...
14
+ def subscriptions_comparator_key(element): ...
15
+ def partitions_comparator_key(element): ...
16
+ def remove_if_present(collection, element) -> None: ...
17
+
18
+ class StickyAssignorMemberMetadataV1(NamedTuple):
19
+ subscription: Incomplete
20
+ partitions: Incomplete
21
+ generation: Incomplete
22
+
23
+ class StickyAssignorUserDataV1(Struct):
24
+ SCHEMA: Incomplete
25
+
26
+ class StickyAssignmentExecutor:
27
+ members: Incomplete
28
+ current_assignment: Incomplete
29
+ previous_assignment: Incomplete
30
+ current_partition_consumer: Incomplete
31
+ is_fresh_assignment: bool
32
+ partition_to_all_potential_consumers: Incomplete
33
+ consumer_to_all_potential_partitions: Incomplete
34
+ sorted_current_subscriptions: Incomplete
35
+ sorted_partitions: Incomplete
36
+ unassigned_partitions: Incomplete
37
+ revocation_required: bool
38
+ partition_movements: Incomplete
39
+ def __init__(self, cluster, members) -> None: ...
40
+ def perform_initial_assignment(self) -> None: ...
41
+ def balance(self) -> None: ...
42
+ def get_final_assignment(self, member_id): ...
43
+
44
+ class StickyPartitionAssignor(AbstractPartitionAssignor):
45
+ DEFAULT_GENERATION_ID: int
46
+ name: str
47
+ version: int
48
+ member_assignment: Incomplete
49
+ generation = DEFAULT_GENERATION_ID
50
+ @classmethod
51
+ def assign(cls, cluster, members): ...
52
+ @classmethod
53
+ def parse_member_metadata(cls, metadata): ...
54
+ @classmethod
55
+ def metadata(cls, topics): ...
56
+ @classmethod
57
+ def on_assignment(cls, assignment) -> None: ...
58
+ @classmethod
59
+ def on_generation_assignment(cls, generation) -> None: ...
@@ -0,0 +1,86 @@
1
+ import abc
2
+ import threading
3
+ from _typeshed import Incomplete
4
+ from typing import ClassVar
5
+
6
+ from kafka import errors as Errors
7
+
8
+ log: Incomplete
9
+ heartbeat_log: Incomplete
10
+
11
+ class MemberState:
12
+ UNJOINED: str
13
+ REBALANCING: str
14
+ STABLE: str
15
+
16
+ class Generation:
17
+ NO_GENERATION: ClassVar[Generation]
18
+ generation_id: Incomplete
19
+ member_id: Incomplete
20
+ protocol: Incomplete
21
+ def __init__(self, generation_id, member_id, protocol) -> None: ...
22
+ def has_member_id(self): ...
23
+ def __eq__(self, other): ...
24
+
25
+ class UnjoinedGroupException(Errors.KafkaError):
26
+ retriable: bool
27
+
28
+ class BaseCoordinator(metaclass=abc.ABCMeta):
29
+ DEFAULT_CONFIG: Incomplete
30
+ config: Incomplete
31
+ heartbeat: Incomplete
32
+ rejoin_needed: bool
33
+ rejoining: bool
34
+ state: Incomplete
35
+ join_future: Incomplete
36
+ coordinator_id: Incomplete
37
+ def __init__(self, client, **configs) -> None: ...
38
+ @property
39
+ def group_id(self): ...
40
+ @property
41
+ def group_instance_id(self): ...
42
+ @abc.abstractmethod
43
+ def protocol_type(self): ...
44
+ @abc.abstractmethod
45
+ def group_protocols(self): ...
46
+ def coordinator_unknown(self): ...
47
+ def coordinator(self): ...
48
+ def connected(self): ...
49
+ def ensure_coordinator_ready(self, timeout_ms=None): ...
50
+ def lookup_coordinator(self): ...
51
+ def need_rejoin(self): ...
52
+ def poll_heartbeat(self) -> None: ...
53
+ def time_to_next_heartbeat(self): ...
54
+ def ensure_active_group(self, timeout_ms=None): ...
55
+ def join_group(self, timeout_ms=None): ...
56
+ def coordinator_dead(self, error) -> None: ...
57
+ def generation_if_stable(self): ...
58
+ def generation(self): ...
59
+ def rebalance_in_progress(self): ...
60
+ def reset_generation(self, member_id="") -> None: ...
61
+ def request_rejoin(self) -> None: ...
62
+ def __del__(self) -> None: ...
63
+ def close(self, timeout_ms=None) -> None: ...
64
+ def is_dynamic_member(self): ...
65
+ def maybe_leave_group(self, timeout_ms=None) -> None: ...
66
+
67
+ class GroupCoordinatorMetrics:
68
+ heartbeat: Incomplete
69
+ metrics: Incomplete
70
+ metric_group_name: Incomplete
71
+ heartbeat_latency: Incomplete
72
+ join_latency: Incomplete
73
+ sync_latency: Incomplete
74
+ def __init__(self, heartbeat, metrics, prefix, tags=None) -> None: ...
75
+
76
+ class HeartbeatThread(threading.Thread):
77
+ name: Incomplete
78
+ coordinator: Incomplete
79
+ enabled: bool
80
+ closed: bool
81
+ failed: Incomplete
82
+ def __init__(self, coordinator) -> None: ...
83
+ def enable(self) -> None: ...
84
+ def disable(self) -> None: ...
85
+ def close(self, timeout_ms=None) -> None: ...
86
+ def run(self) -> None: ...
@@ -0,0 +1,31 @@
1
+ from _typeshed import Incomplete
2
+
3
+ from kafka.coordinator.base import BaseCoordinator
4
+
5
+ log: Incomplete
6
+
7
+ class ConsumerCoordinator(BaseCoordinator):
8
+ DEFAULT_CONFIG: Incomplete
9
+ config: Incomplete
10
+ auto_commit_interval: Incomplete
11
+ next_auto_commit_deadline: Incomplete
12
+ completed_offset_commits: Incomplete
13
+ def __init__(self, client, subscription, **configs) -> None: ...
14
+ def __del__(self) -> None: ...
15
+ def protocol_type(self): ...
16
+ def group_protocols(self): ...
17
+ def poll(self, timeout_ms=None): ...
18
+ def time_to_next_poll(self): ...
19
+ def need_rejoin(self): ...
20
+ def refresh_committed_offsets_if_needed(self, timeout_ms=None): ...
21
+ def fetch_committed_offsets(self, partitions, timeout_ms=None): ...
22
+ def close(self, autocommit: bool = True, timeout_ms=None) -> None: ... # type: ignore[override]
23
+ def commit_offsets_async(self, offsets, callback=None): ...
24
+ def commit_offsets_sync(self, offsets, timeout_ms=None): ...
25
+ def maybe_auto_commit_offsets_now(self) -> None: ...
26
+
27
+ class ConsumerCoordinatorMetrics:
28
+ metrics: Incomplete
29
+ metric_group_name: Incomplete
30
+ commit_latency: Incomplete
31
+ def __init__(self, metrics, metric_group_prefix, subscription) -> None: ...