Skip to content

Commit ddf3354

Browse files
committed
remove pydantic v1 references
1 parent 277ed25 commit ddf3354

File tree

10 files changed

+89
-232
lines changed

10 files changed

+89
-232
lines changed

aredis_om/__init__.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,25 @@
1616
RedisModelError,
1717
VectorFieldOptions,
1818
)
19+
20+
21+
__all__ = [
22+
"redis",
23+
"get_redis_connection",
24+
"Field",
25+
"HashModel",
26+
"JsonModel",
27+
"EmbeddedJsonModel",
28+
"RedisModel",
29+
"FindQuery",
30+
"KNNExpression",
31+
"VectorFieldOptions",
32+
"has_redis_json",
33+
"has_redisearch",
34+
"MigrationError",
35+
"Migrator",
36+
"RedisModelError",
37+
"NotFoundError",
38+
"QueryNotSupportedError",
39+
"QuerySyntaxError",
40+
]

aredis_om/_compat.py

Lines changed: 0 additions & 99 deletions
This file was deleted.

aredis_om/async_redis.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
from redis import asyncio as redis
2+
3+
4+
__all__ = ["redis"]

aredis_om/checks.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from functools import lru_cache
2-
from typing import List
32

43
from aredis_om.connections import get_redis_connection
54

aredis_om/model/encoders.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
from types import GeneratorType
3232
from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union
3333

34-
from .._compat import ENCODERS_BY_TYPE, BaseModel
35-
34+
from pydantic import BaseModel
35+
from pydantic.deprecated.json import ENCODERS_BY_TYPE
36+
from pydantic_core import PydanticUndefined
3637

3738
SetIntStr = Set[Union[int, str]]
3839
DictIntStrAny = Dict[Union[int, str], Any]
@@ -106,6 +107,7 @@ def jsonable_encoder(
106107
or (not isinstance(key, str))
107108
or (not key.startswith("_sa"))
108109
)
110+
and value is not PydanticUndefined
109111
and (value is not None or not exclude_none)
110112
and ((include and key in include) or not exclude or key not in exclude)
111113
):

aredis_om/model/migrations/migrator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ async def detect_migrations(self):
131131

132132
stored_hash = await conn.get(hash_key)
133133
if isinstance(stored_hash, bytes):
134-
stored_hash = stored_hash.decode('utf-8')
134+
stored_hash = stored_hash.decode("utf-8")
135135

136136
schema_out_of_date = current_hash != stored_hash
137137

0 commit comments

Comments
 (0)