cognite-neat 0.82.2__py3-none-any.whl → 0.82.3__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 +1 @@
1
- __version__ = "0.82.2"
1
+ __version__ = "0.82.3"
@@ -1,8 +1,12 @@
1
1
  import re
2
2
  from collections import Counter, defaultdict
3
3
  from collections.abc import Collection
4
+ from datetime import date, datetime
4
5
  from typing import TYPE_CHECKING, Literal
5
6
 
7
+ from cognite.client.data_classes import data_modeling as dms
8
+
9
+ from cognite.neat.rules.models import data_types
6
10
  from cognite.neat.rules.models._base import (
7
11
  ExtensionCategory,
8
12
  SchemaCompleteness,
@@ -15,6 +19,7 @@ from cognite.neat.rules.models.entities import (
15
19
  ClassEntity,
16
20
  ContainerEntity,
17
21
  DMSUnknownEntity,
22
+ MultiValueTypeInfo,
18
23
  ReferenceEntity,
19
24
  UnknownEntity,
20
25
  ViewEntity,
@@ -172,6 +177,8 @@ class _InformationRulesConverter:
172
177
  value_type = DMSUnknownEntity()
173
178
  elif isinstance(prop.value_type, ClassEntity):
174
179
  value_type = prop.value_type.as_view_entity(default_space, default_version)
180
+ elif isinstance(prop.value_type, MultiValueTypeInfo):
181
+ value_type = self.convert_multi_value_type(prop.value_type)
175
182
  else:
176
183
  raise ValueError(f"Unsupported value type: {prop.value_type.type_}")
177
184
 
@@ -271,3 +278,24 @@ class _InformationRulesConverter:
271
278
  return suffix[: suffix_number.start()] + str(int(suffix_number.group()) + 1)
272
279
  else:
273
280
  return f"{suffix}2"
281
+
282
+ @staticmethod
283
+ def convert_multi_value_type(value_type: MultiValueTypeInfo) -> DataType:
284
+ if not all(isinstance(type_, DataType) for type_ in value_type.types):
285
+ raise ValueError("Only MultiValueType with DataType types is supported")
286
+ # We check above that there are no ClassEntity types in the MultiValueType
287
+ py_types = {type_.python for type_ in value_type.types} # type: ignore[union-attr]
288
+ if dms.Json in py_types and len(py_types) > 1:
289
+ raise ValueError("MultiValueType with Json and other types is not supported")
290
+ elif dms.Json in py_types:
291
+ return data_types.Json()
292
+ elif not (py_types - {bool}):
293
+ return data_types.Boolean()
294
+ elif not (py_types - {int, bool}):
295
+ return data_types.Integer()
296
+ elif not (py_types - {float, int, bool}):
297
+ return data_types.Double()
298
+ elif not (py_types - {datetime, date}):
299
+ return data_types.DateTime()
300
+
301
+ return data_types.String()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cognite-neat
3
- Version: 0.82.2
3
+ Version: 0.82.3
4
4
  Summary: Knowledge graph transformation
5
5
  Home-page: https://cognite-neat.readthedocs-hosted.com/
6
6
  License: Apache-2.0
@@ -1,5 +1,5 @@
1
1
  cognite/neat/__init__.py,sha256=v-rRiDOgZ3sQSMQKq0vgUQZvpeOkoHFXissAx6Ktg84,61
2
- cognite/neat/_version.py,sha256=RTYfZgQQ2I7IHQ7CnMLKfzWJLJYwV_HoEeJ8bvw2WlY,23
2
+ cognite/neat/_version.py,sha256=3x2wKMbffUEEJlJ3cDVbyt1M_iEH-TBgkPoWxClY4WU,23
3
3
  cognite/neat/app/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  cognite/neat/app/api/asgi/metrics.py,sha256=nxFy7L5cChTI0a-zkCiJ59Aq8yLuIJp5c9Dg0wRXtV0,152
5
5
  cognite/neat/app/api/configuration.py,sha256=2U5M6M252swvQPQyooA1EBzFUZNtcTmuSaywfJDgckM,4232
@@ -242,7 +242,7 @@ cognite/neat/rules/models/dms/_validation.py,sha256=5mk9L99FSwC8Ok7weEjnFJ_OZnmq
242
242
  cognite/neat/rules/models/domain.py,sha256=wZ-DeIPFnacbNlxSrRuLzUpnhHdTpzNc22z0sDfisi4,2880
243
243
  cognite/neat/rules/models/entities.py,sha256=qZa_PJOjFk3yTu5NyTSbAjsrU0HUxVnme_7YruBJoRQ,20460
244
244
  cognite/neat/rules/models/information/__init__.py,sha256=HR6g8xgyU53U7Ck8pPdbT70817Q4NC1r1pCRq5SA8iw,291
245
- cognite/neat/rules/models/information/_converter.py,sha256=r0a2uyzv8m82xzAkYt_-ZXdMN5u46SA_mn95Oo7ng-s,11424
245
+ cognite/neat/rules/models/information/_converter.py,sha256=Xxlg_F6wWXNOnnq4ZJDgj1blDL-mZdFVlYutktZ9r68,12757
246
246
  cognite/neat/rules/models/information/_rules.py,sha256=G_FsNMRy5h4u9c3WfCAo2isrGlflgjsgRGpVLQSUJ5Q,13210
247
247
  cognite/neat/rules/models/information/_rules_input.py,sha256=ExCjcD0pvsThXYDf3uWYLzSLqN_2OtXFggbW_RB8hr4,10343
248
248
  cognite/neat/rules/models/information/_serializer.py,sha256=yti9I_xJruxrib66YIBInhze___Io-oPTQH6uWDumPE,3503
@@ -307,8 +307,8 @@ cognite/neat/workflows/steps_registry.py,sha256=fkTX14ZA7_gkUYfWIlx7A1XbCidvqR23
307
307
  cognite/neat/workflows/tasks.py,sha256=dqlJwKAb0jlkl7abbY8RRz3m7MT4SK8-7cntMWkOYjw,788
308
308
  cognite/neat/workflows/triggers.py,sha256=_BLNplzoz0iic367u1mhHMHiUrCwP-SLK6_CZzfODX0,7071
309
309
  cognite/neat/workflows/utils.py,sha256=gKdy3RLG7ctRhbCRwaDIWpL9Mi98zm56-d4jfHDqP1E,453
310
- cognite_neat-0.82.2.dist-info/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
311
- cognite_neat-0.82.2.dist-info/METADATA,sha256=MoKqP6Krsaj7ZfMrDfvMfmCPOgHRhZyjQtd1Vp2BBZc,9290
312
- cognite_neat-0.82.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
313
- cognite_neat-0.82.2.dist-info/entry_points.txt,sha256=61FPqiWb25vbqB0KI7znG8nsg_ibLHBvTjYnkPvNFso,50
314
- cognite_neat-0.82.2.dist-info/RECORD,,
310
+ cognite_neat-0.82.3.dist-info/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
311
+ cognite_neat-0.82.3.dist-info/METADATA,sha256=vFK-g0VZN6HPCgAo_yEgu5XPKpAIbq1Gyhj2Tz8091w,9290
312
+ cognite_neat-0.82.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
313
+ cognite_neat-0.82.3.dist-info/entry_points.txt,sha256=61FPqiWb25vbqB0KI7znG8nsg_ibLHBvTjYnkPvNFso,50
314
+ cognite_neat-0.82.3.dist-info/RECORD,,