cognite-neat 0.90.2__py3-none-any.whl → 0.92.0__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.
Potentially problematic release.
This version of cognite-neat might be problematic. Click here for more details.
- cognite/neat/_version.py +1 -1
- cognite/neat/graph/extractors/__init__.py +5 -0
- cognite/neat/graph/extractors/_classic_cdf/_assets.py +8 -8
- cognite/neat/graph/extractors/_classic_cdf/_base.py +26 -1
- cognite/neat/graph/extractors/_classic_cdf/_classic.py +208 -0
- cognite/neat/graph/extractors/_classic_cdf/_data_sets.py +110 -0
- cognite/neat/graph/extractors/_classic_cdf/_events.py +30 -5
- cognite/neat/graph/extractors/_classic_cdf/_files.py +33 -8
- cognite/neat/graph/extractors/_classic_cdf/_labels.py +14 -6
- cognite/neat/graph/extractors/_classic_cdf/_relationships.py +38 -7
- cognite/neat/graph/extractors/_classic_cdf/_sequences.py +30 -5
- cognite/neat/graph/extractors/_classic_cdf/_timeseries.py +30 -5
- cognite/neat/graph/extractors/_dexpi.py +4 -4
- cognite/neat/graph/extractors/_iodd.py +160 -0
- cognite/neat/issues/_base.py +6 -2
- cognite/neat/rules/exporters/_rules2excel.py +3 -3
- cognite/neat/rules/exporters/_rules2yaml.py +5 -1
- cognite/neat/rules/models/__init__.py +2 -2
- cognite/neat/rules/models/_base_input.py +2 -2
- cognite/neat/rules/models/_base_rules.py +142 -142
- cognite/neat/rules/models/asset/_rules.py +1 -34
- cognite/neat/rules/models/dms/_rules.py +127 -46
- cognite/neat/rules/models/dms/_validation.py +2 -2
- cognite/neat/rules/models/domain.py +16 -19
- cognite/neat/rules/models/entities/_single_value.py +25 -11
- cognite/neat/rules/models/entities/_types.py +0 -10
- cognite/neat/rules/models/information/_rules.py +68 -43
- cognite/neat/rules/models/information/_validation.py +5 -5
- cognite/neat/rules/transformers/_converters.py +6 -8
- cognite/neat/rules/transformers/_pipelines.py +8 -4
- cognite/neat/store/_base.py +1 -1
- cognite/neat/utils/collection_.py +4 -3
- cognite/neat/utils/xml_.py +27 -12
- {cognite_neat-0.90.2.dist-info → cognite_neat-0.92.0.dist-info}/METADATA +1 -1
- {cognite_neat-0.90.2.dist-info → cognite_neat-0.92.0.dist-info}/RECORD +38 -38
- cognite/neat/rules/models/asset/_serializer.py +0 -73
- cognite/neat/rules/models/dms/_serializer.py +0 -157
- cognite/neat/rules/models/information/_serializer.py +0 -73
- {cognite_neat-0.90.2.dist-info → cognite_neat-0.92.0.dist-info}/LICENSE +0 -0
- {cognite_neat-0.90.2.dist-info → cognite_neat-0.92.0.dist-info}/WHEEL +0 -0
- {cognite_neat-0.90.2.dist-info → cognite_neat-0.92.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
from typing import Any, ClassVar
|
|
2
|
-
|
|
3
|
-
from cognite.neat.rules.models import InformationRules
|
|
4
|
-
from cognite.neat.rules.models.entities import ClassEntity, ReferenceEntity
|
|
5
|
-
from cognite.neat.rules.models.information import InformationClass, InformationProperty
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class _InformationRulesSerializer:
|
|
9
|
-
# These are the fields that need to be cleaned from the default space and version
|
|
10
|
-
PROPERTIES_FIELDS: ClassVar[list[str]] = ["class_", "value_type"]
|
|
11
|
-
CLASSES_FIELDS: ClassVar[list[str]] = ["class_"]
|
|
12
|
-
|
|
13
|
-
def __init__(self, by_alias: bool, default_prefix: str) -> None:
|
|
14
|
-
self.default_prefix = f"{default_prefix}:"
|
|
15
|
-
|
|
16
|
-
self.properties_fields = self.PROPERTIES_FIELDS
|
|
17
|
-
self.classes_fields = self.CLASSES_FIELDS
|
|
18
|
-
|
|
19
|
-
self.prop_name = "properties"
|
|
20
|
-
self.class_name = "classes"
|
|
21
|
-
self.metadata_name = "metadata"
|
|
22
|
-
self.class_parent = "parent"
|
|
23
|
-
|
|
24
|
-
self.prop_property = "property_"
|
|
25
|
-
self.prop_class = "class_"
|
|
26
|
-
|
|
27
|
-
self.reference = "Reference" if by_alias else "reference"
|
|
28
|
-
if by_alias:
|
|
29
|
-
self.properties_fields = [
|
|
30
|
-
InformationProperty.model_fields[field].alias or field for field in self.properties_fields
|
|
31
|
-
]
|
|
32
|
-
self.classes_fields = [InformationClass.model_fields[field].alias or field for field in self.classes_fields]
|
|
33
|
-
self.prop_name = InformationRules.model_fields[self.prop_name].alias or self.prop_name
|
|
34
|
-
self.class_name = InformationRules.model_fields[self.class_name].alias or self.class_name
|
|
35
|
-
self.class_parent = InformationClass.model_fields[self.class_parent].alias or self.class_parent
|
|
36
|
-
self.metadata_name = InformationRules.model_fields[self.metadata_name].alias or self.metadata_name
|
|
37
|
-
|
|
38
|
-
self.prop_property = InformationProperty.model_fields[self.prop_property].alias or self.prop_property
|
|
39
|
-
self.prop_class = InformationProperty.model_fields[self.prop_class].alias or self.prop_class
|
|
40
|
-
|
|
41
|
-
def clean(self, dumped: dict[str, Any], as_reference: bool) -> dict[str, Any]:
|
|
42
|
-
# Sorting to get a deterministic order
|
|
43
|
-
dumped[self.prop_name] = sorted(
|
|
44
|
-
dumped[self.prop_name]["data"], key=lambda p: (p[self.prop_class], p[self.prop_property])
|
|
45
|
-
)
|
|
46
|
-
dumped[self.class_name] = sorted(dumped[self.class_name]["data"], key=lambda v: v[self.prop_class])
|
|
47
|
-
|
|
48
|
-
for prop in dumped[self.prop_name]:
|
|
49
|
-
if as_reference:
|
|
50
|
-
class_entity = ClassEntity.load(prop[self.prop_class])
|
|
51
|
-
prop[self.reference] = str(
|
|
52
|
-
ReferenceEntity(
|
|
53
|
-
prefix=str(class_entity.prefix), suffix=class_entity.suffix, property=prop[self.prop_property]
|
|
54
|
-
)
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
for field_name in self.properties_fields:
|
|
58
|
-
if value := prop.get(field_name):
|
|
59
|
-
prop[field_name] = value.removeprefix(self.default_prefix)
|
|
60
|
-
|
|
61
|
-
for class_ in dumped[self.class_name]:
|
|
62
|
-
if as_reference:
|
|
63
|
-
class_[self.reference] = class_[self.prop_class]
|
|
64
|
-
for field_name in self.classes_fields:
|
|
65
|
-
if value := class_.get(field_name):
|
|
66
|
-
class_[field_name] = value.removeprefix(self.default_prefix)
|
|
67
|
-
|
|
68
|
-
if value := class_.get(self.class_parent):
|
|
69
|
-
class_[self.class_parent] = ",".join(
|
|
70
|
-
parent.strip().removeprefix(self.default_prefix) for parent in value.split(",")
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
return dumped
|
|
File without changes
|
|
File without changes
|
|
File without changes
|