Skip to content

Commit 5bed49a

Browse files
committed
Reorganizing the parsers code
1 parent 428d609 commit 5bed49a

26 files changed

+965
-999
lines changed

benchmarks/socket_read_size.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from base import Benchmark
22

3-
from redis.connection import HiredisParser, PythonParser
3+
from redis.connection import PythonParser, _HiredisParser
44

55

66
class SocketReadBenchmark(Benchmark):
77

88
ARGUMENTS = (
9-
{"name": "parser", "values": [PythonParser, HiredisParser]},
9+
{"name": "parser", "values": [PythonParser, _HiredisParser]},
1010
{
1111
"name": "value_size",
1212
"values": [10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000],

redis/asyncio/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
SSLConnection,
88
UnixDomainSocketConnection,
99
)
10-
from redis.asyncio.parser import CommandsParser
1110
from redis.asyncio.sentinel import (
1211
Sentinel,
1312
SentinelConnectionPool,
@@ -38,7 +37,6 @@
3837
"BlockingConnectionPool",
3938
"BusyLoadingError",
4039
"ChildDeadlockedError",
41-
"CommandsParser",
4240
"Connection",
4341
"ConnectionError",
4442
"ConnectionPool",

redis/asyncio/cluster.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,8 @@
1717
)
1818

1919
from redis.asyncio.client import ResponseCallbackT
20-
from redis.asyncio.connection import (
21-
Connection,
22-
DefaultParser,
23-
Encoder,
24-
SSLConnection,
25-
parse_url,
26-
)
20+
from redis.asyncio.connection import Connection, DefaultParser, SSLConnection, parse_url
2721
from redis.asyncio.lock import Lock
28-
from redis.asyncio.parser import CommandsParser
2922
from redis.asyncio.retry import Retry
3023
from redis.backoff import default_backoff
3124
from redis.client import EMPTY_RESPONSE, NEVER_DECODE, AbstractRedis
@@ -60,6 +53,7 @@
6053
TimeoutError,
6154
TryAgainError,
6255
)
56+
from redis.parsers import AsyncCommandsParser, Encoder
6357
from redis.typing import AnyKeyT, EncodableT, KeyT
6458
from redis.utils import dict_merge, safe_str, str_if_bytes
6559

@@ -344,7 +338,7 @@ def __init__(
344338
self.cluster_error_retry_attempts = cluster_error_retry_attempts
345339
self.connection_error_retry_attempts = connection_error_retry_attempts
346340
self.reinitialize_counter = 0
347-
self.commands_parser = CommandsParser()
341+
self.commands_parser = AsyncCommandsParser()
348342
self.node_flags = self.__class__.NODE_FLAGS.copy()
349343
self.command_flags = self.__class__.COMMAND_FLAGS.copy()
350344
self.response_callbacks = kwargs["response_callbacks"]

0 commit comments

Comments
 (0)