Skip to content

Commit bb15ecf

Browse files
alm0raods
andauthored
Fix type annotation for AIOKafkaAdminClient.create_partitions (#978)
* ✏️ fix typo : create_partitions() method accept NewPartitions instead of TopicPartition * update CHANGES.rst * Update aiokafka/admin/client.py Co-authored-by: Denis Otkidach <[email protected]> * Optimize imports --------- Co-authored-by: Denis Otkidach <[email protected]>
1 parent 9166c96 commit bb15ecf

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Unreleased
88
Bugfixes:
99

1010
* Fix serialization for batch (issue #886, pr #887 by @ydjin0602)
11+
* Fix type annotation for `AIOKafkaAdminClient.create_partitions` (pr #978 by @alm0ra)
1112

1213

1314
0.10.0 (2023-12-15)

aiokafka/admin/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from aiokafka.structs import OffsetAndMetadata, TopicPartition
3030

3131
from .config_resource import ConfigResource, ConfigResourceType
32+
from .new_partitions import NewPartitions
3233
from .new_topic import NewTopic
3334
from .records_to_delete import RecordsToDelete
3435

@@ -395,15 +396,15 @@ def _convert_config_resources(
395396
return broker_resources, topic_resources
396397

397398
@staticmethod
398-
def _convert_topic_partitions(topic_partitions: Dict[str, TopicPartition]):
399+
def _convert_topic_partitions(topic_partitions: Dict[str, NewPartitions]):
399400
return [
400401
(topic_name, (new_part.total_count, new_part.new_assignments))
401402
for topic_name, new_part in topic_partitions.items()
402403
]
403404

404405
async def create_partitions(
405406
self,
406-
topic_partitions: Dict[str, TopicPartition],
407+
topic_partitions: Dict[str, NewPartitions],
407408
timeout_ms: Optional[int] = None,
408409
validate_only: bool = False,
409410
) -> Response:

0 commit comments

Comments
 (0)