Skip to content

Commit

Permalink
Fix typing for address_remap (fixes #3234) (#3235)
Browse files Browse the repository at this point in the history
The address_remap callback received a tuple with the host and the port.
Make this clear in the typing hints.
  • Loading branch information
daveisfera authored May 21, 2024
1 parent de8b570 commit 9a70f62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions redis/asyncio/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def __init__(
ssl_min_version: Optional[ssl.TLSVersion] = None,
ssl_ciphers: Optional[str] = None,
protocol: Optional[int] = 2,
address_remap: Optional[Callable[[str, int], Tuple[str, int]]] = None,
address_remap: Optional[Callable[[Tuple[str, int]], Tuple[str, int]]] = None,
cache_enabled: bool = False,
client_cache: Optional[AbstractCache] = None,
cache_max_size: int = 100,
Expand Down Expand Up @@ -1152,7 +1152,7 @@ def __init__(
startup_nodes: List["ClusterNode"],
require_full_coverage: bool,
connection_kwargs: Dict[str, Any],
address_remap: Optional[Callable[[str, int], Tuple[str, int]]] = None,
address_remap: Optional[Callable[[Tuple[str, int]], Tuple[str, int]]] = None,
) -> None:
self.startup_nodes = {node.name: node for node in startup_nodes}
self.require_full_coverage = require_full_coverage
Expand Down
4 changes: 2 additions & 2 deletions redis/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ def __init__(
read_from_replicas: bool = False,
dynamic_startup_nodes: bool = True,
url: Optional[str] = None,
address_remap: Optional[Callable[[str, int], Tuple[str, int]]] = None,
address_remap: Optional[Callable[[Tuple[str, int]], Tuple[str, int]]] = None,
**kwargs,
):
"""
Expand Down Expand Up @@ -1347,7 +1347,7 @@ def __init__(
lock=None,
dynamic_startup_nodes=True,
connection_pool_class=ConnectionPool,
address_remap: Optional[Callable[[str, int], Tuple[str, int]]] = None,
address_remap: Optional[Callable[[Tuple[str, int]], Tuple[str, int]]] = None,
**kwargs,
):
self.nodes_cache = {}
Expand Down

0 comments on commit 9a70f62

Please sign in to comment.