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
kafka-stubs/future.pyi ADDED
@@ -0,0 +1,19 @@
1
+ from _typeshed import Incomplete
2
+
3
+ log: Incomplete
4
+
5
+ class Future:
6
+ error_on_callbacks: bool
7
+ is_done: bool
8
+ value: Incomplete
9
+ exception: Incomplete
10
+ def __init__(self) -> None: ...
11
+ def succeeded(self): ...
12
+ def failed(self): ...
13
+ def retriable(self): ...
14
+ def success(self, value): ...
15
+ def failure(self, e): ...
16
+ def add_callback(self, f, *args, **kwargs): ...
17
+ def add_errback(self, f, *args, **kwargs): ...
18
+ def add_both(self, f, *args, **kwargs): ...
19
+ def chain(self, future): ...
@@ -0,0 +1,10 @@
1
+ from kafka.metrics.compound_stat import NamedMeasurable as NamedMeasurable
2
+ from kafka.metrics.dict_reporter import DictReporter as DictReporter
3
+ from kafka.metrics.kafka_metric import KafkaMetric as KafkaMetric
4
+ from kafka.metrics.measurable import AnonMeasurable as AnonMeasurable
5
+ from kafka.metrics.metric_config import MetricConfig as MetricConfig
6
+ from kafka.metrics.metric_name import MetricName as MetricName
7
+ from kafka.metrics.metrics import Metrics as Metrics
8
+ from kafka.metrics.quota import Quota as Quota
9
+
10
+ __all__ = ["AnonMeasurable", "DictReporter", "KafkaMetric", "MetricConfig", "MetricName", "Metrics", "NamedMeasurable", "Quota"]
@@ -0,0 +1,13 @@
1
+ import abc
2
+
3
+ from kafka.metrics.stat import AbstractStat
4
+
5
+ class AbstractCompoundStat(AbstractStat, metaclass=abc.ABCMeta):
6
+ def stats(self) -> None: ...
7
+
8
+ class NamedMeasurable:
9
+ def __init__(self, metric_name, measurable_stat) -> None: ...
10
+ @property
11
+ def name(self): ...
12
+ @property
13
+ def stat(self): ...
@@ -0,0 +1,15 @@
1
+ from _typeshed import Incomplete
2
+
3
+ from kafka.metrics.metrics_reporter import AbstractMetricsReporter
4
+
5
+ logger: Incomplete
6
+
7
+ class DictReporter(AbstractMetricsReporter):
8
+ def __init__(self, prefix: str = "") -> None: ...
9
+ def snapshot(self): ...
10
+ def init(self, metrics) -> None: ...
11
+ def metric_change(self, metric) -> None: ...
12
+ def metric_removal(self, metric): ...
13
+ def get_category(self, metric): ...
14
+ def configure(self, configs) -> None: ...
15
+ def close(self) -> None: ...
@@ -0,0 +1,13 @@
1
+ class KafkaMetric:
2
+ def __init__(self, metric_name, measurable, config) -> None: ...
3
+ @property
4
+ def metric_name(self): ...
5
+ @property
6
+ def measurable(self): ...
7
+
8
+ @property
9
+ def config(self): ...
10
+ @config.setter
11
+ def config(self, config) -> None: ...
12
+
13
+ def value(self, time_ms=None): ...
@@ -0,0 +1,9 @@
1
+ import abc
2
+
3
+ class AbstractMeasurable(metaclass=abc.ABCMeta):
4
+ @abc.abstractmethod
5
+ def measure(self, config, now): ...
6
+
7
+ class AnonMeasurable(AbstractMeasurable):
8
+ def __init__(self, measure_fn) -> None: ...
9
+ def measure(self, config, now): ...
@@ -0,0 +1,6 @@
1
+ import abc
2
+
3
+ from kafka.metrics.measurable import AbstractMeasurable
4
+ from kafka.metrics.stat import AbstractStat
5
+
6
+ class AbstractMeasurableStat(AbstractStat, AbstractMeasurable, metaclass=abc.ABCMeta): ...
@@ -0,0 +1,13 @@
1
+ from _typeshed import Incomplete
2
+
3
+ class MetricConfig:
4
+ quota: Incomplete
5
+ event_window: Incomplete
6
+ time_window_ms: Incomplete
7
+ tags: Incomplete
8
+ def __init__(self, quota=None, samples: int = 2, event_window=..., time_window_ms=30000, tags=None) -> None: ...
9
+
10
+ @property
11
+ def samples(self): ...
12
+ @samples.setter
13
+ def samples(self, value) -> None: ...
@@ -0,0 +1,13 @@
1
+ class MetricName:
2
+ def __init__(self, name, group, description=None, tags=None) -> None: ...
3
+ @property
4
+ def name(self): ...
5
+ @property
6
+ def group(self): ...
7
+ @property
8
+ def description(self): ...
9
+ @property
10
+ def tags(self): ...
11
+ def __hash__(self): ...
12
+ def __eq__(self, other): ...
13
+ def __ne__(self, other): ...
@@ -0,0 +1,24 @@
1
+ from _typeshed import Incomplete
2
+
3
+ logger: Incomplete
4
+
5
+ class Metrics:
6
+ def __init__(self, default_config=None, reporters=None, enable_expiration: bool = False) -> None: ...
7
+ @property
8
+ def config(self): ...
9
+ @property
10
+ def metrics(self): ...
11
+ def metric_name(self, name, group, description: str = "", tags=None): ...
12
+ def get_sensor(self, name): ...
13
+ def sensor(self, name, config=None, inactive_sensor_expiration_time_seconds=..., parents=None): ...
14
+ def remove_sensor(self, name) -> None: ...
15
+ def add_metric(self, metric_name, measurable, config=None) -> None: ...
16
+ def remove_metric(self, metric_name): ...
17
+ def add_reporter(self, reporter) -> None: ...
18
+ def register_metric(self, metric) -> None: ...
19
+
20
+ class ExpireSensorTask:
21
+ @staticmethod
22
+ def run(metrics) -> None: ...
23
+
24
+ def close(self) -> None: ...
@@ -0,0 +1,13 @@
1
+ import abc
2
+
3
+ class AbstractMetricsReporter(metaclass=abc.ABCMeta):
4
+ @abc.abstractmethod
5
+ def init(self, metrics): ...
6
+ @abc.abstractmethod
7
+ def metric_change(self, metric): ...
8
+ @abc.abstractmethod
9
+ def metric_removal(self, metric): ...
10
+ @abc.abstractmethod
11
+ def configure(self, configs): ...
12
+ @abc.abstractmethod
13
+ def close(self): ...
@@ -0,0 +1,13 @@
1
+ class Quota:
2
+ def __init__(self, bound, is_upper) -> None: ...
3
+ @staticmethod
4
+ def upper_bound(upper_bound): ...
5
+ @staticmethod
6
+ def lower_bound(lower_bound): ...
7
+ def is_upper_bound(self): ...
8
+ @property
9
+ def bound(self): ...
10
+ def is_acceptable(self, value): ...
11
+ def __hash__(self): ...
12
+ def __eq__(self, other): ...
13
+ def __ne__(self, other): ...
@@ -0,0 +1,5 @@
1
+ import abc
2
+
3
+ class AbstractStat(metaclass=abc.ABCMeta):
4
+ @abc.abstractmethod
5
+ def record(self, config, value, time_ms): ...
@@ -0,0 +1,12 @@
1
+ from kafka.metrics.stats.avg import Avg as Avg
2
+ from kafka.metrics.stats.count import Count as Count
3
+ from kafka.metrics.stats.histogram import Histogram as Histogram
4
+ from kafka.metrics.stats.max_stat import Max as Max
5
+ from kafka.metrics.stats.min_stat import Min as Min
6
+ from kafka.metrics.stats.percentile import Percentile as Percentile
7
+ from kafka.metrics.stats.percentiles import Percentiles as Percentiles
8
+ from kafka.metrics.stats.rate import Rate as Rate
9
+ from kafka.metrics.stats.sensor import Sensor as Sensor
10
+ from kafka.metrics.stats.total import Total as Total
11
+
12
+ __all__ = ["Avg", "Count", "Histogram", "Max", "Min", "Percentile", "Percentiles", "Rate", "Sensor", "Total"]
@@ -0,0 +1,6 @@
1
+ from kafka.metrics.stats.sampled_stat import AbstractSampledStat
2
+
3
+ class Avg(AbstractSampledStat):
4
+ def __init__(self) -> None: ...
5
+ def update(self, sample, config, value, now) -> None: ...
6
+ def combine(self, samples, config, now): ...
@@ -0,0 +1,6 @@
1
+ from kafka.metrics.stats.sampled_stat import AbstractSampledStat
2
+
3
+ class Count(AbstractSampledStat):
4
+ def __init__(self) -> None: ...
5
+ def update(self, sample, config, value, now) -> None: ...
6
+ def combine(self, samples, config, now): ...
@@ -0,0 +1,21 @@
1
+ class Histogram:
2
+ def __init__(self, bin_scheme) -> None: ...
3
+ def record(self, value) -> None: ...
4
+ def value(self, quantile): ...
5
+ @property
6
+ def counts(self): ...
7
+ def clear(self) -> None: ...
8
+
9
+ class ConstantBinScheme:
10
+ def __init__(self, bins, min_val, max_val) -> None: ...
11
+ @property
12
+ def bins(self): ...
13
+ def from_bin(self, b): ...
14
+ def to_bin(self, x): ...
15
+
16
+ class LinearBinScheme:
17
+ def __init__(self, num_bins, max_val) -> None: ...
18
+ @property
19
+ def bins(self): ...
20
+ def from_bin(self, b): ...
21
+ def to_bin(self, x): ...
@@ -0,0 +1,6 @@
1
+ from kafka.metrics.stats.sampled_stat import AbstractSampledStat
2
+
3
+ class Max(AbstractSampledStat):
4
+ def __init__(self) -> None: ...
5
+ def update(self, sample, config, value, now) -> None: ...
6
+ def combine(self, samples, config, now): ...
@@ -0,0 +1,6 @@
1
+ from kafka.metrics.stats.sampled_stat import AbstractSampledStat
2
+
3
+ class Min(AbstractSampledStat):
4
+ def __init__(self) -> None: ...
5
+ def update(self, sample, config, value, now) -> None: ...
6
+ def combine(self, samples, config, now): ...
@@ -0,0 +1,6 @@
1
+ class Percentile:
2
+ def __init__(self, metric_name, percentile) -> None: ...
3
+ @property
4
+ def name(self): ...
5
+ @property
6
+ def percentile(self): ...
@@ -0,0 +1,21 @@
1
+ from _typeshed import Incomplete
2
+
3
+ from kafka.metrics.compound_stat import AbstractCompoundStat
4
+ from kafka.metrics.stats.sampled_stat import AbstractSampledStat
5
+
6
+ class BucketSizing:
7
+ CONSTANT: int
8
+ LINEAR: int
9
+
10
+ class Percentiles(AbstractSampledStat, AbstractCompoundStat):
11
+ bin_scheme: Incomplete
12
+ def __init__(self, size_in_bytes, bucketing, max_val, min_val: float = 0.0, percentiles=None) -> None: ...
13
+ def stats(self): ...
14
+ def value(self, config, now, quantile): ...
15
+ def combine(self, samples, config, now): ...
16
+ def new_sample(self, time_ms): ...
17
+ def update(self, sample, config, value, time_ms) -> None: ...
18
+
19
+ class HistogramSample(AbstractSampledStat.Sample):
20
+ histogram: Incomplete
21
+ def __init__(self, scheme, now) -> None: ...
@@ -0,0 +1,28 @@
1
+ from _typeshed import Incomplete
2
+
3
+ from kafka.metrics.measurable_stat import AbstractMeasurableStat
4
+ from kafka.metrics.stats.sampled_stat import AbstractSampledStat
5
+
6
+ class TimeUnit:
7
+ NANOSECONDS: Incomplete
8
+ MICROSECONDS: Incomplete
9
+ MILLISECONDS: Incomplete
10
+ SECONDS: Incomplete
11
+ MINUTES: Incomplete
12
+ HOURS: Incomplete
13
+ DAYS: Incomplete
14
+ @staticmethod
15
+ def get_name(time_unit): ...
16
+
17
+ class Rate(AbstractMeasurableStat):
18
+ def __init__(self, time_unit=3, sampled_stat=None) -> None: ...
19
+ def unit_name(self): ...
20
+ def record(self, config, value, time_ms) -> None: ...
21
+ def measure(self, config, now): ...
22
+ def window_size(self, config, now): ...
23
+ def convert(self, time_ms): ...
24
+
25
+ class SampledTotal(AbstractSampledStat):
26
+ def __init__(self, initial_value=None) -> None: ...
27
+ def update(self, sample, config, value, time_ms) -> None: ...
28
+ def combine(self, samples, config, now): ...
@@ -0,0 +1,26 @@
1
+ import abc
2
+ from _typeshed import Incomplete
3
+
4
+ from kafka.metrics.measurable_stat import AbstractMeasurableStat
5
+
6
+ class AbstractSampledStat(AbstractMeasurableStat, metaclass=abc.ABCMeta):
7
+ def __init__(self, initial_value) -> None: ...
8
+ @abc.abstractmethod
9
+ def update(self, sample, config, value, time_ms): ...
10
+ @abc.abstractmethod
11
+ def combine(self, samples, config, now): ...
12
+ def record(self, config, value, time_ms) -> None: ...
13
+ def new_sample(self, time_ms): ...
14
+ def measure(self, config, now): ...
15
+ def current(self, time_ms): ...
16
+ def oldest(self, now): ...
17
+ def purge_obsolete_samples(self, config, now) -> None: ...
18
+
19
+ class Sample:
20
+ initial_value: Incomplete
21
+ event_count: int
22
+ last_window_ms: Incomplete
23
+ value: Incomplete
24
+ def __init__(self, initial_value, now) -> None: ...
25
+ def reset(self, now) -> None: ...
26
+ def is_complete(self, time_ms, config): ...
@@ -0,0 +1,10 @@
1
+ class Sensor:
2
+ def __init__(self, registry, name, parents, config, inactive_sensor_expiration_time_seconds) -> None: ...
3
+ @property
4
+ def name(self): ...
5
+ @property
6
+ def metrics(self): ...
7
+ def record(self, value: float = 1.0, time_ms=None) -> None: ...
8
+ def add_compound(self, compound_stat, config=None) -> None: ...
9
+ def add(self, metric_name, stat, config=None) -> None: ...
10
+ def has_expired(self): ...
@@ -0,0 +1,6 @@
1
+ from kafka.metrics.measurable_stat import AbstractMeasurableStat
2
+
3
+ class Total(AbstractMeasurableStat):
4
+ def __init__(self, value: float = 0.0) -> None: ...
5
+ def record(self, config, value, now) -> None: ...
6
+ def measure(self, config, now): ...
@@ -0,0 +1,3 @@
1
+ from kafka.partitioner.default import DefaultPartitioner as DefaultPartitioner, murmur2 as murmur2
2
+
3
+ __all__ = ["DefaultPartitioner", "murmur2"]
@@ -0,0 +1,5 @@
1
+ class DefaultPartitioner:
2
+ @classmethod
3
+ def __call__(cls, key, all_partitions, available): ...
4
+
5
+ def murmur2(data): ...
@@ -0,0 +1,3 @@
1
+ from kafka.producer.kafka import KafkaProducer as KafkaProducer
2
+
3
+ __all__ = ["KafkaProducer"]
@@ -0,0 +1,37 @@
1
+ from _typeshed import Incomplete
2
+ from typing import NamedTuple
3
+
4
+ from kafka.future import Future
5
+ from kafka.structs import TopicPartition
6
+
7
+ class FutureProduceResult(Future):
8
+ topic_partition: TopicPartition
9
+ def __init__(self, topic_partition: TopicPartition) -> None: ...
10
+ def success(self, value): ...
11
+ def failure(self, error): ...
12
+ def wait(self, timeout=None): ...
13
+
14
+ class FutureRecordMetadata(Future):
15
+ args: Incomplete
16
+ def __init__(
17
+ self,
18
+ produce_future,
19
+ batch_index,
20
+ timestamp_ms,
21
+ checksum,
22
+ serialized_key_size,
23
+ serialized_value_size,
24
+ serialized_header_size,
25
+ ) -> None: ...
26
+ def get(self, timeout=None): ...
27
+
28
+ class RecordMetadata(NamedTuple):
29
+ topic: str
30
+ partition: int
31
+ topic_partition: TopicPartition
32
+ offset: int
33
+ timestamp: int
34
+ checksum: int | None
35
+ serialized_key_size: int
36
+ serialized_value_size: int
37
+ serialized_header_size: int
@@ -0,0 +1,110 @@
1
+ import selectors
2
+ import ssl
3
+ from _typeshed import Incomplete
4
+ from collections.abc import Callable, Mapping, Sequence
5
+ from typing import Literal, TypeAlias, TypedDict, type_check_only
6
+ from typing_extensions import Unpack
7
+
8
+ from kafka.producer.future import FutureRecordMetadata
9
+ from kafka.serializer.abstract import Serializer
10
+ from kafka.structs import OffsetAndMetadata, TopicPartition
11
+
12
+ _ApiVersion: TypeAlias = tuple[int, ...]
13
+ _BootstrapServers: TypeAlias = str | Sequence[str]
14
+ _KafkaClientFactory: TypeAlias = Callable[..., object]
15
+ _Partitioner: TypeAlias = Callable[[bytes | None, Sequence[int], Sequence[int]], int]
16
+ _ProducerSerializer: TypeAlias = Serializer | Callable[[object], bytes]
17
+ _SaslMechanism: TypeAlias = Literal["PLAIN", "GSSAPI", "OAUTHBEARER", "SCRAM-SHA-256", "SCRAM-SHA-512"]
18
+ _SecurityProtocol: TypeAlias = Literal["PLAINTEXT", "SSL", "SASL_PLAINTEXT", "SASL_SSL"]
19
+ _SocketOption: TypeAlias = tuple[int, int, int]
20
+
21
+ @type_check_only
22
+ class _KafkaProducerConfig(TypedDict, total=False):
23
+ bootstrap_servers: _BootstrapServers
24
+ client_id: str | None
25
+ key_serializer: _ProducerSerializer | None
26
+ value_serializer: _ProducerSerializer | None
27
+ enable_idempotence: bool
28
+ transactional_id: str | None
29
+ transaction_timeout_ms: int
30
+ delivery_timeout_ms: float
31
+ acks: int | Literal["all"]
32
+ bootstrap_topics_filter: set[str]
33
+ compression_type: Literal["gzip", "snappy", "lz4", "zstd"] | None
34
+ retries: int | float
35
+ batch_size: int
36
+ linger_ms: int
37
+ partitioner: _Partitioner
38
+ connections_max_idle_ms: int
39
+ max_block_ms: int
40
+ max_request_size: int
41
+ allow_auto_create_topics: bool
42
+ metadata_max_age_ms: int
43
+ retry_backoff_ms: int
44
+ request_timeout_ms: int
45
+ receive_buffer_bytes: int | None
46
+ send_buffer_bytes: int | None
47
+ socket_options: Sequence[_SocketOption]
48
+ sock_chunk_bytes: int
49
+ sock_chunk_buffer_count: int
50
+ reconnect_backoff_ms: int
51
+ reconnect_backoff_max_ms: int
52
+ max_in_flight_requests_per_connection: int
53
+ security_protocol: _SecurityProtocol
54
+ ssl_context: ssl.SSLContext | None
55
+ ssl_check_hostname: bool
56
+ ssl_cafile: str | None
57
+ ssl_certfile: str | None
58
+ ssl_keyfile: str | None
59
+ ssl_crlfile: str | None
60
+ ssl_password: str | None
61
+ ssl_ciphers: str | None
62
+ api_version: _ApiVersion | None
63
+ api_version_auto_timeout_ms: int
64
+ metric_reporters: Sequence[type[object]]
65
+ metrics_enabled: bool
66
+ metrics_num_samples: int
67
+ metrics_sample_window_ms: int
68
+ selector: type[selectors.BaseSelector]
69
+ sasl_mechanism: _SaslMechanism | None
70
+ sasl_plain_username: str | None
71
+ sasl_plain_password: str | None
72
+ sasl_kerberos_name: object | None
73
+ sasl_kerberos_service_name: str
74
+ sasl_kerberos_domain_name: str | None
75
+ sasl_oauth_token_provider: object | None
76
+ socks5_proxy: str | None
77
+ kafka_client: _KafkaClientFactory
78
+
79
+ log: Incomplete
80
+ PRODUCER_CLIENT_ID_SEQUENCE: Incomplete
81
+
82
+ class KafkaProducer:
83
+ DEFAULT_CONFIG: Incomplete
84
+ DEPRECATED_CONFIGS: Incomplete
85
+ config: Incomplete
86
+ def __init__(self, **configs: Unpack[_KafkaProducerConfig]) -> None: ...
87
+ def bootstrap_connected(self): ...
88
+ def __del__(self) -> None: ...
89
+ def close(self, timeout: float | None = None, null_logger: bool = False) -> None: ...
90
+ def partitions_for(self, topic: str) -> set[int]: ...
91
+ @classmethod
92
+ def max_usable_produce_magic(cls, api_version): ...
93
+ def init_transactions(self) -> None: ...
94
+ def begin_transaction(self) -> None: ...
95
+ def send_offsets_to_transaction(
96
+ self, offsets: Mapping[TopicPartition, OffsetAndMetadata], consumer_group_id: str
97
+ ) -> None: ...
98
+ def commit_transaction(self) -> None: ...
99
+ def abort_transaction(self) -> None: ...
100
+ def send(
101
+ self,
102
+ topic: str,
103
+ value: object = None,
104
+ key: object = None,
105
+ headers: Sequence[tuple[str, bytes]] | None = None,
106
+ partition: int | None = None,
107
+ timestamp_ms: int | None = None,
108
+ ) -> FutureRecordMetadata: ...
109
+ def flush(self, timeout: float | None = None) -> None: ...
110
+ def metrics(self, raw: bool = False) -> dict[str, dict[str, object]] | dict[object, object] | None: ...
@@ -0,0 +1,42 @@
1
+ from _typeshed import Incomplete
2
+ from enum import IntEnum
3
+
4
+ log: Incomplete
5
+
6
+ class FinalState(IntEnum):
7
+ ABORTED = 0
8
+ FAILED = 1
9
+ SUCCEEDED = 2
10
+
11
+ class ProducerBatch:
12
+ max_record_size: int
13
+ created: Incomplete
14
+ drained: Incomplete
15
+ attempts: int
16
+ last_attempt: Incomplete
17
+ last_append: Incomplete
18
+ records: Incomplete
19
+ topic_partition: Incomplete
20
+ produce_future: Incomplete
21
+ def __init__(self, tp, records, now=None) -> None: ...
22
+ @property
23
+ def final_state(self): ...
24
+ @property
25
+ def record_count(self): ...
26
+ @property
27
+ def producer_id(self): ...
28
+ @property
29
+ def producer_epoch(self): ...
30
+ @property
31
+ def has_sequence(self): ...
32
+ def try_append(self, timestamp_ms, key, value, headers, now=None): ...
33
+ def abort(self, exception): ...
34
+ def complete(self, base_offset, log_append_time): ...
35
+ def complete_exceptionally(self, top_level_exception, record_exceptions_fn): ...
36
+ def done(self, base_offset=None, timestamp_ms=None, top_level_exception=None, record_exceptions_fn=None): ...
37
+ def has_reached_delivery_timeout(self, delivery_timeout_ms, now=None): ...
38
+ def in_retry(self): ...
39
+ def retry(self, now=None) -> None: ...
40
+ @property
41
+ def is_done(self): ...
42
+ def __lt__(self, other): ...
@@ -0,0 +1,45 @@
1
+ from _typeshed import Incomplete
2
+
3
+ log: Incomplete
4
+
5
+ class AtomicInteger:
6
+ def __init__(self, val: int = 0) -> None: ...
7
+ def increment(self): ...
8
+ def decrement(self): ...
9
+ def get(self): ...
10
+
11
+ class RecordAccumulator:
12
+ DEFAULT_CONFIG: Incomplete
13
+ config: Incomplete
14
+ muted: Incomplete
15
+ def __init__(self, **configs) -> None: ...
16
+ @property
17
+ def delivery_timeout_ms(self): ...
18
+ @property
19
+ def next_expiry_time_ms(self): ...
20
+ def append(self, tp, timestamp_ms, key, value, headers, now=None): ...
21
+ def reset_next_batch_expiry_time(self) -> None: ...
22
+ def maybe_update_next_batch_expiry_time(self, batch) -> None: ...
23
+ def expired_batches(self, now=None): ...
24
+ def reenqueue(self, batch, now=None) -> None: ...
25
+ def ready(self, cluster, now=None): ...
26
+ def has_undrained(self): ...
27
+ def drain_batches_for_one_node(self, cluster, node_id, max_size, now=None): ...
28
+ def drain(self, cluster, nodes, max_size, now=None): ...
29
+ def deallocate(self, batch) -> None: ...
30
+ def flush_in_progress(self): ...
31
+ def begin_flush(self) -> None: ...
32
+ def await_flush_completion(self, timeout=None) -> None: ...
33
+ @property
34
+ def has_incomplete(self): ...
35
+ def abort_incomplete_batches(self) -> None: ...
36
+ def abort_undrained_batches(self, error) -> None: ...
37
+ def close(self) -> None: ...
38
+
39
+ class IncompleteProducerBatches:
40
+ def __init__(self) -> None: ...
41
+ def add(self, batch) -> None: ...
42
+ def remove(self, batch) -> None: ...
43
+ def all(self): ...
44
+ def __bool__(self) -> bool: ...
45
+ __nonzero__ = __bool__
@@ -0,0 +1,47 @@
1
+ import threading
2
+ from _typeshed import Incomplete
3
+ from typing import NamedTuple
4
+
5
+ log: Incomplete
6
+
7
+ class PartitionResponse(NamedTuple):
8
+ error: Incomplete = ...
9
+ base_offset: Incomplete = ...
10
+ last_offset: Incomplete = ...
11
+ log_append_time: Incomplete = ...
12
+ log_start_offset: Incomplete = ...
13
+ record_errors: Incomplete = ...
14
+ error_message: Incomplete = ...
15
+ current_leader: Incomplete = ...
16
+
17
+ class Sender(threading.Thread):
18
+ DEFAULT_CONFIG: Incomplete
19
+ config: Incomplete
20
+ name: Incomplete
21
+ def __init__(self, client, metadata, accumulator, **configs) -> None: ...
22
+ def run(self) -> None: ...
23
+ def run_once(self) -> None: ...
24
+ def initiate_close(self) -> None: ...
25
+ def force_close(self) -> None: ...
26
+ def add_topic(self, topic) -> None: ...
27
+ def wakeup(self) -> None: ...
28
+ def bootstrap_connected(self): ...
29
+
30
+ class SenderMetrics:
31
+ metrics: Incomplete
32
+ batch_size_sensor: Incomplete
33
+ compression_rate_sensor: Incomplete
34
+ queue_time_sensor: Incomplete
35
+ records_per_request_sensor: Incomplete
36
+ byte_rate_sensor: Incomplete
37
+ retry_sensor: Incomplete
38
+ error_sensor: Incomplete
39
+ max_record_size_sensor: Incomplete
40
+ def __init__(self, metrics, client, metadata) -> None: ...
41
+ def add_metric(
42
+ self, metric_name, measurable, group_name: str = "producer-metrics", description=None, tags=None, sensor_name=None
43
+ ) -> None: ...
44
+ def maybe_register_topic_metrics(self, topic): ...
45
+ def update_produce_request_metrics(self, batches_map) -> None: ...
46
+ def record_retries(self, topic, count) -> None: ...
47
+ def record_errors(self, topic, count) -> None: ...