summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChayim I. Kirshen <c@kirshen.com>2022-11-29 13:10:05 +0200
committerChayim I. Kirshen <c@kirshen.com>2022-11-29 13:10:05 +0200
commitf2b3a6f9e5a35090d677b396cc68dec7281a85e1 (patch)
treefec516bda74eeee29e74bf0edb57414634f1fe47
parent87bae8e0f298b684a47eb66a655d3d8f38959c6f (diff)
downloadredis-py-f2b3a6f9e5a35090d677b396cc68dec7281a85e1.tar.gz
same for hiredis
-rw-r--r--benchmarks/socket_read_size.py4
-rw-r--r--redis/asyncio/connection.py6
-rwxr-xr-xredis/connection.py6
-rw-r--r--redis/parsers/__init__.py6
-rw-r--r--redis/parsers/hiredis.py4
-rw-r--r--tests/test_asyncio/conftest.py6
-rw-r--r--tests/test_asyncio/test_pubsub.py2
-rw-r--r--tests/test_pubsub.py2
8 files changed, 18 insertions, 18 deletions
diff --git a/benchmarks/socket_read_size.py b/benchmarks/socket_read_size.py
index 3427956..d3d8944 100644
--- a/benchmarks/socket_read_size.py
+++ b/benchmarks/socket_read_size.py
@@ -1,12 +1,12 @@
from base import Benchmark
-from redis.connection import HiredisParser, PythonParser
+from redis.connection import _HiredisParser, PythonParser
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],
diff --git a/redis/asyncio/connection.py b/redis/asyncio/connection.py
index f912970..93d8dc2 100644
--- a/redis/asyncio/connection.py
+++ b/redis/asyncio/connection.py
@@ -43,7 +43,7 @@ from redis.exceptions import (
from redis.typing import EncodableT
from redis.utils import HIREDIS_AVAILABLE, str_if_bytes
-from ..parsers import AsyncHiredisParser, _AsyncRESP2Parser, BaseParser, Encoder
+from ..parsers import _AsyncHiredisParser, _AsyncRESP2Parser, BaseParser, Encoder
SYM_STAR = b"*"
SYM_DOLLAR = b"$"
@@ -76,9 +76,9 @@ NO_AUTH_SET_ERROR = {
}
-DefaultParser: Type[Union[_AsyncRESP2Parser, AsyncHiredisParser]]
+DefaultParser: Type[Union[_AsyncRESP2Parser, _AsyncHiredisParser]]
if HIREDIS_AVAILABLE:
- DefaultParser = AsyncHiredisParser
+ DefaultParser = _AsyncHiredisParser
else:
DefaultParser = _AsyncRESP2Parser
diff --git a/redis/connection.py b/redis/connection.py
index a83714e..c1ebbf4 100755
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -22,7 +22,7 @@ from .exceptions import (
ResponseError,
TimeoutError,
)
-from .parsers import Encoder, HiredisParser, _RESP2Parser
+from .parsers import Encoder, _HiredisParser, _RESP2Parser
from .retry import Retry
from .utils import (
CRYPTOGRAPHY_AVAILABLE,
@@ -56,9 +56,9 @@ NO_AUTH_SET_ERROR = {
}
-DefaultParser: Type[Union[_RESP2Parser, HiredisParser]]
+DefaultParser: Type[Union[_RESP2Parser, _HiredisParser]]
if HIREDIS_AVAILABLE:
- DefaultParser = HiredisParser
+ DefaultParser = _HiredisParser
else:
DefaultParser = _RESP2Parser
diff --git a/redis/parsers/__init__.py b/redis/parsers/__init__.py
index b80c30b..7ef59e2 100644
--- a/redis/parsers/__init__.py
+++ b/redis/parsers/__init__.py
@@ -1,16 +1,16 @@
from .commands import AsyncCommandsParser, CommandsParser
from .encoders import Encoder
-from .hiredis import AsyncHiredisParser, HiredisParser
+from .hiredis import _AsyncHiredisParser, _HiredisParser
from .base import BaseParser
from .resp2 import _AsyncRESP2Parser, _RESP2Parser
__all__ = [
"AsyncCommandsParser",
- "AsyncHiredisParser",
+ "_AsyncHiredisParser",
"_AsyncRESP2Parser",
"CommandsParser",
"Encoder",
"BaseParser",
- "HiredisParser",
+ "_HiredisParser",
"_RESP2Parser",
]
diff --git a/redis/parsers/hiredis.py b/redis/parsers/hiredis.py
index d84830a..00dd713 100644
--- a/redis/parsers/hiredis.py
+++ b/redis/parsers/hiredis.py
@@ -29,7 +29,7 @@ class _HiredisReaderArgs(TypedDict, total=False):
errors: Optional[str]
-class HiredisParser(BaseParser):
+class _HiredisParser(BaseParser):
"Parser class for connections using Hiredis"
def __init__(self, socket_read_size):
@@ -140,7 +140,7 @@ class HiredisParser(BaseParser):
return response
-class AsyncHiredisParser(AsyncBaseParser):
+class _AsyncHiredisParser(AsyncBaseParser):
"""PAsync implementation of parser class for connections using Hiredis"""
__slots__ = AsyncBaseParser.__slots__ + ("_reader",)
diff --git a/tests/test_asyncio/conftest.py b/tests/test_asyncio/conftest.py
index f018b49..28a6f06 100644
--- a/tests/test_asyncio/conftest.py
+++ b/tests/test_asyncio/conftest.py
@@ -12,7 +12,7 @@ from redis.asyncio.client import Monitor
from redis.asyncio.connection import parse_url
from redis.asyncio.retry import Retry
from redis.backoff import NoBackoff
-from redis.parsers import AsyncHiredisParser, _AsyncRESP2Parser
+from redis.parsers import _AsyncHiredisParser, _AsyncRESP2Parser
from redis.utils import HIREDIS_AVAILABLE
from tests.conftest import REDIS_INFO
@@ -36,7 +36,7 @@ async def _get_info(redis_url):
),
(False, _AsyncRESP2Parser),
pytest.param(
- (True, AsyncHiredisParser),
+ (True, _AsyncHiredisParser),
marks=[
pytest.mark.skipif(
'config.REDIS_INFO["cluster_enabled"]',
@@ -48,7 +48,7 @@ async def _get_info(redis_url):
],
),
pytest.param(
- (False, AsyncHiredisParser),
+ (False, _AsyncHiredisParser),
marks=pytest.mark.skipif(
not HIREDIS_AVAILABLE, reason="hiredis is not installed"
),
diff --git a/tests/test_asyncio/test_pubsub.py b/tests/test_asyncio/test_pubsub.py
index 08d8c19..5dc94f2 100644
--- a/tests/test_asyncio/test_pubsub.py
+++ b/tests/test_asyncio/test_pubsub.py
@@ -993,7 +993,7 @@ class TestBaseException:
assert pubsub.connection.is_connected
with patch("redis.parsers._AsyncRESP2Parser.read_response") as mock1:
mock1.side_effect = BaseException("boom")
- with patch("redis.parsers.AsyncHiredisParser.read_response") as mock2:
+ with patch("redis.parsers._AsyncHiredisParser.read_response") as mock2:
mock2.side_effect = BaseException("boom")
with pytest.raises(BaseException):
diff --git a/tests/test_pubsub.py b/tests/test_pubsub.py
index e6666e4..48c0f3a 100644
--- a/tests/test_pubsub.py
+++ b/tests/test_pubsub.py
@@ -769,7 +769,7 @@ class TestBaseException:
assert is_connected()
with patch("redis.parsers._RESP2Parser.read_response") as mock1:
mock1.side_effect = BaseException("boom")
- with patch("redis.parsers.HiredisParser.read_response") as mock2:
+ with patch("redis.parsers._HiredisParser.read_response") as mock2:
mock2.side_effect = BaseException("boom")
with pytest.raises(BaseException):