arpakitlib 1.8.252__py3-none-any.whl → 1.8.254__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.
- arpakitlib/ar_pydantic_schema_from_sqlalchemy_model.py +10 -10
- {arpakitlib-1.8.252.dist-info → arpakitlib-1.8.254.dist-info}/METADATA +1 -1
- {arpakitlib-1.8.252.dist-info → arpakitlib-1.8.254.dist-info}/RECORD +6 -6
- {arpakitlib-1.8.252.dist-info → arpakitlib-1.8.254.dist-info}/LICENSE +0 -0
- {arpakitlib-1.8.252.dist-info → arpakitlib-1.8.254.dist-info}/WHEEL +0 -0
- {arpakitlib-1.8.252.dist-info → arpakitlib-1.8.254.dist-info}/entry_points.txt +0 -0
@@ -72,7 +72,7 @@ def pydantic_schema_from_sqlalchemy_model(
|
|
72
72
|
include_property_names: list[str] | None = None,
|
73
73
|
exclude_property_names: list[str] | None = None,
|
74
74
|
filter_property_prefixes: list[str] | None = None,
|
75
|
-
|
75
|
+
remove_property_prefixes: list[str] | None = None,
|
76
76
|
) -> type[BaseModel]:
|
77
77
|
"""
|
78
78
|
Генерирует Pydantic-модель из колонок SQLAlchemy-модели и (опционально) из @property.
|
@@ -90,11 +90,11 @@ def pydantic_schema_from_sqlalchemy_model(
|
|
90
90
|
annotations: dict[str, Any] = {}
|
91
91
|
attrs: dict[str, Any] = {}
|
92
92
|
|
93
|
-
exclude_column_names = set(
|
94
|
-
include_property_names = set(
|
95
|
-
exclude_property_names = set(
|
96
|
-
filter_property_prefixes =
|
97
|
-
|
93
|
+
exclude_column_names = set(exclude_column_names or [])
|
94
|
+
include_property_names = set(include_property_names or [])
|
95
|
+
exclude_property_names = set(exclude_property_names or [])
|
96
|
+
filter_property_prefixes = set(filter_property_prefixes or [])
|
97
|
+
remove_property_prefixes = set(remove_property_prefixes or [])
|
98
98
|
|
99
99
|
# 1) Колонки
|
100
100
|
for prop in mapper.attrs:
|
@@ -152,11 +152,11 @@ def pydantic_schema_from_sqlalchemy_model(
|
|
152
152
|
property_name_to_type.pop(property_name, None)
|
153
153
|
|
154
154
|
# удаляем префиксы
|
155
|
-
if
|
155
|
+
if remove_property_prefixes:
|
156
156
|
renamed_property_name_to_type = {}
|
157
|
-
for property_name, property_type in property_name_to_type.items():
|
157
|
+
for property_name, property_type in list(property_name_to_type.items()):
|
158
158
|
new_property_name = property_name
|
159
|
-
for prefix in
|
159
|
+
for prefix in remove_property_prefixes:
|
160
160
|
if new_property_name.startswith(prefix):
|
161
161
|
new_property_name = new_property_name[len(prefix):].strip()
|
162
162
|
break
|
@@ -177,7 +177,7 @@ def pydantic_schema_from_sqlalchemy_model(
|
|
177
177
|
property_name_to_type.update(renamed_property_name_to_type)
|
178
178
|
|
179
179
|
# добавляем (колонки в приоритете)
|
180
|
-
for property_name, property_type in property_name_to_type.items():
|
180
|
+
for property_name, property_type in list(property_name_to_type.items()):
|
181
181
|
if property_name in annotations:
|
182
182
|
continue
|
183
183
|
annotations[property_name] = property_type
|
@@ -414,7 +414,7 @@ arpakitlib/ar_need_type_util.py,sha256=XmY1kswz8j9oo5f9CxRu0_zgfvxWrXPYKOj6MM04s
|
|
414
414
|
arpakitlib/ar_openai_api_client_util.py,sha256=dWgsSPXtxNBxS5VRi_NharGQrUXF_YjIfhU3Bj5cW9M,5651
|
415
415
|
arpakitlib/ar_parse_command.py,sha256=1WTdQoWVshoDZ1jDaKeTzajfqaYHP3FNO0-REyo1aMY,3003
|
416
416
|
arpakitlib/ar_postgresql_util.py,sha256=1AuLjEaa1Lg4pzn-ukCVnDi35Eg1k91APRTqZhIJAdo,945
|
417
|
-
arpakitlib/ar_pydantic_schema_from_sqlalchemy_model.py,sha256
|
417
|
+
arpakitlib/ar_pydantic_schema_from_sqlalchemy_model.py,sha256=-uaJcr3GqledUXk_uSFKfUX00gxX6WVAQs4mfxmXTWg,7399
|
418
418
|
arpakitlib/ar_raise_own_exception_if_exception.py,sha256=A6TuNSBk1pHaQ_qxnUmE2LgsNGA1IGqX26b1_HEA4Nc,5978
|
419
419
|
arpakitlib/ar_rat_func_util.py,sha256=Ca10o3RJwyx_DJLxjTxgHDO6NU3M6CWgUR4bif67OE4,2006
|
420
420
|
arpakitlib/ar_really_validate_email.py,sha256=HBfhyiDB3INI6Iq6hR2WOMKA5wVWWRl0Qun-x__OZ9o,1201
|
@@ -430,8 +430,8 @@ arpakitlib/ar_sqlalchemy_util.py,sha256=FDva9onjtCPrYZYIHHb93NMwD1WlmaORjiWgPRJQ
|
|
430
430
|
arpakitlib/ar_str_util.py,sha256=2lGpnXDf2h1cBZpVf5i1tX_HCv5iBd6IGnrCw4QWWlY,4350
|
431
431
|
arpakitlib/ar_type_util.py,sha256=Cs_tef-Fc5xeyAF54KgISCsP11NHyzIsglm4S3Xx7iM,4049
|
432
432
|
arpakitlib/ar_yookassa_api_client_util.py,sha256=VozuZeCJjmLd1zj2BdC9WfiAQ3XYOrIMsdpNK-AUlm0,5347
|
433
|
-
arpakitlib-1.8.
|
434
|
-
arpakitlib-1.8.
|
435
|
-
arpakitlib-1.8.
|
436
|
-
arpakitlib-1.8.
|
437
|
-
arpakitlib-1.8.
|
433
|
+
arpakitlib-1.8.254.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
|
434
|
+
arpakitlib-1.8.254.dist-info/METADATA,sha256=pnFWXrz2lu5ZwiVcwwpwa3gYAUHv_AZC6RDFUm7hpiw,3919
|
435
|
+
arpakitlib-1.8.254.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
436
|
+
arpakitlib-1.8.254.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
|
437
|
+
arpakitlib-1.8.254.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|