industrial-model 0.1.15__py3-none-any.whl → 0.1.16__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.
|
@@ -57,17 +57,21 @@ def get_parent_and_children_nodes(
|
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
def _get_type_properties(
|
|
60
|
-
cls: type[BaseModel],
|
|
60
|
+
cls: type[BaseModel],
|
|
61
|
+
parent_type: type[BaseModel] | None = None,
|
|
62
|
+
visited_count: defaultdict[type, int] | None = None,
|
|
61
63
|
) -> dict[str, Any] | None:
|
|
62
64
|
if visited_count is not None:
|
|
63
|
-
if visited_count[cls] >
|
|
65
|
+
if visited_count[cls] > 1:
|
|
64
66
|
return None
|
|
65
|
-
|
|
67
|
+
elif parent_type == cls:
|
|
68
|
+
visited_count[cls] += 1
|
|
66
69
|
|
|
67
70
|
hints = get_type_hints(cls)
|
|
68
71
|
origins = {
|
|
69
72
|
key: _get_field_type(
|
|
70
73
|
type_hint,
|
|
74
|
+
cls,
|
|
71
75
|
visited_count or defaultdict(lambda: 0),
|
|
72
76
|
)
|
|
73
77
|
for key, type_hint in hints.items()
|
|
@@ -81,13 +85,15 @@ def _get_type_properties(
|
|
|
81
85
|
|
|
82
86
|
|
|
83
87
|
def _get_field_type(
|
|
84
|
-
type_hint: type,
|
|
88
|
+
type_hint: type,
|
|
89
|
+
parent_type: type[BaseModel],
|
|
90
|
+
visited_count: defaultdict[type, int],
|
|
85
91
|
) -> tuple[bool, dict[str, Any] | None]:
|
|
86
92
|
should_iter = _type_is_list_or_union(type_hint)
|
|
87
93
|
|
|
88
94
|
if not should_iter:
|
|
89
95
|
return _get_field_relations(
|
|
90
|
-
[_cast_base_model(type_hint)], visited_count
|
|
96
|
+
[_cast_base_model(type_hint)], parent_type, visited_count
|
|
91
97
|
)
|
|
92
98
|
|
|
93
99
|
entries: list[type[BaseModel] | None] = []
|
|
@@ -96,11 +102,12 @@ def _get_field_type(
|
|
|
96
102
|
return _get_field_type(arg, visited_count)
|
|
97
103
|
entries.append(_cast_base_model(arg))
|
|
98
104
|
|
|
99
|
-
return _get_field_relations(entries, visited_count)
|
|
105
|
+
return _get_field_relations(entries, parent_type, visited_count)
|
|
100
106
|
|
|
101
107
|
|
|
102
108
|
def _get_field_relations(
|
|
103
109
|
entries: list[type[TBaseModel] | None],
|
|
110
|
+
parent_type: type[BaseModel],
|
|
104
111
|
visited_count: defaultdict[type, int],
|
|
105
112
|
) -> tuple[bool, dict[str, Any] | None]:
|
|
106
113
|
entry_type = next((type_ for type_ in entries if type_ is not None), None)
|
|
@@ -108,7 +115,7 @@ def _get_field_relations(
|
|
|
108
115
|
if not entry_type:
|
|
109
116
|
return False, None
|
|
110
117
|
|
|
111
|
-
properties = _get_type_properties(entry_type, visited_count)
|
|
118
|
+
properties = _get_type_properties(entry_type, parent_type, visited_count)
|
|
112
119
|
|
|
113
120
|
return True, properties
|
|
114
121
|
|
|
@@ -20,12 +20,12 @@ industrial_model/engines/engine.py,sha256=DaA34P1aL_qvL691OG_-g_yCC-U2ZJr9tF32Pl
|
|
|
20
20
|
industrial_model/models/__init__.py,sha256=AzJ0CyPK5PvUCX45FFtybl13tkukUvk2UAF_90s_LQ8,742
|
|
21
21
|
industrial_model/models/base.py,sha256=iGhDjXqA5ULEQIFHtkMi7WYJl0nQq1wi8_zqOr-Ep78,1649
|
|
22
22
|
industrial_model/models/entities.py,sha256=GZu-Y5ZalhXM8EHTzBe4hCKA2Dryk8J99p_FTVNX2jc,2709
|
|
23
|
-
industrial_model/models/schemas.py,sha256
|
|
23
|
+
industrial_model/models/schemas.py,sha256=-ZnDO-yJL2PR4QmsduzDsC-rjS7CZnqPS-wYAo65Mbo,4612
|
|
24
24
|
industrial_model/queries/__init__.py,sha256=7aheTE5qs03rxWm9fmGWptbz_p9OIXXYD8if56cqs18,227
|
|
25
25
|
industrial_model/queries/models.py,sha256=iiHQ7-cfg0nukEv5PoCx9QPF-w1gVSnoNbXBOK9Mzeo,1185
|
|
26
26
|
industrial_model/queries/params.py,sha256=ehgCoR5n6E-tkEuoymZ2lkLcSzMaBAx_HnyJ7sWpqz0,964
|
|
27
27
|
industrial_model/statements/__init__.py,sha256=15LI9POLUdh6i3Zw0Aek0fVFfcTj8P8ZEa1Cli3pgXQ,3095
|
|
28
28
|
industrial_model/statements/expressions.py,sha256=Sar1cIvy3sYi7tkWJN3ylHlZ252oN2mZJpZ1TX9jN3s,4940
|
|
29
|
-
industrial_model-0.1.
|
|
30
|
-
industrial_model-0.1.
|
|
31
|
-
industrial_model-0.1.
|
|
29
|
+
industrial_model-0.1.16.dist-info/METADATA,sha256=5Bq6L2p-45gPQWKPZPPl1yFQ3JAqT8w9-IonyNnT844,6144
|
|
30
|
+
industrial_model-0.1.16.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
31
|
+
industrial_model-0.1.16.dist-info/RECORD,,
|
|
File without changes
|