summaryrefslogtreecommitdiff
path: root/redis/utils.py
diff options
context:
space:
mode:
authorUtkarsh Gupta <utkarshgupta137@gmail.com>2022-05-30 19:04:06 +0530
committerGitHub <noreply@github.com>2022-05-30 16:34:06 +0300
commitf704281cf4c1f735c06a13946fcea42fa939e3a5 (patch)
tree85a7affc680058b54d1df30d65e1f97c44c08847 /redis/utils.py
parent48079083a7f6ac1bdd948c03175f9ffd42aa1f6b (diff)
downloadredis-py-f704281cf4c1f735c06a13946fcea42fa939e3a5.tar.gz
async_cluster: add/update typing (#2195)
* async_cluster: add/update typing * async_cluster: update cleanup_kwargs with kwargs from async Connection * async_cluster: properly remove old nodes
Diffstat (limited to 'redis/utils.py')
-rw-r--r--redis/utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/redis/utils.py b/redis/utils.py
index 9ab75f2..0c34e1e 100644
--- a/redis/utils.py
+++ b/redis/utils.py
@@ -1,4 +1,5 @@
from contextlib import contextmanager
+from typing import Any, Dict, Mapping, Union
try:
import hiredis # noqa
@@ -34,7 +35,7 @@ def pipeline(redis_obj):
p.execute()
-def str_if_bytes(value):
+def str_if_bytes(value: Union[str, bytes]) -> str:
return (
value.decode("utf-8", errors="replace") if isinstance(value, bytes) else value
)
@@ -44,7 +45,7 @@ def safe_str(value):
return str(str_if_bytes(value))
-def dict_merge(*dicts):
+def dict_merge(*dicts: Mapping[str, Any]) -> Dict[str, Any]:
"""
Merge all provided dicts into 1 dict.
*dicts : `dict`