cognite-neat 0.119.1__py3-none-any.whl → 0.119.2__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.

@@ -1,6 +1,7 @@
1
1
  from dataclasses import dataclass
2
2
  from pathlib import Path
3
3
 
4
+ from cognite.client import data_modeling as dm
4
5
  from yaml import YAMLError
5
6
 
6
7
  from cognite.neat._issues import NeatError
@@ -84,6 +85,7 @@ class CDFMissingClientError(NeatError, RuntimeError):
84
85
 
85
86
  @dataclass(unsafe_hash=True)
86
87
  class CDFMissingResourcesError(NeatError, RuntimeError):
87
- """Following CDF resources are missing: {resources}"""
88
+ """Following containers {containers} and views {views} are missing in the CDF project."""
88
89
 
89
- resources: str
90
+ containers: tuple[dm.ContainerId, ...]
91
+ views: tuple[dm.ViewId, ...]
@@ -8,6 +8,7 @@ from cognite.neat._issues.errors import (
8
8
  FileMissingRequiredFieldError,
9
9
  FileNotAFileError,
10
10
  FileNotFoundNeatError,
11
+ FileReadError,
11
12
  FileTypeUnexpectedError,
12
13
  )
13
14
  from cognite.neat._issues.warnings import NeatValueWarning
@@ -55,7 +56,12 @@ class YAMLImporter(BaseImporter[T_InputRules]):
55
56
  return cls({}, [FileNotAFileError(filepath)])
56
57
  elif filepath.suffix not in [".yaml", ".yml"]:
57
58
  return cls({}, [FileTypeUnexpectedError(filepath, frozenset([".yaml", ".yml"]))])
58
- return cls(yaml.safe_load(filepath.read_text()), filepaths=[filepath], source_name=source_name)
59
+ try:
60
+ data = yaml.safe_load(filepath.read_text())
61
+ except yaml.YAMLError as exc:
62
+ return cls({}, [FileReadError(filepath, f"Invalid YAML: {exc!s}")])
63
+
64
+ return cls(data, filepaths=[filepath], source_name=source_name)
59
65
 
60
66
  def to_rules(self) -> ReadRules[T_InputRules]:
61
67
  if self._read_issues.has_errors or not self.raw_data:
@@ -127,7 +127,7 @@ class DMSValidation:
127
127
  }
128
128
 
129
129
  if missing_views or missing_containers:
130
- raise CDFMissingResourcesError(resources=f"{missing_views.union(missing_containers)}")
130
+ raise CDFMissingResourcesError(containers=tuple(missing_containers), views=tuple(missing_views))
131
131
 
132
132
  # Setup data structures for validation
133
133
  dms_schema = self._rules.as_schema()
cognite/neat/_version.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "0.119.1"
1
+ __version__ = "0.119.2"
2
2
  __engine__ = "^2.0.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: cognite-neat
3
- Version: 0.119.1
3
+ Version: 0.119.2
4
4
  Summary: Knowledge graph transformation
5
5
  License: Apache-2.0
6
6
  Author: Nikola Vasiljevic
@@ -60,7 +60,7 @@ cognite/neat/_issues/_base.py,sha256=UDcx0s9_PqLD4z1NnOxI4wgsk2z6IiVCuJoG-V8aPyQ
60
60
  cognite/neat/_issues/_contextmanagers.py,sha256=lfASjmq0wHHCJQtgChvOMFZGp_rL513baHSRXbW0ugU,1577
61
61
  cognite/neat/_issues/_factory.py,sha256=-22ptgqVeqkaL7RqaIEexhXh3Z27dFvj7Q-9D0tu-4E,2811
62
62
  cognite/neat/_issues/errors/__init__.py,sha256=1MK8nHFrN5c2Uiq9r4PkjL8GnBY7TGhcqGNkgQzVmKs,2359
63
- cognite/neat/_issues/errors/_external.py,sha256=WISG6rA0GH7lD23hN7WDhDIfOh9QrsXUDSxMCkTcBj4,2210
63
+ cognite/neat/_issues/errors/_external.py,sha256=LIze-eY3gEWEA_UmCGmknoazhKa73-ZGaHDz3xsR9DM,2349
64
64
  cognite/neat/_issues/errors/_general.py,sha256=MnBm9V1S-Agr9kUfTMvviBB4_NkuOXamlgJCu2UojEM,849
65
65
  cognite/neat/_issues/errors/_properties.py,sha256=T_nquQeEQS3DQY--DQ13acxhGX_-gpUMjWGTBKCh6r8,2536
66
66
  cognite/neat/_issues/errors/_resources.py,sha256=qndhGGPdulWpU7G4PkFHsF4Bjflf3lehGV4A0l-BeNI,3966
@@ -105,7 +105,7 @@ cognite/neat/_rules/importers/_rdf/_inference2rules.py,sha256=NSPFEe6ZLHbFTUGTpQ
105
105
  cognite/neat/_rules/importers/_rdf/_owl2rules.py,sha256=gTMe94DC9xe8NR9KNVHTMTshg_NzVuN1v8Lz95BUshI,3392
