From f887618f2346e62c15e46e7523d2451d4547b070 Mon Sep 17 00:00:00 2001 From: Bar Shaul Date: Sun, 20 Nov 2022 10:57:47 +0200 Subject: [PATCH] Added ClusterNode type --- redis/cluster.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/redis/cluster.py b/redis/cluster.py index 56c354b814..f915c71eb2 100644 --- a/redis/cluster.py +++ b/redis/cluster.py @@ -4,7 +4,7 @@ import threading import time from collections import OrderedDict -from typing import Any, Callable, Dict, List, Optional, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Tuple, Union, TypeVar from redis.backoff import default_backoff from redis.client import CaseInsensitiveDict, PubSub, Redis, parse_scan @@ -38,6 +38,10 @@ str_if_bytes, ) +TargetNodesT = TypeVar( + "TargetNodesT", str, "ClusterNode", List["ClusterNode"], Dict[Any, "ClusterNode"] +) + def get_node_name(host: str, port: Union[str, int]) -> str: return f"{host}:{port}"