industrial-model 0.1.7__tar.gz → 0.1.9__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 (39) hide show
  1. {industrial_model-0.1.7 → industrial_model-0.1.9}/PKG-INFO +1 -1
  2. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/cognite_adapters/query_result_mapper.py +14 -13
  3. {industrial_model-0.1.7 → industrial_model-0.1.9}/pyproject.toml +1 -1
  4. {industrial_model-0.1.7 → industrial_model-0.1.9}/uv.lock +1 -1
  5. {industrial_model-0.1.7 → industrial_model-0.1.9}/.gitignore +0 -0
  6. {industrial_model-0.1.7 → industrial_model-0.1.9}/.python-version +0 -0
  7. {industrial_model-0.1.7 → industrial_model-0.1.9}/.vscode/settings.json +0 -0
  8. {industrial_model-0.1.7 → industrial_model-0.1.9}/README.md +0 -0
  9. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/__init__.py +0 -0
  10. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/cognite_adapters/__init__.py +0 -0
  11. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/cognite_adapters/filter_mapper.py +0 -0
  12. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/cognite_adapters/optimizer.py +0 -0
  13. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/cognite_adapters/query_mapper.py +0 -0
  14. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/cognite_adapters/sort_mapper.py +0 -0
  15. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/cognite_adapters/utils.py +0 -0
  16. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/cognite_adapters/view_mapper.py +0 -0
  17. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/config.py +0 -0
  18. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/constants.py +0 -0
  19. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/engines/__init__.py +0 -0
  20. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/engines/async_engine.py +0 -0
  21. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/engines/engine.py +0 -0
  22. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/models/__init__.py +0 -0
  23. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/models/base.py +0 -0
  24. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/models/entities.py +0 -0
  25. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/models/schemas.py +0 -0
  26. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/py.typed +0 -0
  27. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/queries/__init__.py +0 -0
  28. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/queries/models.py +0 -0
  29. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/queries/params.py +0 -0
  30. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/statements/__init__.py +0 -0
  31. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/statements/expressions.py +0 -0
  32. {industrial_model-0.1.7 → industrial_model-0.1.9}/industrial_model/utils.py +0 -0
  33. {industrial_model-0.1.7 → industrial_model-0.1.9}/scripts/build.sh +0 -0
  34. {industrial_model-0.1.7 → industrial_model-0.1.9}/scripts/format.sh +0 -0
  35. {industrial_model-0.1.7 → industrial_model-0.1.9}/scripts/lint.sh +0 -0
  36. {industrial_model-0.1.7 → industrial_model-0.1.9}/tests/__init__.py +0 -0
  37. {industrial_model-0.1.7 → industrial_model-0.1.9}/tests/cognite-sdk-config.yaml +0 -0
  38. {industrial_model-0.1.7 → industrial_model-0.1.9}/tests/hubs.py +0 -0
  39. {industrial_model-0.1.7 → industrial_model-0.1.9}/tests/tests_adapter.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: industrial-model
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: Industrial Model ORM
5
5
  Author-email: Lucas Alves <lucasrosaalves@gmail.com>
6
6
  Classifier: Programming Language :: Python
@@ -70,13 +70,14 @@ class QueryResultMapper:
70
70
 
71
71
  return entry.get("space", ""), entry.get("externalId", "")
72
72
 
73
- nodes = {
74
- (node.space, node.external_id): node
75
- for node in query_result[key]
76
- if isinstance(node, Node)
77
- }
73
+ visited: set[tuple[str, str]] = set()
78
74
  result: defaultdict[tuple[str, str], list[Node]] = defaultdict(list)
79
- for node in nodes.values():
75
+ for node in query_result[key]:
76
+ identify = (node.space, node.external_id)
77
+ if not isinstance(node, Node) or identify in visited:
78
+ continue
79
+
80
+ visited.add(identify)
80
81
  properties = node.properties.get(view_id, {})
81
82
  node_id = get_node_id(node)
82
83
  for mapping_key, (values, is_list) in mappings.items():
@@ -85,7 +86,7 @@ class QueryResultMapper:
85
86
  element_key: tuple[str, str] = (
86
87
  (element.get("space", ""), element.get("externalId", ""))
87
88
  if isinstance(element, dict)
88
- else node_id
89
+ else (node.space, node.external_id)
89
90
  )
90
91
 
91
92
  entries = values.get(element_key)
@@ -178,14 +179,14 @@ class QueryResultMapper:
178
179
  if not nodes:
179
180
  return None
180
181
 
182
+ visited: set[tuple[str, str]] = set()
181
183
  result: defaultdict[tuple[str, str], list[Node]] = defaultdict(list)
184
+ for edge in query_result[edge_key]:
185
+ identify = (edge.space, edge.external_id)
186
+ if not isinstance(edge, Edge) or identify in visited:
187
+ continue
182
188
 
183
- edges = {
184
- (edge.space, edge.external_id): edge
185
- for edge in query_result[edge_key]
186
- if isinstance(edge, Edge)
187
- }
188
- for edge in edges.values():
189
+ visited.add(identify)
189
190
  entry_key, node_key = (
190
191
  (
191
192
  edge.end_node.as_tuple(),
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "industrial-model"
3
- version = "0.1.7"
3
+ version = "0.1.9"
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.7"
218
+ version = "0.1.9"
219
219
  source = { editable = "." }
220
220
  dependencies = [
221
221
  { name = "anyio" },