arpakitlib 1.8.263__py3-none-any.whl → 1.8.265__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_clone_pydantic_model_fields.py +10 -2
- {arpakitlib-1.8.263.dist-info → arpakitlib-1.8.265.dist-info}/METADATA +1 -1
- {arpakitlib-1.8.263.dist-info → arpakitlib-1.8.265.dist-info}/RECORD +6 -6
- {arpakitlib-1.8.263.dist-info → arpakitlib-1.8.265.dist-info}/LICENSE +0 -0
- {arpakitlib-1.8.263.dist-info → arpakitlib-1.8.265.dist-info}/WHEEL +0 -0
- {arpakitlib-1.8.263.dist-info → arpakitlib-1.8.265.dist-info}/entry_points.txt +0 -0
@@ -12,11 +12,14 @@ def clone_pydantic_model_fields(
|
|
12
12
|
model_cls: Type[BaseModel],
|
13
13
|
fields_to_remove: Iterable[str] | None = None,
|
14
14
|
new_class_name: str | None = None,
|
15
|
+
class_name_prefix: str | None = "Cloned"
|
15
16
|
) -> Type[BaseModel]:
|
16
17
|
if fields_to_remove is None:
|
17
18
|
fields_to_remove = set()
|
19
|
+
if class_name_prefix is None:
|
20
|
+
class_name_prefix = "Cloned"
|
18
21
|
if new_class_name is None:
|
19
|
-
new_class_name = f"{model_cls.__name__}
|
22
|
+
new_class_name = f"{model_cls.__name__}{class_name_prefix}"
|
20
23
|
|
21
24
|
field_defs: dict[str, tuple[type[Any], Any]] = {}
|
22
25
|
|
@@ -33,12 +36,17 @@ def clone_pydantic_model_fields(
|
|
33
36
|
|
34
37
|
field_defs[field_name] = ((field_.annotation or Any), default)
|
35
38
|
|
36
|
-
|
39
|
+
res = create_model(
|
37
40
|
new_class_name,
|
38
41
|
__base__=BaseModel,
|
42
|
+
__module__=model_cls.__module__,
|
39
43
|
**field_defs,
|
40
44
|
)
|
41
45
|
|
46
|
+
res.model_config = dict(getattr(model_cls, "model_config", {}))
|
47
|
+
|
48
|
+
return res
|
49
|
+
|
42
50
|
|
43
51
|
def __example():
|
44
52
|
pass
|
@@ -388,7 +388,7 @@ arpakitlib/ar_base_worker_util.py,sha256=e-Vj9w1D-59KN3Zz7TQlOB2lW4fZphJlsPpFkmX
|
|
388
388
|
arpakitlib/ar_blank_util.py,sha256=qFUdY8usL_pRYamz8Rw1fW3fzNIgrLmpdYP8q-_PQvw,2281
|
389
389
|
arpakitlib/ar_cache_file_util.py,sha256=Fo2pH-Zqm966KWFBHG_pbiySGZvhIFCYqy7k1weRfJ0,3476
|
390
390
|
arpakitlib/ar_class_util.py,sha256=i76pQW_7k_S2m_DlQh6xNjtggv9Col3WSx9W_bwk98E,722
|
391
|
-
arpakitlib/ar_clone_pydantic_model_fields.py,sha256=
|
391
|
+
arpakitlib/ar_clone_pydantic_model_fields.py,sha256=v3JzYQytfcvl5XufEAFt9Z2-XKgf8aemtelsmR_qkzg,1472
|
392
392
|
arpakitlib/ar_datetime_util.py,sha256=Xe1NiT9oPQzNSG7RVRkhukhbg4i-hhS5ImmV7sPUc8o,971
|
393
393
|
arpakitlib/ar_dict_util.py,sha256=oet-9AJEjQZfG_EI82BuYW0jdW2NQxKjPXol_nfTXjw,447
|
394
394
|
arpakitlib/ar_dream_ai_api_client_util.py,sha256=Z1oii_XSsgunYx17SdcHl54S4KPQti7-MJs0xXZ8vL0,2830
|
@@ -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.265.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
|
434
|
+
arpakitlib-1.8.265.dist-info/METADATA,sha256=GV6MRZOk4J20fMBgWJo3GSFz_BG8x5rNp9-QrH0UBC0,3919
|
435
|
+
arpakitlib-1.8.265.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
436
|
+
arpakitlib-1.8.265.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
|
437
|
+
arpakitlib-1.8.265.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|