diff --git a/dev_requirements.txt b/dev_requirements.txt index e9d5738b69..a8da4b49cd 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,8 +1,8 @@ black==24.3.0 cachetools click==8.0.4 -flake8-isort==6.0.0 -flake8==5.0.4 +flake8-isort +flake8 flynt~=0.69.0 invoke==2.2.0 mock diff --git a/redis/_parsers/helpers.py b/redis/_parsers/helpers.py index 2341c92d8a..23fc6db40e 100644 --- a/redis/_parsers/helpers.py +++ b/redis/_parsers/helpers.py @@ -507,7 +507,7 @@ def parse_geosearch_generic(response, **options): except KeyError: # it means the command was sent via execute_command return response - if type(response) != list: + if not isinstance(response, list): response_list = [response] else: response_list = response diff --git a/redis/commands/core.py b/redis/commands/core.py index 26af9eb99c..5a27a2ea31 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -1380,9 +1380,6 @@ def failover(self): ) -AsyncManagementCommands = ManagementCommands - - class AsyncManagementCommands(ManagementCommands): async def command_info(self, **kwargs) -> None: return super().command_info(**kwargs) diff --git a/redis/commands/timeseries/info.py b/redis/commands/timeseries/info.py index d86b92ace2..861e3ef003 100644 --- a/redis/commands/timeseries/info.py +++ b/redis/commands/timeseries/info.py @@ -78,7 +78,7 @@ def __init__(self, args): self.chunk_size = response["chunkSize"] if "duplicatePolicy" in response: self.duplicate_policy = response["duplicatePolicy"] - if type(self.duplicate_policy) == bytes: + if isinstance(self.duplicate_policy, bytes): self.duplicate_policy = self.duplicate_policy.decode() def get(self, item): diff --git a/redis/typing.py b/redis/typing.py index ee4296245f..b4d442c444 100644 --- a/redis/typing.py +++ b/redis/typing.py @@ -54,10 +54,8 @@ class CommandsProtocol(Protocol): connection_pool: Union["AsyncConnectionPool", "ConnectionPool"] - def execute_command(self, *args, **options): ... + def execute_command(self, *args, **options) -> ResponseT: ... -class ClusterCommandsProtocol(CommandsProtocol, Protocol): +class ClusterCommandsProtocol(CommandsProtocol): encoder: "Encoder" - - def execute_command(self, *args, **options) -> Union[Any, Awaitable]: ... diff --git a/tests/test_asyncio/test_connection_pool.py b/tests/test_asyncio/test_connection_pool.py index 5e4d3f206f..2f5bbfb621 100644 --- a/tests/test_asyncio/test_connection_pool.py +++ b/tests/test_asyncio/test_connection_pool.py @@ -647,7 +647,6 @@ def test_connect_from_url_tcp(self): connection = redis.Redis.from_url("redis://localhost") pool = connection.connection_pool - print(repr(pool)) assert re.match( r"< .*?([^\.]+) \( < .*?([^\.]+) \( (.+) \) > \) >", repr(pool), re.VERBOSE ).groups() == ( diff --git a/tests/test_asyncio/test_lock.py b/tests/test_asyncio/test_lock.py index 9eaaed6920..033a8b7467 100644 --- a/tests/test_asyncio/test_lock.py +++ b/tests/test_asyncio/test_lock.py @@ -237,4 +237,4 @@ def __init__(self, *args, **kwargs): pass lock = r.lock("foo", lock_class=MyLock) - assert type(lock) == MyLock + assert isinstance(lock, MyLock) diff --git a/tests/test_json.py b/tests/test_json.py index 50787c717c..f4cea73787 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -446,7 +446,6 @@ def test_json_forget_with_dollar(client): client.json().forget("not_a_document", "..a") -@pytest.mark.onlynoncluster @pytest.mark.redismod def test_json_mget_dollar(client): # Test mget with multi paths diff --git a/tests/test_lock.py b/tests/test_lock.py index 5c804b426e..d77ff9717a 100644 --- a/tests/test_lock.py +++ b/tests/test_lock.py @@ -257,4 +257,4 @@ def __init__(self, *args, **kwargs): pass lock = r.lock("foo", lock_class=MyLock) - assert type(lock) == MyLock + assert isinstance(lock, MyLock)