From c9d783a8211337205bc90c27d1f67beb65ac5d9e Mon Sep 17 00:00:00 2001 From: Jeff Widman Date: Tue, 22 May 2018 11:33:36 -0700 Subject: 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 5be3c2f..45f25ad 100644 --- a/kafka/cluster.py +++ b/kafka/cluster.py @@ -96,6 +96,7 @@ class ClusterMetadata(object): Returns: set: {partition (int), ...} + None if topic not found. """ if topic not in self._partitions: return None @@ -119,6 +120,7 @@ class ClusterMetadata(object): 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 @@ class ClusterMetadata(object): Returns: int: node_id for group coordinator + None if the group does not exist. """ return self._groups.get(group) -- cgit v1.2.1