industrial-model 0.1.14__tar.gz → 0.1.16__tar.gz

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.
Files changed (44) hide show
  1. {industrial_model-0.1.14 → industrial_model-0.1.16}/PKG-INFO +1 -1
  2. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/__init__.py +2 -0
  3. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/models/schemas.py +14 -7
  4. {industrial_model-0.1.14 → industrial_model-0.1.16}/pyproject.toml +1 -1
  5. {industrial_model-0.1.14 → industrial_model-0.1.16}/uv.lock +1 -1
  6. {industrial_model-0.1.14 → industrial_model-0.1.16}/.gitignore +0 -0
  7. {industrial_model-0.1.14 → industrial_model-0.1.16}/.python-version +0 -0
  8. {industrial_model-0.1.14 → industrial_model-0.1.16}/README.md +0 -0
  9. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/cognite_adapters/__init__.py +0 -0
  10. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/cognite_adapters/aggregation_mapper.py +0 -0
  11. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/cognite_adapters/filter_mapper.py +0 -0
  12. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/cognite_adapters/models.py +0 -0
  13. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/cognite_adapters/optimizer.py +0 -0
  14. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/cognite_adapters/query_mapper.py +0 -0
  15. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/cognite_adapters/query_result_mapper.py +0 -0
  16. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/cognite_adapters/sort_mapper.py +0 -0
  17. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/cognite_adapters/upsert_mapper.py +0 -0
  18. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/cognite_adapters/utils.py +0 -0
  19. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/cognite_adapters/view_mapper.py +0 -0
  20. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/config.py +0 -0
  21. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/constants.py +0 -0
  22. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/engines/__init__.py +0 -0
  23. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/engines/async_engine.py +0 -0
  24. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/engines/engine.py +0 -0
  25. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/models/__init__.py +0 -0
  26. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/models/base.py +0 -0
  27. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/models/entities.py +0 -0
  28. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/py.typed +0 -0
  29. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/queries/__init__.py +0 -0
  30. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/queries/models.py +0 -0
  31. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/queries/params.py +0 -0
  32. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/statements/__init__.py +0 -0
  33. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/statements/expressions.py +0 -0
  34. {industrial_model-0.1.14 → industrial_model-0.1.16}/industrial_model/utils.py +0 -0
  35. {industrial_model-0.1.14 → industrial_model-0.1.16}/scripts/build.sh +0 -0
  36. {industrial_model-0.1.14 → industrial_model-0.1.16}/scripts/format.sh +0 -0
  37. {industrial_model-0.1.14 → industrial_model-0.1.16}/scripts/lint.sh +0 -0
  38. {industrial_model-0.1.14 → industrial_model-0.1.16}/tests/__init__.py +0 -0
  39. {industrial_model-0.1.14 → industrial_model-0.1.16}/tests/cognite-sdk-config.yaml +0 -0
  40. {industrial_model-0.1.14 → industrial_model-0.1.16}/tests/hubs.py +0 -0
  41. {industrial_model-0.1.14 → industrial_model-0.1.16}/tests/models.py +0 -0
  42. {industrial_model-0.1.14 → industrial_model-0.1.16}/tests/test_upsert_mapper.py +0 -0
  43. {industrial_model-0.1.14 → industrial_model-0.1.16}/tests/tests_adapter.py +0 -0
  44. {industrial_model-0.1.14 → industrial_model-0.1.16}/tests/tests_aggregate.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: industrial-model
3
- Version: 0.1.14
3
+ Version: 0.1.16
4
4
  Summary: Industrial Model ORM
5
5
  Author-email: Lucas Alves <lucasrosaalves@gmail.com>
6
6
  Classifier: Programming Language :: Python
@@ -4,6 +4,7 @@ from .models import (
4
4
  AggregatedViewInstance,
5
5
  InstanceId,
6
6
  PaginatedResult,
7
+ RootModel,
7
8
  TAggregatedViewInstance,
8
9
  TViewInstance,
9
10
  TWritableViewInstance,
@@ -32,6 +33,7 @@ __all__ = [
32
33
  "Engine",
33
34
  "AsyncEngine",
34
35
  "PaginatedResult",
36
+ "RootModel",
35
37
  "ViewInstanceConfig",
36
38
  "WritableViewInstance",
37
39
  ]
@@ -57,17 +57,21 @@ def get_parent_and_children_nodes(
57
57
 
58
58
 
59
59
  def _get_type_properties(
60
- cls: type[BaseModel], visited_count: defaultdict[type, int] | None = None
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] > 2:
65
+ if visited_count[cls] > 1:
64
66
  return None
65
- visited_count[cls] += 1
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, visited_count: defaultdict[type, int]
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
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "industrial-model"
3
- version = "0.1.14"
3
+ version = "0.1.16"
4
4
  description = "Industrial Model ORM"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -215,7 +215,7 @@ wheels = [
215
215
 
216
216
  [[package]]
217
217
  name = "industrial-model"
218
- version = "0.1.14"
218
+ version = "0.1.16"
219
219
  source = { editable = "." }
220
220
  dependencies = [
221
221
  { name = "anyio" },