106
106
  cognite/neat/_rules/importers/_rdf/_shared.py,sha256=nLHEXOwEs9n-4t6kIGyPJIlFMGw4VKCpU8_NBC0XLr0,5876
107
107
  cognite/neat/_rules/importers/_spreadsheet2rules.py,sha256=wjB7RVevjvXL3gaL1SGEW411ie76ZrFbe9fngzO-ncQ,10977
108
- cognite/neat/_rules/importers/_yaml2rules.py,sha256=k2oDgz--mxFVeyqQG3uvyYcb0BkFHwKHdBYHVaxtAEc,3721
108
+ cognite/neat/_rules/importers/_yaml2rules.py,sha256=tqfHhLnlcu4iFrF5ol26lUquBoXHW95mfpmtjdTQx-Q,3896
109
109
  cognite/neat/_rules/models/__init__.py,sha256=tf6tyWiYO0eC2PHCcpy208dwOHjEi9hg0sEaQLcB3uA,1024
110
110
  cognite/neat/_rules/models/_base_input.py,sha256=ZcSheXMz72w907RAcuMMupTk35zApQ8lS43As7dFVgA,6661
111
111
  cognite/neat/_rules/models/_base_rules.py,sha256=5Z2iyyumJn0oR-1XZ2-O696UTSpsjQ-6cBAdW3dvnE0,14996
@@ -115,7 +115,7 @@ cognite/neat/_rules/models/dms/__init__.py,sha256=fRaUH0IwG0YwWd_DNKM6j-jHHFyiIV
115
115
  cognite/neat/_rules/models/dms/_exporter.py,sha256=2QiTLX4UF89jGd_YRz9EczDFprBphdO_oyaQWMBmSiM,28576
116
116
  cognite/neat/_rules/models/dms/_rules.py,sha256=QEKNw31nkTwzjyNEnWYUdDFUdJvDJ5_14iQzWsFizxs,23537
117
117
  cognite/neat/_rules/models/dms/_rules_input.py,sha256=HfC4Z9UfDSBlKhoBdk57NqyPic1pVNymZYYEeV8Ow-k,16410
118
- cognite/neat/_rules/models/dms/_validation.py,sha256=Uh6DaCywdpTljy3trmVGaHrRI1wqZSAHRBpSi1hemsU,32165
118
+ cognite/neat/_rules/models/dms/_validation.py,sha256=TdIcYpjWNkNT9V3H2po4yzRnlAr1Kq6ZUbmfe-_rAzk,32175
119
119
  cognite/neat/_rules/models/entities/__init__.py,sha256=Hlucp3LyV6ncLl79aqRTbSy2qgiGzoyN8x54D_zaJCY,1469
120
120
  cognite/neat/_rules/models/entities/_constants.py,sha256=GXRzVfArwxF3C67VCkzy0JWTZRkRJUYXBQaaecrqcWc,351
121
121
  cognite/neat/_rules/models/entities/_loaders.py,sha256=OQDbz5ANMQ_7ZcdMIBdTR94BoCpWrBA2KBH3fCW0JQo,2728
@@ -177,10 +177,10 @@ cognite/neat/_utils/text.py,sha256=9T0mzcNn6J9X8DriNntLN5ThCXOWbU1BYareukbLT7A,8
177
177
  cognite/neat/_utils/time_.py,sha256=7ayUm0OWZm1JDmy32E4ip8WRr2o0GLwrHwJA8sJ43Z4,357
178
178
  cognite/neat/_utils/upload.py,sha256=xWtM6mFuD2QYQHaZ7zCAuGptbEpPIxcH-raWQu93-Ug,5845
179
179
  cognite/neat/_utils/xml_.py,sha256=FQkq84u35MUsnKcL6nTMJ9ajtG9D5i1u4VBnhGqP2DQ,1710
180
- cognite/neat/_version.py,sha256=PmwQMm2xpu25bGSQZn5n0s1kkl4epWM68bMMNxSbKEs,46
180
+ cognite/neat/_version.py,sha256=xLW6qWr9en3vnNky4xTA19gaRQx83AyykePJu290fog,46
181
181
  cognite/neat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
182
- cognite_neat-0.119.1.dist-info/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
183
- cognite_neat-0.119.1.dist-info/METADATA,sha256=uTVeDmlTuWj0Br_wMxYzmBrT8aO2ZINIypUKtBqmc78,5421
184
- cognite_neat-0.119.1.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
185
- cognite_neat-0.119.1.dist-info/entry_points.txt,sha256=SsQlnl8SNMSSjE3acBI835JYFtsIinLSbVmHmMEXv6E,51
186
- cognite_neat-0.119.1.dist-info/RECORD,,
182
+ cognite_neat-0.119.2.dist-info/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
183
+ cognite_neat-0.119.2.dist-info/METADATA,sha256=TXPc5I1wH0FXQw6_nA1vly50A781eRZbf_SVyVnd3Kw,5421
184
+ cognite_neat-0.119.2.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
185
+ cognite_neat-0.119.2.dist-info/entry_points.txt,sha256=SsQlnl8SNMSSjE3acBI835JYFtsIinLSbVmHmMEXv6E,51
186
+ cognite_neat-0.119.2.dist-info/RECORD,,