Skip to content

Commit

Permalink
Fix typing for address_remap (fixes redis#3234) (redis#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.

Signed-off-by: Salvatore Mesoraca <salvatore.mesoraca@aiven.io>
  • Loading branch information
daveisfera authored and aiven-sal committed Jun 14, 2024
1 parent f832eef commit 949159c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions valkey/asyncio/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,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 @@ -1155,7 +1155,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 valkey/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,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 @@ -1344,7 +1344,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 949159c

Please sign in to comment.