Skip to content

Commit

Permalink
Reorganizing the parsers code
Browse files Browse the repository at this point in the history
  • Loading branch information
dvora-h committed Feb 6, 2023
1 parent 428d609 commit 5bed49a
Show file tree
Hide file tree
Showing 26 changed files with 965 additions and 999 deletions.
4 changes: 2 additions & 2 deletions benchmarks/socket_read_size.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from base import Benchmark

from redis.connection import HiredisParser, PythonParser
from redis.connection import PythonParser, _HiredisParser


class SocketReadBenchmark(Benchmark):

ARGUMENTS = (
{"name": "parser", "values": [PythonParser, HiredisParser]},
{"name": "parser", "values": [PythonParser, _HiredisParser]},
{
"name": "value_size",
"values": [10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000],
Expand Down
2 changes: 0 additions & 2 deletions redis/asyncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
SSLConnection,
UnixDomainSocketConnection,
)
from redis.asyncio.parser import CommandsParser
from redis.asyncio.sentinel import (
Sentinel,
SentinelConnectionPool,
Expand Down Expand Up @@ -38,7 +37,6 @@
"BlockingConnectionPool",
"BusyLoadingError",
"ChildDeadlockedError",
"CommandsParser",
"Connection",
"ConnectionError",
"ConnectionPool",
Expand Down
12 changes: 3 additions & 9 deletions redis/asyncio/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,8 @@
)

from redis.asyncio.client import ResponseCallbackT
from redis.asyncio.connection import (
Connection,
DefaultParser,
Encoder,
SSLConnection,
parse_url,
)
from redis.asyncio.connection import Connection, DefaultParser, SSLConnection, parse_url
from redis.asyncio.lock import Lock
from redis.asyncio.parser import CommandsParser
from redis.asyncio.retry import Retry
from redis.backoff import default_backoff
from redis.client import EMPTY_RESPONSE, NEVER_DECODE, AbstractRedis
Expand Down Expand Up @@ -60,6 +53,7 @@
TimeoutError,
TryAgainError,
)
from redis.parsers import AsyncCommandsParser, Encoder
from redis.typing import AnyKeyT, EncodableT, KeyT
from redis.utils import dict_merge, safe_str, str_if_bytes

Expand Down Expand Up @@ -344,7 +338,7 @@ def __init__(
self.cluster_error_retry_attempts = cluster_error_retry_attempts
self.connection_error_retry_attempts = connection_error_retry_attempts
self.reinitialize_counter = 0
self.commands_parser = CommandsParser()
self.commands_parser = AsyncCommandsParser()
self.node_flags = self.__class__.NODE_FLAGS.copy()
self.command_flags = self.__class__.COMMAND_FLAGS.copy()
self.response_callbacks = kwargs["response_callbacks"]
Expand Down
Loading

0 comments on commit 5bed49a

Please sign in to comment.