@@ -568,11 +568,9 @@ def describe_topics(self, topics=None):
568568 return metadata ['topics' ]
569569
570570 def describe_cluster (self ):
571- """
572- Fetch cluster-wide metadata such as the list of brokers, the controller ID,
571+ """Fetch cluster-wide metadata such as the list of brokers, the controller ID,
573572 and the cluster ID.
574573
575-
576574 Returns:
577575 A dict with cluster-wide metadata, excluding topic details.
578576 """
@@ -1068,11 +1066,15 @@ def _get_leader_for_partitions(self, partitions, timeout_ms=None):
10681066
10691067 Will raise UnknownTopicOrPartitionError if for some partition no leader can be found.
10701068
1071- :param partitions: ``[TopicPartition]``: partitions for which to find leaders.
1072- :param timeout_ms: ``float``: Timeout in milliseconds, if None (default), will be read from
1073- config.
1069+ Arguments:
1070+ partitions ([TopicPartition]): partitions for which to find leaders.
1071+
1072+ Keyword Arguments:
1073+ timeout_ms (numeric, optional): Timeout in milliseconds, if None (default), will be read from
1074+ config.
10741075
1075- :return: Dictionary with ``{leader_id -> {partitions}}``
1076+ Returns:
1077+ dict with ``{leader_id -> {partitions}}``
10761078 """
10771079 timeout_ms = self ._validate_timeout (timeout_ms )
10781080
@@ -1102,15 +1104,19 @@ def _get_leader_for_partitions(self, partitions, timeout_ms=None):
11021104 def delete_records (self , records_to_delete , timeout_ms = None , partition_leader_id = None ):
11031105 """Delete records whose offset is smaller than the given offset of the corresponding partition.
11041106
1105- :param records_to_delete: ``{TopicPartition: int}``: The earliest available offsets for the
1106- given partitions.
1107- :param timeout_ms: ``float``: Timeout in milliseconds, if None (default), will be read from
1108- config.
1109- :param partition_leader_id: ``str``: If specified, all deletion requests will be sent to
1110- this node. No check is performed verifying that this is indeed the leader for all
1111- listed partitions: use with caution.
1107+ Arguments:
1108+ records_to_delete ({TopicPartition: int}): The earliest available offsets for the
1109+ given partitions.
11121110
1113- :return: Dictionary {topicPartition -> metadata}, where metadata is returned by the broker.
1111+ Keyword Arguments:
1112+ timeout_ms (numeric, optional): Timeout in milliseconds, if None (default), will be read from
1113+ config.
1114+ partition_leader_id (node_id / int, optional): If specified, all deletion requests will be sent to
1115+ this node. No check is performed verifying that this is indeed the leader for all
1116+ listed partitions: use with caution.
1117+
1118+ Returns:
1119+ dict {topicPartition -> metadata}, where metadata is returned by the broker.
11141120 See DeleteRecordsResponse for possible fields. error_code for all partitions is
11151121 guaranteed to be zero, otherwise an exception is raised.
11161122 """
@@ -1568,13 +1574,18 @@ def _get_topic_partitions(self, topic_partitions):
15681574 def perform_leader_election (self , election_type , topic_partitions = None , timeout_ms = None , raise_errors = True ):
15691575 """Perform leader election on the topic partitions.
15701576
1571- :param election_type: Type of election to attempt. 0 for Perferred, 1 for Unclean
1572- :param topic_partitions: A map of topic name strings to partition ids list.
1573- By default, will run on all topic partitions
1574- :param timeout_ms: Milliseconds to wait for the leader election process to complete
1575- before the broker returns.
1577+ Arguments:
1578+ election_type: Type of election to attempt. 0 for Preferred, 1 for Unclean
15761579
1577- :return: Appropriate version of ElectLeadersResponse class.
1580+ Keyword Arguments:
1581+ topic_partitions (dict): A map of topic name strings to partition ids list.
1582+ By default, will run on all topic partitions
1583+ timeout_ms (num, optional): Milliseconds to wait for the leader election process to complete
1584+ before the broker returns.
1585+ raise_errors (bool, optional): True/False whether to raise errors as exceptions. Default True.
1586+
1587+ Returns:
1588+ Appropriate version of ElectLeadersResponse class.
15781589 """
15791590 version = self ._client .api_version (ElectLeadersRequest , max_version = 1 )
15801591 timeout_ms = self ._validate_timeout (timeout_ms )
0 commit comments