Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Adar Ovadia committed Jun 30, 2024
1 parent d8d262a commit bd429d0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
11 changes: 1 addition & 10 deletions python/python/glide/async_commands/cluster_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,7 @@
_build_sort_args,
)
from glide.async_commands.transaction import BaseTransaction, ClusterTransaction
from glide.async_commands.utils.utils import (
convert_bytes_to_string_cluster_response,
convert_bytes_to_string_dict,
)
from glide.constants import (
TOK,
TClusterResponse,
TResult,
TSingleNodeRoute,
)
from glide.constants import TOK, TClusterResponse, TResult, TSingleNodeRoute
from glide.protobuf.redis_request_pb2 import RequestType
from glide.routes import Route

Expand Down
6 changes: 4 additions & 2 deletions python/python/glide/async_commands/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@


def convert_bytes_to_string_dict(
# TODO: remove the str options
byte_string_dict: Optional[Union[Mapping[bytes, Any], Dict[bytes, Any], Mapping[str, Any], Dict[str, Any]]]
# TODO: remove the str options
byte_string_dict: Optional[
Union[Mapping[bytes, Any], Dict[bytes, Any], Mapping[str, Any], Dict[str, Any]]
]
) -> Optional[Dict[str, Any]]:
"""
Recursively convert the keys and values of a dictionary from byte strings to regular strings,
Expand Down
13 changes: 10 additions & 3 deletions python/python/tests/test_async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,9 @@ async def test_config_get_set(self, redis_client: TGlideClient):
assert isinstance(previous_timeout_decoded, dict)
assert isinstance(previous_timeout_decoded["timeout"], str)
assert (
await redis_client.config_set({"timeout": previous_timeout_decoded["timeout"]})
await redis_client.config_set(
{"timeout": previous_timeout_decoded["timeout"]}
)
== OK
)

Expand Down Expand Up @@ -5356,7 +5358,10 @@ async def test_xgroup_create_consumer_xreadgroup_xgroup_del_consumer(

# now xreadgroup yields one empty stream entry and one non-empty stream entry
assert await redis_client.xreadgroup({key: "0"}, group_name, consumer_name) == {
key.encode(): {stream_id1_0.encode(): None, stream_id1_1.encode(): [[b"f1_1", b"v1_1"]]}
key.encode(): {
stream_id1_0.encode(): None,
stream_id1_1.encode(): [[b"f1_1", b"v1_1"]],
}
}

assert (
Expand Down Expand Up @@ -6876,7 +6881,9 @@ async def test_function_load_cluster_with_route(
lib_name, {func_name: "return args[1]", func2_name: "return #args"}, True
)

assert await redis_client.function_load(new_code, True, route) == lib_name.encode()
assert (
await redis_client.function_load(new_code, True, route) == lib_name.encode()
)

@pytest.mark.parametrize("cluster_mode", [True, False])
@pytest.mark.parametrize("protocol", [ProtocolVersion.RESP2, ProtocolVersion.RESP3])
Expand Down
2 changes: 2 additions & 0 deletions python/python/tests/test_pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ async def create_two_clients(
)
return client, client2


def decode_pubsub_msg(msg: Optional[CoreCommands.PubSubMsg]) -> CoreCommands.PubSubMsg:
if not msg:
return CoreCommands.PubSubMsg("", "", None)
Expand All @@ -86,6 +87,7 @@ def decode_pubsub_msg(msg: Optional[CoreCommands.PubSubMsg]) -> CoreCommands.Pub
decoded_msg = CoreCommands.PubSubMsg(string_msg, string_channel, string_pattern)
return decoded_msg


async def get_message_by_method(
method: MethodTesting,
client: TGlideClient,
Expand Down
2 changes: 1 addition & 1 deletion python/python/tests/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
from tests.conftest import create_client
from tests.utils.utils import (
check_if_server_version_lt,
convert_bytes_to_string_dict,
generate_lua_lib_code,
get_random_string,
convert_bytes_to_string_dict,
)


Expand Down
2 changes: 1 addition & 1 deletion python/python/tests/utils/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
import random
import string
from typing import Any, cast, Dict, List, Mapping, Optional, TypeVar, Union
from typing import Any, Dict, List, Mapping, Optional, TypeVar, Union, cast

from glide.async_commands.core import InfoSection
from glide.async_commands.utils.utils import convert_bytes_to_string_dict
Expand Down

0 comments on commit bd429d0

Please sign in to comment.