1- from __future__ import absolute_import , division
2-
31from collections import defaultdict
42import copy
53import itertools
86import time
97
108from . import ConfigResourceType
11- from kafka .vendor import six
129
1310from kafka .admin .acl_resource import ACLOperation , ACLPermissionType , ACLFilter , ACL , ResourcePattern , ResourceType , \
1411 ACLResourcePatternType , valid_acl_operations
@@ -122,8 +119,7 @@ class KafkaAdminClient(object):
122119 ssl_crlfile (str): Optional filename containing the CRL to check for
123120 certificate expiration. By default, no CRL check is done. When
124121 providing a file, only the leaf certificate will be checked against
125- this CRL. The CRL can only be checked with Python 3.4+ or 2.7.9+.
126- Default: None.
122+ this CRL. Default: None.
127123 api_version (tuple): Specify which Kafka API version to use. If set
128124 to None, KafkaClient will attempt to infer the broker version by
129125 probing various APIs. Example: (0, 10, 2). Default: None
@@ -420,11 +416,7 @@ def _send_request_to_controller(self, request):
420416 raise RuntimeError ("This should never happen, please file a bug with full stacktrace if encountered" )
421417
422418 def _parse_topic_request_response (self , topic_error_tuples , request , response , tries ):
423- # Also small py2/py3 compatibility -- py3 can ignore extra values
424- # during unpack via: for x, y, *rest in list_of_values. py2 cannot.
425- # So for now we have to map across the list and explicitly drop any
426- # extra values (usually the error_message)
427- for topic , error_code in map (lambda e : e [:2 ], topic_error_tuples ):
419+ for topic , error_code , * _ in topic_error_tuples :
428420 error_type = Errors .for_code (error_code )
429421 if tries and error_type is Errors .NotControllerError :
430422 # No need to inspect the rest of the errors for
@@ -439,12 +431,8 @@ def _parse_topic_request_response(self, topic_error_tuples, request, response, t
439431 return True
440432
441433 def _parse_topic_partition_request_response (self , request , response , tries ):
442- # Also small py2/py3 compatibility -- py3 can ignore extra values
443- # during unpack via: for x, y, *rest in list_of_values. py2 cannot.
444- # So for now we have to map across the list and explicitly drop any
445- # extra values (usually the error_message)
446434 for topic , partition_results in response .replication_election_results :
447- for partition_id , error_code in map ( lambda e : e [: 2 ], partition_results ) :
435+ for partition_id , error_code , * _ in partition_results :
448436 error_type = Errors .for_code (error_code )
449437 if tries and error_type is Errors .NotControllerError :
450438 # No need to inspect the rest of the errors for
@@ -1418,7 +1406,7 @@ def _list_consumer_group_offsets_request(self, group_id, partitions=None):
14181406 topics_partitions_dict = defaultdict (set )
14191407 for topic , partition in partitions :
14201408 topics_partitions_dict [topic ].add (partition )
1421- topics_partitions = list (six . iteritems ( topics_partitions_dict ))
1409+ topics_partitions = list (topics_partitions_dict . items ( ))
14221410 return OffsetFetchRequest [version ](group_id , topics_partitions )
14231411
14241412 def _list_consumer_group_offsets_process_response (self , response ):
0 commit comments