From 3c113d65cad8d25fbb6c18562ad05661fe99ffa5 Mon Sep 17 00:00:00 2001 From: Jeff Widman Date: Tue, 22 May 2018 11:33:36 -0700 Subject: [PATCH] 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. --- kafka/cluster.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kafka/cluster.py b/kafka/cluster.py index 5be3c2f65..45f25ad27 100644 --- a/kafka/cluster.py +++ b/kafka/cluster.py @@ -96,6 +96,7 @@ def available_partitions_for_topic(self, topic): Returns: set: {partition (int), ...} + None if topic not found. """ if topic not in self._partitions: return None @@ -119,6 +120,7 @@ def partitions_for_broker(self, broker_id): Returns: set: {TopicPartition, ...} + None if the broker either has no partitions or does not exist. """ return self._broker_partitions.get(broker_id) @@ -130,6 +132,7 @@ def coordinator_for_group(self, group): Returns: int: node_id for group coordinator + None if the group does not exist. """ return self._groups.get(group)