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 and gerzse committed Jul 11, 2024
1 parent 36ef8f9 commit 206d65b
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 @@ -269,7 +269,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,
) -> None:
if db:
raise RedisClusterException(
Expand Down Expand Up @@ -1098,7 +1098,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 @@ -499,7 +499,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 @@ -1310,7 +1310,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 206d65b

Please sign in to comment.