diff options
author | Utkarsh Gupta <utkarshgupta137@gmail.com> | 2022-05-30 19:04:06 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-30 16:34:06 +0300 |
commit | f704281cf4c1f735c06a13946fcea42fa939e3a5 (patch) | |
tree | 85a7affc680058b54d1df30d65e1f97c44c08847 /redis/utils.py | |
parent | 48079083a7f6ac1bdd948c03175f9ffd42aa1f6b (diff) | |
download | redis-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.py | 5 |
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` |