cognite-neat 0.123.29__py3-none-any.whl → 0.123.30__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 CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "0.123.29"
1
+ __version__ = "0.123.30"
2
2
  __engine__ = "^2.0.4"
File without changes
@@ -0,0 +1,9 @@
1
+ from ._constants import Undefined, Unknown
2
+ from ._identifiers import URI, NameSpace
3
+
4
+ __all__ = [
5
+ "URI",
6
+ "NameSpace",
7
+ "Undefined",
8
+ "Unknown",
9
+ ]
@@ -0,0 +1,17 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class _UndefinedType(BaseModel): ...
5
+
6
+
7
+ class _UnknownType(BaseModel):
8
+ def __str__(self) -> str:
9
+ return "#N/A"
10
+
11
+ def __hash__(self) -> int:
12
+ return hash(str(self))
13
+
14
+
15
+ # This is a trick to make Undefined and Unknown singletons
16
+ Undefined = _UndefinedType()
17
+ Unknown = _UnknownType()
@@ -0,0 +1,61 @@
1
+ from pydantic import HttpUrl, RootModel, ValidationError
2
+
3
+ from cognite.neat.core._utils.auxiliary import local_import
4
+
5
+
6
+ class URI(RootModel[str]):
7
+ def __init__(self, value: str):
8
+ try:
9
+ # Use Pydantic's HttpUrl to validate the URI
10
+ _ = HttpUrl(value)
11
+ except ValidationError as e:
12
+ raise ValueError(f"Invalid URI: {value}") from e
13
+ super().__init__(value)
14
+
15
+ def __str__(self) -> str:
16
+ return self.root
17
+
18
+ def __repr__(self) -> str:
19
+ return f"URI({self.root!r})"
20
+
21
+ def as_rdflib_uriref(self): # type: ignore[no-untyped-def]
22
+ # rdflib is an optional dependency, so import here
23
+ local_import("rdflib", "rdflib")
24
+ from rdflib import URIRef
25
+
26
+ return URIRef(self.root)
27
+
28
+
29
+ class NameSpace(RootModel[str]):
30
+ def __init__(self, value: str):
31
+ try:
32
+ # Use Pydantic's HttpUrl to validate the URI
33
+ _ = HttpUrl(value)
34
+ except ValidationError as e:
35
+ raise ValueError(f"Invalid Namespace: {value}") from e
36
+ super().__init__(value)
37
+
38
+ def __str__(self) -> str:
39
+ return self.root
40
+
41
+ def __repr__(self) -> str:
42
+ return f"NameSpace({self.root!r})"
43
+
44
+ def term(self, name: str) -> URI:
45
+ # need to handle slices explicitly because of __getitem__ override
46
+ return URI(self.root + (name if isinstance(name, str) else ""))
47
+
48
+ def __getitem__(self, key: str) -> URI: # type: ignore[override]
49
+ return self.term(key)
50
+
51
+ def __getattr__(self, name: str) -> URI:
52
+ if name.startswith("__"): # ignore any special Python names!
53
+ raise AttributeError
54
+ return self.term(name)
55
+
56
+ def as_rdflib_namespace(self): # type: ignore[no-untyped-def]
57
+ # rdflib is an optional dependency, so import here
58
+ local_import("rdflib", "rdflib")
59
+ from rdflib import Namespace
60
+
61
+ return Namespace(self.root)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite-neat
3
- Version: 0.123.29
3
+ Version: 0.123.30
4
4
  Summary: Knowledge graph transformation
5
5
  Project-URL: Documentation, https://cognite-neat.readthedocs-hosted.com/
6
6
  Project-URL: Homepage, https://cognite-neat.readthedocs-hosted.com/
@@ -1,5 +1,5 @@
1
1
  cognite/neat/__init__.py,sha256=12StS1dzH9_MElqxGvLWrNsxCJl9Hv8A2a9D0E5OD_U,193
