summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvital Fine <79420960+AvitalFineRedis@users.noreply.github.com>2021-11-18 19:08:45 +0100
committerGitHub <noreply@github.com>2021-11-18 19:08:45 +0100
commit8fa8eab614b6dc7e60eeb506bef8d839d3fbf491 (patch)
treebb8e2851778b3e9237a405cffd799b7523a33a6f
parentdf9b0c64f4b8ac17bc41b4c6a85a06feedb96db7 (diff)
parent4e9cc015e32ef305429ff9dfa200e28dd63e6663 (diff)
downloadredis-py-8fa8eab614b6dc7e60eeb506bef8d839d3fbf491.tar.gz
Merge branch 'redis:master' into master
-rw-r--r--redis/__init__.py2
-rwxr-xr-xredis/client.py18
-rw-r--r--redis/commands/redismodules.py13
-rwxr-xr-xredis/connection.py5
-rw-r--r--tests/conftest.py3
5 files changed, 3 insertions, 38 deletions
diff --git a/redis/__init__.py b/redis/__init__.py
index 5d63543..480ffd8 100644
--- a/redis/__init__.py
+++ b/redis/__init__.py
@@ -37,7 +37,7 @@ def int_or_str(value):
return value
-__version__ = "4.0.0"
+__version__ = "4.0.1"
VERSION = tuple(map(int_or_str, __version__.split('.')))
diff --git a/redis/client.py b/redis/client.py
index 753770e..3230043 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -890,12 +890,6 @@ class Redis(RedisModuleCommands, CoreCommands, object):
self.response_callbacks = CaseInsensitiveDict(
self.__class__.RESPONSE_CALLBACKS)
- # preload our class with the available redis commands
- try:
- self.__redis_commands__()
- except RedisError:
- pass
-
def __repr__(self):
return "%s<%s>" % (type(self).__name__, repr(self.connection_pool))
@@ -927,18 +921,6 @@ class Redis(RedisModuleCommands, CoreCommands, object):
"""
setattr(self, funcname, func)
- def __redis_commands__(self):
- """Store the list of available commands, for our redis instance."""
- cmds = getattr(self, '__commands__', None)
- if cmds is not None:
- return cmds
- try:
- cmds = [c[0].upper().decode() for c in self.command()]
- except AttributeError: # if encoded
- cmds = [c[0].upper() for c in self.command()]
- self.__commands__ = cmds
- return cmds
-
def pipeline(self, transaction=True, shard_hint=None):
"""
Return a new pipeline object that can queue multiple commands for
diff --git a/redis/commands/redismodules.py b/redis/commands/redismodules.py
index b3cbee1..5f629fb 100644
--- a/redis/commands/redismodules.py
+++ b/redis/commands/redismodules.py
@@ -1,5 +1,4 @@
from json import JSONEncoder, JSONDecoder
-from redis.exceptions import ModuleError
class RedisModuleCommands:
@@ -10,10 +9,6 @@ class RedisModuleCommands:
def json(self, encoder=JSONEncoder(), decoder=JSONDecoder()):
"""Access the json namespace, providing support for redis json.
"""
- if 'JSON.SET' not in self.__commands__:
- raise ModuleError("redisjson is not loaded in redis. "
- "For more information visit "
- "https://redisjson.io/")
from .json import JSON
jj = JSON(
@@ -25,10 +20,6 @@ class RedisModuleCommands:
def ft(self, index_name="idx"):
"""Access the search namespace, providing support for redis search.
"""
- if 'FT.INFO' not in self.__commands__:
- raise ModuleError("redisearch is not loaded in redis. "
- "For more information visit "
- "https://redisearch.io/")
from .search import Search
s = Search(client=self, index_name=index_name)
@@ -38,10 +29,6 @@ class RedisModuleCommands:
"""Access the timeseries namespace, providing support for
redis timeseries data.
"""
- if 'TS.INFO' not in self.__commands__:
- raise ModuleError("reditimeseries is not loaded in redis. "
- "For more information visit "
- "https://redistimeseries.io/")
from .timeseries import TimeSeries
s = TimeSeries(client=self)
diff --git a/redis/connection.py b/redis/connection.py
index cb9acb4..35e9491 100755
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -63,11 +63,6 @@ if HIREDIS_AVAILABLE:
HIREDIS_SUPPORTS_ENCODING_ERRORS = \
hiredis_version >= LooseVersion('1.0.0')
- if not HIREDIS_SUPPORTS_BYTE_BUFFER:
- msg = ("redis-py works best with hiredis >= 0.1.4. You're running "
- "hiredis %s. Please consider upgrading." % hiredis.__version__)
- warnings.warn(msg)
-
HIREDIS_USE_BYTE_BUFFER = True
# only use byte buffer if hiredis supports it
if not HIREDIS_SUPPORTS_BYTE_BUFFER:
diff --git a/tests/conftest.py b/tests/conftest.py
index 31d3fbd..9504333 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -31,7 +31,8 @@ def pytest_addoption(parser):
def _get_info(redis_url):
client = redis.Redis.from_url(redis_url)
info = client.info()
- if 'dping' in client.__commands__:
+ cmds = [c[0].upper().decode() for c in client.command()]
+ if 'dping' in cmds:
info["enterprise"] = True
else:
info["enterprise"] = False