Skip to content

Commit c28e856

Browse files
committed
linter fix
1 parent 15bfcba commit c28e856

File tree

5 files changed

+61
-38
lines changed

5 files changed

+61
-38
lines changed

src/confluent_kafka/admin/__init__.py

Lines changed: 59 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ def _make_topics_result(f: concurrent.futures.Future, futmap: Dict[str, concurre
156156
fut.set_exception(e)
157157

158158
@staticmethod
159-
def _make_resource_result(f: concurrent.futures.Future, futmap: Dict[ConfigResource, concurrent.futures.Future]) -> None:
159+
def _make_resource_result(f: concurrent.futures.Future,
160+
futmap: Dict[ConfigResource, concurrent.futures.Future]) -> None:
160161
"""
161162
Map per-resource results to per-resource futures in futmap.
162163
The result value of each (successful) future is a ConfigResource.
@@ -185,7 +186,8 @@ def _make_list_consumer_groups_result(f: concurrent.futures.Future, futmap: Any)
185186
pass
186187

187188
@staticmethod
188-
def _make_consumer_groups_result(f: concurrent.futures.Future, futmap: Dict[str, concurrent.futures.Future]) -> None:
189+
def _make_consumer_groups_result(f: concurrent.futures.Future,
190+
futmap: Dict[str, concurrent.futures.Future]) -> None:
189191
"""
190192
Map per-group results to per-group futures in futmap.
191193
"""
@@ -210,7 +212,8 @@ def _make_consumer_groups_result(f: concurrent.futures.Future, futmap: Dict[str,
210212
fut.set_exception(e)
211213

212214
@staticmethod
213-
def _make_consumer_group_offsets_result(f: concurrent.futures.Future, futmap: Dict[str, concurrent.futures.Future]) -> None:
215+
def _make_consumer_group_offsets_result(f: concurrent.futures.Future,
216+
futmap: Dict[str, concurrent.futures.Future]) -> None:
214217
"""
215218
Map per-group results to per-group futures in futmap.
216219
The result value of each (successful) future is ConsumerGroupTopicPartitions.
@@ -262,7 +265,8 @@ def _make_acls_result(f: concurrent.futures.Future, futmap: Dict[Any, concurrent
262265
fut.set_exception(e)
263266

264267
@staticmethod
265-
def _make_futmap_result_from_list(f: concurrent.futures.Future, futmap: Dict[Any, concurrent.futures.Future]) -> None:
268+
def _make_futmap_result_from_list(f: concurrent.futures.Future,
269+
futmap: Dict[Any, concurrent.futures.Future]) -> None:
266270
try:
267271

268272
results = f.result()
@@ -313,7 +317,9 @@ def _create_future() -> concurrent.futures.Future:
313317
return f
314318

315319
@staticmethod
316-
def _make_futures(futmap_keys: List[Any], class_check: Optional[type], make_result_fn: Any) -> Tuple[concurrent.futures.Future, Dict[Any, concurrent.futures.Future]]:
320+
def _make_futures(futmap_keys: List[Any], class_check: Optional[type],
321+
make_result_fn: Any) -> Tuple[concurrent.futures.Future,
322+
Dict[Any, concurrent.futures.Future]]:
317323
"""
318324
Create futures and a futuremap for the keys in futmap_keys,
319325
and create a request-level future to be bassed to the C API.
@@ -335,7 +341,9 @@ def _make_futures(futmap_keys: List[Any], class_check: Optional[type], make_resu
335341
return f, futmap
336342

337343
@staticmethod
338-
def _make_futures_v2(futmap_keys: Union[List[Any], Set[Any]], class_check: Optional[type], make_result_fn: Any) -> Tuple[concurrent.futures.Future, Dict[Any, concurrent.futures.Future]]:
344+
def _make_futures_v2(futmap_keys: Union[List[Any], Set[Any]], class_check: Optional[type],
345+
make_result_fn: Any) -> Tuple[concurrent.futures.Future,
346+
Dict[Any, concurrent.futures.Future]]:
339347
"""
340348
Create futures and a futuremap for the keys in futmap_keys,
341349
and create a request-level future to be bassed to the C API.
@@ -517,7 +525,8 @@ def _check_alter_user_scram_credentials_request(alterations: List[UserScramCrede
517525
"UserScramCredentialDeletion")
518526

519527
@staticmethod
520-
def _check_list_offsets_request(topic_partition_offsets: Dict[_TopicPartition, OffsetSpec], kwargs: Dict[str, Any]) -> None:
528+
def _check_list_offsets_request(topic_partition_offsets: Dict[_TopicPartition, OffsetSpec],
529+
kwargs: Dict[str, Any]) -> None:
521530
if not isinstance(topic_partition_offsets, dict):
522531
raise TypeError("Expected topic_partition_offsets to be " +
523532
"dict of [TopicPartitions,OffsetSpec] for list offsets request")
@@ -645,7 +654,8 @@ def list_groups(self, *args: Any, **kwargs: Any) -> GroupMetadata:
645654

646655
return super(AdminClient, self).list_groups(*args, **kwargs)
647656

648-
def create_partitions(self, new_partitions: List[NewPartitions], **kwargs: Any) -> Dict[str, concurrent.futures.Future]:
657+
def create_partitions(self, new_partitions: List[NewPartitions],
658+
**kwargs: Any) -> Dict[str, concurrent.futures.Future]:
649659
"""
650660
Create additional partitions for the given topics.
651661
@@ -679,7 +689,8 @@ def create_partitions(self, new_partitions: List[NewPartitions], **kwargs: Any)
679689

680690
return futmap
681691

682-
def describe_configs(self, resources: List[ConfigResource], **kwargs: Any) -> Dict[ConfigResource, concurrent.futures.Future]:
692+
def describe_configs(self, resources: List[ConfigResource],
693+
**kwargs: Any) -> Dict[ConfigResource, concurrent.futures.Future]:
683694
"""
684695
Get the configuration of the specified resources.
685696
@@ -711,7 +722,8 @@ def describe_configs(self, resources: List[ConfigResource], **kwargs: Any) -> Di
711722

712723
return futmap
713724

714-
def alter_configs(self, resources: List[ConfigResource], **kwargs: Any) -> Dict[ConfigResource, concurrent.futures.Future]:
725+
def alter_configs(self, resources: List[ConfigResource],
726+
**kwargs: Any) -> Dict[ConfigResource, concurrent.futures.Future]:
715727
"""
716728
.. deprecated:: 2.2.0
717729
@@ -759,7 +771,8 @@ def alter_configs(self, resources: List[ConfigResource], **kwargs: Any) -> Dict[
759771

760772
return futmap
761773

762-
def incremental_alter_configs(self, resources: List[ConfigResource], **kwargs: Any) -> Dict[ConfigResource, concurrent.futures.Future]:
774+
def incremental_alter_configs(self, resources: List[ConfigResource],
775+
**kwargs: Any) -> Dict[ConfigResource, concurrent.futures.Future]:
763776
"""
764777
Update configuration properties for the specified resources.
765778
Updates are incremental, i.e only the values mentioned are changed
@@ -856,7 +869,8 @@ def describe_acls(self, acl_binding_filter: AclBindingFilter, **kwargs: Any) ->
856869

857870
return f
858871

859-
def delete_acls(self, acl_binding_filters: List[AclBindingFilter], **kwargs: Any) -> Dict[AclBindingFilter, concurrent.futures.Future]:
872+
def delete_acls(self, acl_binding_filters: List[AclBindingFilter],
873+
**kwargs: Any) -> Dict[AclBindingFilter, concurrent.futures.Future]:
860874
"""
861875
Delete ACL bindings matching one or more ACL binding filters.
862876
@@ -1058,13 +1072,16 @@ def delete_consumer_groups(self, group_ids: List[str], **kwargs: Any) -> Dict[st
10581072
if len(group_ids) == 0:
10591073
raise ValueError("Expected at least one group to be deleted")
10601074

1061-
f, futmap = AdminClient._make_futures(group_ids, string_type, AdminClient._make_consumer_groups_result)
1075+
f, futmap = AdminClient._make_futures(group_ids, string_type,
1076+
AdminClient._make_consumer_groups_result)
10621077

10631078
super(AdminClient, self).delete_consumer_groups(group_ids, f, **kwargs)
10641079

10651080
return futmap
10661081

1067-
def list_consumer_group_offsets(self, list_consumer_group_offsets_request: List[_ConsumerGroupTopicPartitions], **kwargs: Any) -> Dict[str, concurrent.futures.Future]:
1082+
def list_consumer_group_offsets(
1083+
self, list_consumer_group_offsets_request: List[_ConsumerGroupTopicPartitions],
1084+
**kwargs: Any) -> Dict[str, concurrent.futures.Future]:
10681085
"""
10691086
List offset information for the consumer group and (optional) topic partition provided in the request.
10701087
@@ -1092,15 +1109,18 @@ def list_consumer_group_offsets(self, list_consumer_group_offsets_request: List[
10921109

10931110
AdminClient._check_list_consumer_group_offsets_request(list_consumer_group_offsets_request)
10941111

1095-
f, futmap = AdminClient._make_futures([request.group_id for request in list_consumer_group_offsets_request],
1096-
string_type,
1097-
AdminClient._make_consumer_group_offsets_result)
1112+
f, futmap = AdminClient._make_futures(
1113+
[request.group_id for request in list_consumer_group_offsets_request],
1114+
string_type,
1115+
AdminClient._make_consumer_group_offsets_result)
10981116

10991117
super(AdminClient, self).list_consumer_group_offsets(list_consumer_group_offsets_request, f, **kwargs)
11001118

11011119
return futmap
11021120

1103-
def alter_consumer_group_offsets(self, alter_consumer_group_offsets_request: List[_ConsumerGroupTopicPartitions], **kwargs: Any) -> Dict[str, concurrent.futures.Future]:
1121+
def alter_consumer_group_offsets(
1122+
self, alter_consumer_group_offsets_request: List[_ConsumerGroupTopicPartitions],
1123+
**kwargs: Any) -> Dict[str, concurrent.futures.Future]:
11041124
"""
11051125
Alter offset for the consumer group and topic partition provided in the request.
11061126
@@ -1152,7 +1172,9 @@ def set_sasl_credentials(self, username: str, password: str) -> None:
11521172
"""
11531173
super(AdminClient, self).set_sasl_credentials(username, password)
11541174

1155-
def describe_user_scram_credentials(self, users: Optional[List[str]] = None, **kwargs: Any) -> Union[concurrent.futures.Future, Dict[str, concurrent.futures.Future]]:
1175+
def describe_user_scram_credentials(
1176+
self, users: Optional[List[str]] = None,
1177+
**kwargs: Any) -> Union[concurrent.futures.Future, Dict[str, concurrent.futures.Future]]:
11561178
"""
11571179
Describe user SASL/SCRAM credentials.
11581180
@@ -1183,12 +1205,14 @@ def describe_user_scram_credentials(self, users: Optional[List[str]] = None, **k
11831205
if users is None:
11841206
internal_f, ret_fut = AdminClient._make_single_future_pair()
11851207
else:
1186-
internal_f, ret_fut = AdminClient._make_futures_v2(users, None,
1187-
AdminClient._make_futmap_result)
1208+
internal_f, ret_fut = AdminClient._make_futures_v2(
1209+
users, None, AdminClient._make_futmap_result)
11881210
super(AdminClient, self).describe_user_scram_credentials(users, internal_f, **kwargs)
11891211
return ret_fut
11901212

1191-
def alter_user_scram_credentials(self, alterations: List[UserScramCredentialAlteration], **kwargs: Any) -> Dict[str, concurrent.futures.Future]:
1213+
def alter_user_scram_credentials(
1214+
self, alterations: List[UserScramCredentialAlteration],
1215+
**kwargs: Any) -> Dict[str, concurrent.futures.Future]:
11921216
"""
11931217
Alter user SASL/SCRAM credentials.
11941218
@@ -1210,13 +1234,15 @@ def alter_user_scram_credentials(self, alterations: List[UserScramCredentialAlte
12101234
"""
12111235
AdminClient._check_alter_user_scram_credentials_request(alterations)
12121236

1213-
f, futmap = AdminClient._make_futures_v2(set([alteration.user for alteration in alterations]), None,
1214-
AdminClient._make_futmap_result)
1237+
f, futmap = AdminClient._make_futures_v2(
1238+
set([alteration.user for alteration in alterations]), None,
1239+
AdminClient._make_futmap_result)
12151240

12161241
super(AdminClient, self).alter_user_scram_credentials(alterations, f, **kwargs)
12171242
return futmap
12181243

1219-
def list_offsets(self, topic_partition_offsets: Dict[_TopicPartition, OffsetSpec], **kwargs: Any) -> Dict[_TopicPartition, concurrent.futures.Future]:
1244+
def list_offsets(self, topic_partition_offsets: Dict[_TopicPartition, OffsetSpec],
1245+
**kwargs: Any) -> Dict[_TopicPartition, concurrent.futures.Future]:
12201246
"""
12211247
Enables to find the beginning offset,
12221248
end offset as well as the offset matching a timestamp
@@ -1250,14 +1276,15 @@ def list_offsets(self, topic_partition_offsets: Dict[_TopicPartition, OffsetSpec
12501276
int(offset_spec._value))
12511277
for topic_partition, offset_spec in topic_partition_offsets.items()]
12521278

1253-
f, futmap = AdminClient._make_futures_v2(topic_partition_offsets_list,
1254-
_TopicPartition,
1255-
AdminClient._make_futmap_result)
1279+
f, futmap = AdminClient._make_futures_v2(
1280+
topic_partition_offsets_list, _TopicPartition,
1281+
AdminClient._make_futmap_result)
12561282

12571283
super(AdminClient, self).list_offsets(topic_partition_offsets_list, f, **kwargs)
12581284
return futmap
12591285

1260-
def delete_records(self, topic_partition_offsets: List[_TopicPartition], **kwargs: Any) -> Dict[_TopicPartition, concurrent.futures.Future]:
1286+
def delete_records(self, topic_partition_offsets: List[_TopicPartition],
1287+
**kwargs: Any) -> Dict[_TopicPartition, concurrent.futures.Future]:
12611288
"""
12621289
Deletes all the records before the specified offsets (not including),
12631290
in the specified topics and partitions.
@@ -1294,7 +1321,9 @@ def delete_records(self, topic_partition_offsets: List[_TopicPartition], **kwarg
12941321
super(AdminClient, self).delete_records(topic_partition_offsets, f, **kwargs)
12951322
return futmap
12961323

1297-
def elect_leaders(self, election_type: _ElectionType, partitions: Optional[List[_TopicPartition]] = None, **kwargs: Any) -> concurrent.futures.Future:
1324+
def elect_leaders(self, election_type: _ElectionType,
1325+
partitions: Optional[List[_TopicPartition]] = None,
1326+
**kwargs: Any) -> concurrent.futures.Future:
12981327
"""
12991328
Perform Preferred or Unclean leader election for
13001329
all the specified partitions or all partitions in the cluster.

src/confluent_kafka/admin/_metadata.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from typing import Dict, List, Optional
16-
17-
from confluent_kafka.cimpl import KafkaError
18-
1915

2016
class ClusterMetadata(object):
2117
"""

src/confluent_kafka/deserializing_consumer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
ValueDeserializationError)
2525
from .serialization import (SerializationContext,
2626
MessageField)
27-
from ._types import ConfigDict, Deserializer
27+
from ._types import ConfigDict
2828

2929

3030
class DeserializingConsumer(_ConsumerImpl):

src/confluent_kafka/experimental/aio/_common.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
import concurrent.futures
1919
from typing import Any, Callable, Dict, Optional, Tuple, TypeVar
2020

21-
from ..._types import ConfigDict
22-
2321
T = TypeVar('T')
2422

2523

src/confluent_kafka/serializing_producer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
SerializationContext)
2424
from .error import (KeySerializationError,
2525
ValueSerializationError)
26-
from ._types import ConfigDict, HeadersType, DeliveryCallback, Serializer
26+
from ._types import ConfigDict, HeadersType, DeliveryCallback
2727

2828

2929
class SerializingProducer(_ProducerImpl):

0 commit comments

Comments
 (0)