diff --git a/568.misc b/568.misc new file mode 100644 index 00000000..5fe0165d --- /dev/null +++ b/568.misc @@ -0,0 +1 @@ +Update type comments to type annotations. diff --git a/django_redis/client/default.py b/django_redis/client/default.py index eb62d8ec..1df90a27 100644 --- a/django_redis/client/default.py +++ b/django_redis/client/default.py @@ -42,7 +42,7 @@ def __init__(self, server, params: Dict[str, Any], backend: BaseCache) -> None: if not isinstance(self._server, (list, tuple, set)): self._server = self._server.split(",") - self._clients = [None] * len(self._server) # type: List[Optional[Redis]] + self._clients: List[Optional[Redis]] = [None] * len(self._server) self._options = params.get("OPTIONS", {}) self._replica_read_only = self._options.get("REPLICA_READ_ONLY", True) @@ -146,7 +146,7 @@ def set( timeout = self._backend.default_timeout original_client = client - tried = [] # type: List[int] + tried: List[int] = [] while True: try: if client is None: diff --git a/django_redis/hash_ring.py b/django_redis/hash_ring.py index 5260b275..be456f7e 100644 --- a/django_redis/hash_ring.py +++ b/django_redis/hash_ring.py @@ -4,7 +4,7 @@ class HashRing: - nodes = [] # type: List[str] + nodes: List[str] = [] def __init__(self, nodes: Iterable[str] = (), replicas: int = 128) -> None: self.replicas: int = replicas diff --git a/django_redis/pool.py b/django_redis/pool.py index 0cbd0592..dda3b945 100644 --- a/django_redis/pool.py +++ b/django_redis/pool.py @@ -17,7 +17,7 @@ class ConnectionFactory: # ConnectionFactory is instantiated, as Django creates new cache client # (DefaultClient) instance for every request. - _pools = {} # type: Dict[str, Redis] + _pools: Dict[str, Redis] = {} def __init__(self, options): pool_cls_path = options.get(