Skip to content

Commit 677426c

Browse files
committed
Update lock file with redis-py 6
1 parent 573caef commit 677426c

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

redisvl/index/index.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,17 @@
4343
from redis.commands.search.result import Result
4444
from redisvl.query.query import BaseQuery
4545

46+
from redis import __version__ as redis_version
4647
from redis.client import NEVER_DECODE
4748
from redis.commands.helpers import get_protocol_version # type: ignore
4849

4950
# Redis 5.x compatibility (6 fixed the import path)
50-
try:
51-
from redis.commands.search.index_definition import ( # type: ignore[import-untyped]
51+
if redis_version.startswith("5"):
52+
from redis.commands.search.index_definition import IndexDefinition
53+
else:
54+
from redis.commands.search.indexDefinition import ( # type: ignore[import-untyped, no-redef]
5255
IndexDefinition,
5356
)
54-
except ModuleNotFoundError:
55-
from redis.commands.search.indexDefinition import IndexDefinition
5657

5758
# Need Result outside TYPE_CHECKING for cast
5859
from redis.commands.search.result import Result

redisvl/index/storage.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,17 @@
1313
)
1414

1515
from pydantic import BaseModel, ValidationError
16+
from redis import __version__ as redis_version
1617

1718
# Add imports for Pipeline types
1819
from redis.asyncio.client import Pipeline as AsyncPipeline
1920
from redis.asyncio.cluster import ClusterPipeline as AsyncClusterPipeline
2021

2122
# Redis 5.x compatibility (6 fixed the import path)
22-
try:
23-
from redis.commands.search.index_definition import ( # type: ignore[import-untyped]
24-
IndexType,
25-
)
26-
except ModuleNotFoundError:
27-
from redis.commands.search.indexDefinition import IndexType
23+
if redis_version.startswith("5"):
24+
from redis.commands.search.index_definition import IndexType
25+
else:
26+
from redis.commands.search.indexDefinition import IndexType # type: ignore[import-untyped, no-redef]
2827

2928
from redisvl.exceptions import SchemaValidationError
3029
from redisvl.redis.utils import convert_bytes

redisvl/redis/utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import hashlib
22
import itertools
33
import time
4-
from typing import Any, Dict, List, Optional, Union, cast
4+
from typing import Any, Dict, List, Optional, Union
55

66
from redis import RedisCluster
7+
from redis import __version__ as redis_version
78
from redis.asyncio.cluster import RedisCluster as AsyncRedisCluster
89
from redis.client import NEVER_DECODE, Pipeline
910
from redis.commands.helpers import get_protocol_version
@@ -23,12 +24,12 @@
2324
from redis.commands.search.field import Field
2425

2526
# Redis 5.x compatibility (6 fixed the import path)
26-
try:
27-
from redis.commands.search.index_definition import ( # type: ignore[import-untyped]
27+
if redis_version.startswith("5"):
28+
from redis.commands.search.index_definition import IndexDefinition
29+
else:
30+
from redis.commands.search.indexDefinition import ( # type: ignore[import-untyped, no-redef]
2831
IndexDefinition,
2932
)
30-
except ModuleNotFoundError:
31-
from redis.commands.search.indexDefinition import IndexDefinition
3233

3334
from redis.commands.search.query import Query
3435
from redis.commands.search.result import Result

0 commit comments

Comments
 (0)