Skip to content

Commit 8f789a0

Browse files
committed
finish admin init
1 parent 1abe216 commit 8f789a0

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/confluent_kafka/admin/__init__.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def _check_list_consumer_group_offsets_request(request: Optional[List[_ConsumerG
421421
raise ValueError("Element of 'topic_partitions' must not have 'offset' value")
422422

423423
@staticmethod
424-
def _check_alter_consumer_group_offsets_request(request):
424+
def _check_alter_consumer_group_offsets_request(request: Optional[List[_ConsumerGroupTopicPartitions]]) -> None:
425425
if request is None:
426426
raise TypeError("request cannot be None")
427427
if not isinstance(request, list):
@@ -460,7 +460,7 @@ def _check_alter_consumer_group_offsets_request(request):
460460
"Element of 'topic_partitions' must not have negative value for 'offset' field")
461461

462462
@staticmethod
463-
def _check_describe_user_scram_credentials_request(users):
463+
def _check_describe_user_scram_credentials_request(users: Optional[List[str]]) -> None:
464464
if users is None:
465465
return
466466
if not isinstance(users, list):
@@ -474,7 +474,7 @@ def _check_describe_user_scram_credentials_request(users):
474474
raise ValueError("'user' cannot be empty")
475475

476476
@staticmethod
477-
def _check_alter_user_scram_credentials_request(alterations):
477+
def _check_alter_user_scram_credentials_request(alterations: List[UserScramCredentialAlteration]) -> None:
478478
if not isinstance(alterations, list):
479479
raise TypeError("Expected input to be list")
480480
if len(alterations) == 0:
@@ -517,7 +517,7 @@ def _check_alter_user_scram_credentials_request(alterations):
517517
"UserScramCredentialDeletion")
518518

519519
@staticmethod
520-
def _check_list_offsets_request(topic_partition_offsets, kwargs):
520+
def _check_list_offsets_request(topic_partition_offsets: Dict[_TopicPartition, OffsetSpec], kwargs: Dict[str, Any]) -> None:
521521
if not isinstance(topic_partition_offsets, dict):
522522
raise TypeError("Expected topic_partition_offsets to be " +
523523
"dict of [TopicPartitions,OffsetSpec] for list offsets request")
@@ -545,7 +545,7 @@ def _check_list_offsets_request(topic_partition_offsets, kwargs):
545545
raise TypeError("isolation_level argument should be an IsolationLevel")
546546

547547
@staticmethod
548-
def _check_delete_records(request):
548+
def _check_delete_records(request: List[_TopicPartition]) -> None:
549549
if not isinstance(request, list):
550550
raise TypeError(f"Expected Request to be a list, got '{type(request).__name__}' ")
551551
for req in request:
@@ -556,7 +556,7 @@ def _check_delete_records(request):
556556
raise ValueError("'partition' cannot be negative")
557557

558558
@staticmethod
559-
def _check_elect_leaders(election_type, partitions):
559+
def _check_elect_leaders(election_type: _ElectionType, partitions: Optional[List[_TopicPartition]]) -> None:
560560
if not isinstance(election_type, _ElectionType):
561561
raise TypeError("Expected 'election_type' to be of type 'ElectionType'")
562562
if partitions is not None:
@@ -711,7 +711,7 @@ def describe_configs(self, resources: List[ConfigResource], **kwargs: Any) -> Di
711711

712712
return futmap
713713

714-
def alter_configs(self, resources, **kwargs):
714+
def alter_configs(self, resources: List[ConfigResource], **kwargs: Any) -> Dict[ConfigResource, concurrent.futures.Future]:
715715
"""
716716
.. deprecated:: 2.2.0
717717
@@ -759,7 +759,7 @@ def alter_configs(self, resources, **kwargs):
759759

760760
return futmap
761761

762-
def incremental_alter_configs(self, resources, **kwargs):
762+
def incremental_alter_configs(self, resources: List[ConfigResource], **kwargs: Any) -> Dict[ConfigResource, concurrent.futures.Future]:
763763
"""
764764
Update configuration properties for the specified resources.
765765
Updates are incremental, i.e only the values mentioned are changed
@@ -792,7 +792,7 @@ def incremental_alter_configs(self, resources, **kwargs):
792792

793793
return futmap
794794

795-
def create_acls(self, acls, **kwargs):
795+
def create_acls(self, acls: List[AclBinding], **kwargs: Any) -> Dict[AclBinding, concurrent.futures.Future]:
796796
"""
797797
Create one or more ACL bindings.
798798
@@ -821,7 +821,7 @@ def create_acls(self, acls, **kwargs):
821821

822822
return futmap
823823

824-
def describe_acls(self, acl_binding_filter, **kwargs):
824+
def describe_acls(self, acl_binding_filter: AclBindingFilter, **kwargs: Any) -> concurrent.futures.Future:
825825
"""
826826
Match ACL bindings by filter.
827827
@@ -856,7 +856,7 @@ def describe_acls(self, acl_binding_filter, **kwargs):
856856

857857
return f
858858

859-
def delete_acls(self, acl_binding_filters, **kwargs):
859+
def delete_acls(self, acl_binding_filters: List[AclBindingFilter], **kwargs: Any) -> Dict[AclBindingFilter, concurrent.futures.Future]:
860860
"""
861861
Delete ACL bindings matching one or more ACL binding filters.
862862
@@ -895,7 +895,7 @@ def delete_acls(self, acl_binding_filters, **kwargs):
895895

896896
return futmap
897897

898-
def list_consumer_groups(self, **kwargs):
898+
def list_consumer_groups(self, **kwargs: Any) -> concurrent.futures.Future:
899899
"""
900900
List consumer groups.
901901
@@ -1064,7 +1064,7 @@ def delete_consumer_groups(self, group_ids: List[str], **kwargs: Any) -> Dict[st
10641064

10651065
return futmap
10661066

1067-
def list_consumer_group_offsets(self, list_consumer_group_offsets_request, **kwargs):
1067+
def list_consumer_group_offsets(self, list_consumer_group_offsets_request: List[_ConsumerGroupTopicPartitions], **kwargs: Any) -> Dict[str, concurrent.futures.Future]:
10681068
"""
10691069
List offset information for the consumer group and (optional) topic partition provided in the request.
10701070
@@ -1100,7 +1100,7 @@ def list_consumer_group_offsets(self, list_consumer_group_offsets_request, **kwa
11001100

11011101
return futmap
11021102

1103-
def alter_consumer_group_offsets(self, alter_consumer_group_offsets_request, **kwargs):
1103+
def alter_consumer_group_offsets(self, alter_consumer_group_offsets_request: List[_ConsumerGroupTopicPartitions], **kwargs: Any) -> Dict[str, concurrent.futures.Future]:
11041104
"""
11051105
Alter offset for the consumer group and topic partition provided in the request.
11061106
@@ -1152,7 +1152,7 @@ def set_sasl_credentials(self, username: str, password: str) -> None:
11521152
"""
11531153
super(AdminClient, self).set_sasl_credentials(username, password)
11541154

1155-
def describe_user_scram_credentials(self, users=None, **kwargs):
1155+
def describe_user_scram_credentials(self, users: Optional[List[str]] = None, **kwargs: Any) -> Union[concurrent.futures.Future, Dict[str, concurrent.futures.Future]]:
11561156
"""
11571157
Describe user SASL/SCRAM credentials.
11581158
@@ -1188,7 +1188,7 @@ def describe_user_scram_credentials(self, users=None, **kwargs):
11881188
super(AdminClient, self).describe_user_scram_credentials(users, internal_f, **kwargs)
11891189
return ret_fut
11901190

1191-
def alter_user_scram_credentials(self, alterations, **kwargs):
1191+
def alter_user_scram_credentials(self, alterations: List[UserScramCredentialAlteration], **kwargs: Any) -> Dict[str, concurrent.futures.Future]:
11921192
"""
11931193
Alter user SASL/SCRAM credentials.
11941194
@@ -1216,7 +1216,7 @@ def alter_user_scram_credentials(self, alterations, **kwargs):
12161216
super(AdminClient, self).alter_user_scram_credentials(alterations, f, **kwargs)
12171217
return futmap
12181218

1219-
def list_offsets(self, topic_partition_offsets, **kwargs):
1219+
def list_offsets(self, topic_partition_offsets: Dict[_TopicPartition, OffsetSpec], **kwargs: Any) -> Dict[_TopicPartition, concurrent.futures.Future]:
12201220
"""
12211221
Enables to find the beginning offset,
12221222
end offset as well as the offset matching a timestamp
@@ -1257,7 +1257,7 @@ def list_offsets(self, topic_partition_offsets, **kwargs):
12571257
super(AdminClient, self).list_offsets(topic_partition_offsets_list, f, **kwargs)
12581258
return futmap
12591259

1260-
def delete_records(self, topic_partition_offsets, **kwargs):
1260+
def delete_records(self, topic_partition_offsets: List[_TopicPartition], **kwargs: Any) -> Dict[_TopicPartition, concurrent.futures.Future]:
12611261
"""
12621262
Deletes all the records before the specified offsets (not including),
12631263
in the specified topics and partitions.
@@ -1294,7 +1294,7 @@ def delete_records(self, topic_partition_offsets, **kwargs):
12941294
super(AdminClient, self).delete_records(topic_partition_offsets, f, **kwargs)
12951295
return futmap
12961296

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

0 commit comments

Comments
 (0)