ormlambda 3.35.1__py3-none-any.whl → 3.35.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ormlambda/databases/my_sql/caster/types/iterable.py +4 -3
- ormlambda/sql/table/table.py +2 -5
- ormlambda/util/__init__.py +15 -1
- {ormlambda-3.35.1.dist-info → ormlambda-3.35.3.dist-info}/METADATA +1 -1
- {ormlambda-3.35.1.dist-info → ormlambda-3.35.3.dist-info}/RECORD +8 -8
- {ormlambda-3.35.1.dist-info → ormlambda-3.35.3.dist-info}/AUTHORS +0 -0
- {ormlambda-3.35.1.dist-info → ormlambda-3.35.3.dist-info}/LICENSE +0 -0
- {ormlambda-3.35.1.dist-info → ormlambda-3.35.3.dist-info}/WHEEL +0 -0
@@ -1,8 +1,9 @@
|
|
1
1
|
from typing import Optional
|
2
2
|
from ormlambda.caster import BaseCaster, Caster
|
3
|
+
from .json import JsonCaster
|
3
4
|
|
4
5
|
|
5
|
-
class IterableCaster[TType](
|
6
|
+
class IterableCaster[TType](JsonCaster[TType]):
|
6
7
|
def __init__(self, value: bytes, type_value: TType):
|
7
8
|
super().__init__(value, type_value)
|
8
9
|
|
@@ -18,12 +19,12 @@ class IterableCaster[TType](BaseCaster[bytes, TType]):
|
|
18
19
|
@property
|
19
20
|
@BaseCaster.return_value_if_exists
|
20
21
|
def to_database(self) -> Optional[bytes]:
|
21
|
-
return
|
22
|
+
return super().to_database
|
22
23
|
|
23
24
|
@property
|
24
25
|
@BaseCaster.return_value_if_exists
|
25
26
|
def from_database(self) -> Optional[bytes]:
|
26
|
-
return
|
27
|
+
return super().from_database
|
27
28
|
|
28
29
|
@property
|
29
30
|
@BaseCaster.return_value_if_exists
|
ormlambda/sql/table/table.py
CHANGED
@@ -6,6 +6,7 @@ from ormlambda.sql import Column
|
|
6
6
|
from ormlambda.sql import ForeignKey
|
7
7
|
from ormlambda.util.module_tree.dfs_traversal import DFSTraversal
|
8
8
|
from ormlambda.sql.ddl import CreateTable
|
9
|
+
from ormlambda.util import make_hashable
|
9
10
|
|
10
11
|
if TYPE_CHECKING:
|
11
12
|
from ormlambda.statements import BaseStatement
|
@@ -96,11 +97,7 @@ class Table(metaclass=TableMeta):
|
|
96
97
|
dicc: dict[str, Any] = {}
|
97
98
|
for x in self.__annotations__:
|
98
99
|
value = getattr(self, x)
|
99
|
-
|
100
|
-
value = tuple(sorted(value.items()))
|
101
|
-
if isinstance(value, list | set):
|
102
|
-
value = tuple(value)
|
103
|
-
dicc[x] = value
|
100
|
+
dicc[x] = make_hashable(value)
|
104
101
|
return dicc
|
105
102
|
|
106
103
|
@classmethod
|
ormlambda/util/__init__.py
CHANGED
@@ -2,7 +2,7 @@ from .module_tree import ModuleTree # noqa: F401
|
|
2
2
|
from .load_module import __load_module__ # noqa: F401
|
3
3
|
import types
|
4
4
|
import inspect
|
5
|
-
from typing import Any, Literal, Optional,
|
5
|
+
from typing import Any, Literal, Optional, overload, get_origin, TypeGuard, TypeAliasType
|
6
6
|
from ormlambda.util.typing import LITERAL_TYPES, _AnnotationScanType
|
7
7
|
from .plugin_loader import PluginLoader # noqa: F401
|
8
8
|
|
@@ -86,3 +86,17 @@ def is_literal(type_: Any) -> bool:
|
|
86
86
|
|
87
87
|
def is_pep695(type_: _AnnotationScanType) -> TypeGuard[TypeAliasType]:
|
88
88
|
return isinstance(type_, TypeAliasType)
|
89
|
+
|
90
|
+
|
91
|
+
def make_hashable(item: Any) -> Any:
|
92
|
+
if isinstance(item, dict):
|
93
|
+
return tuple(sorted((k, make_hashable(x)) for k, x in item.items()))
|
94
|
+
|
95
|
+
if isinstance(item, (list | set)):
|
96
|
+
return tuple(make_hashable(x) for x in item)
|
97
|
+
if hasattr(item, "__iter__") and not isinstance(item, str | bytes):
|
98
|
+
try:
|
99
|
+
return tuple(make_hashable(x) for x in item)
|
100
|
+
except TypeError:
|
101
|
+
return item # if it fails, it's already hashable
|
102
|
+
return item
|
@@ -33,7 +33,7 @@ ormlambda/databases/my_sql/caster/types/datetime.py,sha256=ISzcsbwijTa2wC9ZD8zy5
|
|
33
33
|
ormlambda/databases/my_sql/caster/types/decimal.py,sha256=ycQnSqO-aFkrcsa8JKVPdnfjotNL_BUFeScYRcueOWM,1068
|
34
34
|
ormlambda/databases/my_sql/caster/types/float.py,sha256=EbU6J3yoL5_naLowfibkfUC9Bk9WzDaWks7lJ2pNhyA,1026
|
35
35
|
ormlambda/databases/my_sql/caster/types/int.py,sha256=a30xbe0LNj2BvbtLNZhUXFvT3WJ115MFsHC19Y3NLTk,1016
|
36
|
-
ormlambda/databases/my_sql/caster/types/iterable.py,sha256=
|
36
|
+
ormlambda/databases/my_sql/caster/types/iterable.py,sha256=S7pEAJ_NaxZqYhJAXwaJBS_zrbSz9J2yiYPpmDHATso,1057
|
37
37
|
ormlambda/databases/my_sql/caster/types/json.py,sha256=AR7D6CEgyK3zAEijyNO1AuWtLBgC7KTj-YNEWkyilkg,1042
|
38
38
|
ormlambda/databases/my_sql/caster/types/none.py,sha256=Bl4jpVVyoLG7ehoCAYj9lFBZbRWbyDN8QsQeWmIb84I,948
|
39
39
|
ormlambda/databases/my_sql/caster/types/point.py,sha256=GHAf51kE0AS7wOlCYM9YW-z2ZbmY8hXwcHs979ZCeaY,1442
|
@@ -131,7 +131,7 @@ ormlambda/sql/interfaces/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
131
131
|
ormlambda/sql/sqltypes.py,sha256=mvFn_YM0RTpQWj_ggE4SfbD_LxQhjJX4Kz2M3XUsuBk,14442
|
132
132
|
ormlambda/sql/table/__init__.py,sha256=LLZcMLjwFxgBCPhdm5UQYYZDIbtYWCKPO9CbcXsy5zI,50
|
133
133
|
ormlambda/sql/table/fields.py,sha256=ovNR3bJ473aKW-2NhbKr0iJlVpgW06jurHLob2IyZU8,2116
|
134
|
-
ormlambda/sql/table/table.py,sha256=
|
134
|
+
ormlambda/sql/table/table.py,sha256=3p7JPdYu3tGEw3jfNk2Qm36NrBFvyGQXcdBNI2p-pkk,6567
|
135
135
|
ormlambda/sql/table/table_constructor.py,sha256=c3Z-1El0onSClYBmAatoUBYUOT70tITVqtsDJMxZ9QU,1092
|
136
136
|
ormlambda/sql/type_api.py,sha256=vepqMw6hR4zVhhNIYbtX491iVsxAfwHiSiD3uYQUGTE,1067
|
137
137
|
ormlambda/sql/types.py,sha256=lQxC5gbhDPRckGSRJZ4rYSZr-XUvIMMH8WfkN1wtM1g,844
|
@@ -145,15 +145,15 @@ ormlambda/statements/statements.py,sha256=ZgZdrwXwj4QBpY_ogTy4S-8i3uH42LHEuGOMcI
|
|
145
145
|
ormlambda/statements/types.py,sha256=wNxgXOlL8zBT9PtVgDSnEZFmZdNAJhSzxsR9QLMzO0A,1873
|
146
146
|
ormlambda/types/__init__.py,sha256=xVFaIMcfJvbbXs8BAvmBh8FwSiLn2R6yjZs9o-h08XM,323
|
147
147
|
ormlambda/types/metadata.py,sha256=93eJItdVDOItf7YRJUVmN_m79WLa3Ge6I414ewYnKeM,624
|
148
|
-
ormlambda/util/__init__.py,sha256=
|
148
|
+
ormlambda/util/__init__.py,sha256=k0lT-9VrU5jkYV2IANr-lcANP8JlSqO0z-9zJ-pjDpw,3386
|
149
149
|
ormlambda/util/load_module.py,sha256=W9NeCuwditS0UuQU0TlVHA65E74NYggEEfdWy1ap9ZI,648
|
150
150
|
ormlambda/util/module_tree/__init__.py,sha256=LNQtqkwO1ul49Th3aHAIiyt0Wt899GmXCc44Uz1eDyY,53
|
151
151
|
ormlambda/util/module_tree/dfs_traversal.py,sha256=lSF03G63XtJFLp03ueAmsHMBvhUkjptDbK3IugXm8iU,1425
|
152
152
|
ormlambda/util/module_tree/dynamic_module.py,sha256=vJOqvm5-WKksudXBK1IcTn4WsuLxt1qXNISq-_21sy4,8705
|
153
153
|
ormlambda/util/plugin_loader.py,sha256=p6WLn-MF1bQd2i2GHy98WQjNKmbQdqIUyTFIcBIHC5M,1034
|
154
154
|
ormlambda/util/typing.py,sha256=Z7irz53ui0hoFnJTe06NX4JPl60_thgdjJIxh5gjGGk,169
|
155
|
-
ormlambda-3.35.
|
156
|
-
ormlambda-3.35.
|
157
|
-
ormlambda-3.35.
|
158
|
-
ormlambda-3.35.
|
159
|
-
ormlambda-3.35.
|
155
|
+
ormlambda-3.35.3.dist-info/AUTHORS,sha256=uWpOHaCPTOLbVkk5x9McoLwbgzSeCg7yILeDRyMGWGM,606
|
156
|
+
ormlambda-3.35.3.dist-info/LICENSE,sha256=xBprFw8GJLdHMOoUqDk0427EvjIcbEREvXXVFULuuXU,1080
|
157
|
+
ormlambda-3.35.3.dist-info/METADATA,sha256=M6Hi8T3ZDQYc_jagfS5fpMa7HPtwOnerYUw5DPOCXTU,13326
|
158
|
+
ormlambda-3.35.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
159
|
+
ormlambda-3.35.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|