arpakitlib 1.8.276__py3-none-any.whl → 1.8.278__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/_arpakit_project_template_v_5/project/sandbox/sandbox_4.py +8 -1
- arpakitlib/ar_pydantic_schema_from_sqlalchemy_model.py +20 -10
- {arpakitlib-1.8.276.dist-info → arpakitlib-1.8.278.dist-info}/METADATA +2 -1
- {arpakitlib-1.8.276.dist-info → arpakitlib-1.8.278.dist-info}/RECORD +7 -7
- {arpakitlib-1.8.276.dist-info → arpakitlib-1.8.278.dist-info}/WHEEL +0 -0
- {arpakitlib-1.8.276.dist-info → arpakitlib-1.8.278.dist-info}/entry_points.txt +0 -0
- {arpakitlib-1.8.276.dist-info → arpakitlib-1.8.278.dist-info}/licenses/LICENSE +0 -0
@@ -1,8 +1,15 @@
|
|
1
1
|
import asyncio
|
2
2
|
|
3
|
+
from arpakitlib.ar_pydantic_schema_from_sqlalchemy_model import _get_property_name_to_type_from_model_class
|
4
|
+
from project.sqlalchemy_db_.sqlalchemy_model import UserDBM
|
5
|
+
|
3
6
|
|
4
7
|
def __sandbox():
|
5
|
-
|
8
|
+
res = _get_property_name_to_type_from_model_class(
|
9
|
+
model_class=UserDBM
|
10
|
+
)
|
11
|
+
for a,b in res.items():
|
12
|
+
print(a, b)
|
6
13
|
|
7
14
|
|
8
15
|
async def __async_sandbox():
|
@@ -33,13 +33,24 @@ def _get_property_name_to_type_from_model_class(
|
|
33
33
|
exclude_property_types: list[type] | None = None,
|
34
34
|
) -> dict[str, Any]:
|
35
35
|
"""
|
36
|
-
Находит все @property в классе и вытаскивает их возвращаемый тип.
|
37
|
-
Если тип не удаётся получить — подставляем Any.
|
36
|
+
Находит все @property в классе и его родителях, и вытаскивает их возвращаемый тип.
|
37
|
+
Если тип не удаётся получить — подставляем Any (в зависимости от skip_property_if_cannot_define_type).
|
38
38
|
"""
|
39
39
|
exclude_property_names = set(exclude_property_names or [])
|
40
40
|
props: dict[str, Any] = {}
|
41
|
-
|
42
|
-
|
41
|
+
|
42
|
+
for cls in reversed(model_class.__mro__):
|
43
|
+
|
44
|
+
if cls is object:
|
45
|
+
continue
|
46
|
+
|
47
|
+
for property_name, attr in cls.__dict__.items():
|
48
|
+
if not isinstance(attr, property):
|
49
|
+
continue
|
50
|
+
|
51
|
+
if property_name in exclude_property_names:
|
52
|
+
continue
|
53
|
+
|
43
54
|
try:
|
44
55
|
hints = get_type_hints(attr.fget) if attr.fget else {}
|
45
56
|
ret_type = hints.get("return", Any)
|
@@ -48,13 +59,12 @@ def _get_property_name_to_type_from_model_class(
|
|
48
59
|
ret_type = Any
|
49
60
|
else:
|
50
61
|
raise
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
if _type_matches(type_=ret_type, allowed_types=exclude_property_types):
|
56
|
-
continue
|
62
|
+
|
63
|
+
if exclude_property_types and _type_matches(type_=ret_type, allowed_types=exclude_property_types):
|
64
|
+
continue
|
65
|
+
|
57
66
|
props[property_name] = ret_type
|
67
|
+
|
58
68
|
return props
|
59
69
|
|
60
70
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: arpakitlib
|
3
|
-
Version: 1.8.
|
3
|
+
Version: 1.8.278
|
4
4
|
Summary: arpakitlib
|
5
5
|
License: Apache-2.0
|
6
6
|
License-File: LICENSE
|
@@ -50,6 +50,7 @@ Requires-Dist: pydantic-settings (>=2.7.1,<3.0.0)
|
|
50
50
|
Requires-Dist: pyjwt (>=2.10.1,<3.0.0)
|
51
51
|
Requires-Dist: pymongo (>=4.10.1,<5.0.0)
|
52
52
|
Requires-Dist: pytelegrambotapi (>=4.27.0,<5.0.0)
|
53
|
+
Requires-Dist: pytest (>=8.4.2,<9.0.0)
|
53
54
|
Requires-Dist: pytz (>=2024.2,<2025.0)
|
54
55
|
Requires-Dist: pyzabbix (>=1.3.1,<2.0.0)
|
55
56
|
Requires-Dist: qrcode (>=8.2,<9.0)
|
@@ -238,7 +238,7 @@ arpakitlib/_arpakit_project_template_v_5/project/sandbox/__init__.py,sha256=47DE
|
|
238
238
|
arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_1.py,sha256=xKSp7tIBu3Ffp_kgJkwVtdam3BcoFZ44JPVHoRRaP0E,163
|
239
239
|
arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_2.py,sha256=xKSp7tIBu3Ffp_kgJkwVtdam3BcoFZ44JPVHoRRaP0E,163
|
240
240
|
arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_3.py,sha256=CIv4vQfBLhlIh92fiLhmyTXSZXjDovxTFZtUBDnWyFY,427
|
241
|
-
arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_4.py,sha256=
|
241
|
+
arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_4.py,sha256=Oalf7__usi-AkxjoeKQgrbdvaK7Mevh6i92u0Upoq50,460
|
242
242
|
arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_5.py,sha256=xKSp7tIBu3Ffp_kgJkwVtdam3BcoFZ44JPVHoRRaP0E,163
|
243
243
|
arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_6.py,sha256=xKSp7tIBu3Ffp_kgJkwVtdam3BcoFZ44JPVHoRRaP0E,163
|
244
244
|
arpakitlib/_arpakit_project_template_v_5/project/sandbox/sandbox_7.py,sha256=xKSp7tIBu3Ffp_kgJkwVtdam3BcoFZ44JPVHoRRaP0E,163
|
@@ -415,7 +415,7 @@ arpakitlib/ar_need_type_util.py,sha256=XmY1kswz8j9oo5f9CxRu0_zgfvxWrXPYKOj6MM04s
|
|
415
415
|
arpakitlib/ar_openai_api_client_util.py,sha256=dWgsSPXtxNBxS5VRi_NharGQrUXF_YjIfhU3Bj5cW9M,5651
|
416
416
|
arpakitlib/ar_parse_command.py,sha256=1WTdQoWVshoDZ1jDaKeTzajfqaYHP3FNO0-REyo1aMY,3003
|
417
417
|
arpakitlib/ar_postgresql_util.py,sha256=1AuLjEaa1Lg4pzn-ukCVnDi35Eg1k91APRTqZhIJAdo,945
|
418
|
-
arpakitlib/ar_pydantic_schema_from_sqlalchemy_model.py,sha256=
|
418
|
+
arpakitlib/ar_pydantic_schema_from_sqlalchemy_model.py,sha256=SddmsEdRdVbmdZ5aSuwy6DfGYmYx_JO6lKzuEJeBAV8,10553
|
419
419
|
arpakitlib/ar_raise_own_exception_if_exception.py,sha256=A6TuNSBk1pHaQ_qxnUmE2LgsNGA1IGqX26b1_HEA4Nc,5978
|
420
420
|
arpakitlib/ar_rat_func_util.py,sha256=Ca10o3RJwyx_DJLxjTxgHDO6NU3M6CWgUR4bif67OE4,2006
|
421
421
|
arpakitlib/ar_really_validate_email.py,sha256=HBfhyiDB3INI6Iq6hR2WOMKA5wVWWRl0Qun-x__OZ9o,1201
|
@@ -431,8 +431,8 @@ arpakitlib/ar_sqlalchemy_drop_check_constraints.py,sha256=XEqnMrIwSYasW_UOJ8xU-J
|
|
431
431
|
arpakitlib/ar_sqlalchemy_util.py,sha256=nUDCxhu0l8P0eBCdLyXej3_yLvBlB3LrGhMWzAekm5E,16532
|
432
432
|
arpakitlib/ar_str_util.py,sha256=2lGpnXDf2h1cBZpVf5i1tX_HCv5iBd6IGnrCw4QWWlY,4350
|
433
433
|
arpakitlib/ar_type_util.py,sha256=Cs_tef-Fc5xeyAF54KgISCsP11NHyzIsglm4S3Xx7iM,4049
|
434
|
-
arpakitlib-1.8.
|
435
|
-
arpakitlib-1.8.
|
436
|
-
arpakitlib-1.8.
|
437
|
-
arpakitlib-1.8.
|
438
|
-
arpakitlib-1.8.
|
434
|
+
arpakitlib-1.8.278.dist-info/METADATA,sha256=JIGTnl0xkixaDHFeMBYeirksr7HESqO9xDP-ztWSo-s,4060
|
435
|
+
arpakitlib-1.8.278.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
436
|
+
arpakitlib-1.8.278.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
|
437
|
+
arpakitlib-1.8.278.dist-info/licenses/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
|
438
|
+
arpakitlib-1.8.278.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|