ormlambda 3.35.2__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.
@@ -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
- if isinstance(value, dict):
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
@@ -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, Sequence, overload, get_origin, TypeGuard, TypeAliasType
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ormlambda
3
- Version: 3.35.2
3
+ Version: 3.35.3
4
4
  Summary: ORM designed to interact with the database (currently with MySQL) using lambda functions and nested functions
5
5
  Author: p-hzamora
6
6
  Author-email: p.hzamora@icloud.com
@@ -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=Po6mWk6-ES8URSO6sdoFnnCIACrdce03y0LCcvgXAGk,6686
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=DZWwtrD8tNJxJcK7vdAuTdZeDJC6jBtqIDPv-i8GJFY,2910
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.2.dist-info/AUTHORS,sha256=uWpOHaCPTOLbVkk5x9McoLwbgzSeCg7yILeDRyMGWGM,606
156
- ormlambda-3.35.2.dist-info/LICENSE,sha256=xBprFw8GJLdHMOoUqDk0427EvjIcbEREvXXVFULuuXU,1080
157
- ormlambda-3.35.2.dist-info/METADATA,sha256=PJqbjjydIYtwXAgKpVJkZrgjT90adtCWAvQO59XBmnE,13326
158
- ormlambda-3.35.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
159
- ormlambda-3.35.2.dist-info/RECORD,,
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,,