Skip to content

Commit c9d783a

Browse files
committed
Document methods that return None
If a valid broker in the cluster has no partitions, it will return None rather than an empty set. Similarly updated a few other methods.
1 parent 11cf397 commit c9d783a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kafka/cluster.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def available_partitions_for_topic(self, topic):
9696
9797
Returns:
9898
set: {partition (int), ...}
99+
None if topic not found.
99100
"""
100101
if topic not in self._partitions:
101102
return None
@@ -119,6 +120,7 @@ def partitions_for_broker(self, broker_id):
119120
120121
Returns:
121122
set: {TopicPartition, ...}
123+
None if the broker either has no partitions or does not exist.
122124
"""
123125
return self._broker_partitions.get(broker_id)
124126

@@ -130,6 +132,7 @@ def coordinator_for_group(self, group):
130132
131133
Returns:
132134
int: node_id for group coordinator
135+
None if the group does not exist.
133136
"""
134137
return self._groups.get(group)
135138

0 commit comments

Comments
 (0)