Skip to content

Commit 25fe06c

Browse files
committed
Fix AdminClient type annotation (#2244)
1 parent 7d0abd5 commit 25fe06c

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/confluent_kafka/admin/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import concurrent.futures
2525
import warnings
26+
from collections.abc import Mapping
2627
from typing import Any, Dict, List, Optional, Set, Tuple, Union
2728

2829
from confluent_kafka import ConsumerGroupState as _ConsumerGroupState
@@ -115,7 +116,7 @@ class AdminClient(_AdminClientImpl):
115116
Requires broker version v0.11.0.0 or later.
116117
"""
117118

118-
def __init__(self, conf: Dict[str, Union[str, int, float, bool]], **kwargs: Any) -> None:
119+
def __init__(self, conf: Mapping[str, Union[str, int, float, bool]], **kwargs: Any) -> None:
119120
"""
120121
Create a new AdminClient using the provided configuration dictionary.
121122

src/confluent_kafka/cimpl.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ maintenance burden and get type hints directly from the implementation.
3535
"""
3636

3737
import builtins
38+
from collections.abc import Mapping
3839
from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Union, overload
3940

4041
try:
@@ -540,7 +541,7 @@ class Consumer:
540541
def set_sasl_credentials(self, username: str, password: str) -> None: ...
541542

542543
class _AdminClientImpl:
543-
def __init__(self, config: Dict[str, Union[str, int, float, bool]]) -> None: ...
544+
def __init__(self, config: Mapping[str, Union[str, int, float, bool]]) -> None: ...
544545
def __enter__(self) -> Self: ...
545546
def __exit__(self, exc_type: Any, exc_value: Any, exc_traceback: Any) -> Optional[bool]: ...
546547
def create_topics(

0 commit comments

Comments
 (0)