2
- cognite/neat/_version.py,sha256=XvrbF0Q-YDaW-QxSx3EOVq_H4nfGBw62MvL7elHSYzU,47
2
+ cognite/neat/_version.py,sha256=Umq3xx0HZoXDYrJ16jkCraj5gi3lRvqf-wxtIkntgvg,47
3
3
  cognite/neat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  cognite/neat/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  cognite/neat/core/_config.py,sha256=WT1BS8uADcFvGoUYOOfwFOVq_VBl472TisdoA3wLick,280
@@ -159,6 +159,10 @@ cognite/neat/core/_utils/upload.py,sha256=yR-BvvrWPh0XHoIGByXMEVi3JONzmc5xwXbmED
159
159
  cognite/neat/core/_utils/xml_.py,sha256=FQkq84u35MUsnKcL6nTMJ9ajtG9D5i1u4VBnhGqP2DQ,1710
160
160
  cognite/neat/core/_utils/reader/__init__.py,sha256=fPkrNB_9hLB7CyHTCFV_xEbIfOMqUQzNly5JN33-QfM,146
161
161
  cognite/neat/core/_utils/reader/_base.py,sha256=fRXxUWW8a3UFedeCLxDTDgFntWGlHaEGxmKLcITtiWE,5417
162
+ cognite/neat/data_model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
163
+ cognite/neat/data_model/models/entities/__init__.py,sha256=0IjgtsIJURvTFtYLbxb0b-rxAIyR6HjeMOPxKT3rXx0,159
164
+ cognite/neat/data_model/models/entities/_constants.py,sha256=P56zgsL2xqfegWOxEAyPm9qrZcxrjb1ZXqMG7cDmQxc,333
165
+ cognite/neat/data_model/models/entities/_identifiers.py,sha256=0G7xYwOa6dsO3Ie0UqCwbpkb4mMeYU1dQD2De6NnllU,1920
162
166
  cognite/neat/plugins/__init__.py,sha256=Q7r1FFbybOt71N9TjHjjk-1HguLRfHieLeiGVSG5HTY,75
163
167
  cognite/neat/plugins/_issues.py,sha256=jukeVjSs1DEzqtFuGRcIDbg7bNxZRxGPqnzumVRF-8c,940
164
168
  cognite/neat/plugins/_manager.py,sha256=_eJa5_3UGoLVacSQgbDrE0eWcopjeXxgbfSmvujeSiU,3979
@@ -196,7 +200,7 @@ cognite/neat/session/engine/__init__.py,sha256=D3MxUorEs6-NtgoICqtZ8PISQrjrr4dvc
196
200
  cognite/neat/session/engine/_import.py,sha256=1QxA2_EK613lXYAHKQbZyw2yjo5P9XuiX4Z6_6-WMNQ,169
197
201
  cognite/neat/session/engine/_interface.py,sha256=3W-cYr493c_mW3P5O6MKN1xEQg3cA7NHR_ev3zdF9Vk,533
198
202
  cognite/neat/session/engine/_load.py,sha256=g52uYakQM03VqHt_RDHtpHso1-mFFifH5M4T2ScuH8A,5198
199
- cognite_neat-0.123.29.dist-info/METADATA,sha256=PS-Oqu3Fi4re8fE-LYGOgFDd9Un3QCe5L9iGWf83jOc,9166
200
- cognite_neat-0.123.29.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
201
- cognite_neat-0.123.29.dist-info/licenses/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
202
- cognite_neat-0.123.29.dist-info/RECORD,,
203
+ cognite_neat-0.123.30.dist-info/METADATA,sha256=girPGuZI_KaMxUsiBAAyFdVBLXuFrHyPMJP8dDX0u6M,9166
204
+ cognite_neat-0.123.30.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
205
+ cognite_neat-0.123.30.dist-info/licenses/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
206
+ cognite_neat-0.123.30.dist-info/RECORD,,