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

@@ -132,10 +132,12 @@ class DataType(BaseModel):
132
132
 
133
133
  @classmethod
134
134
  def convert_value(cls, value: Any) -> Any:
135
- if cls != Boolean:
135
+ if not issubclass(cls, Boolean):
136
136
  return cls.python(value)
137
- else:
137
+ elif isinstance(value, str):
138
138
  return value.strip().lower() in {"true", "1", "yes"}
139
+ else:
140
+ return bool(value)
139
141
 
140
142
 
141
143
  class Boolean(DataType):
@@ -117,7 +117,7 @@ class DMSInputProperty(InputComponent[DMSProperty]):
117
117
  min_count: int | None = None
118
118
  max_count: int | float | None = None
119
119
  immutable: bool | None = None
120
- default: str | int | dict | None = None
120
+ default: str | int | float | bool | dict | None = None
121
121
  container: str | None = None
122
122
  container_property: str | None = None
123
123
  index: str | list[str] | None = None
@@ -1,5 +1,7 @@
1
+ import warnings
1
2
  from dataclasses import dataclass, field
2
3
  from typing import Any, Literal, cast, overload
4
+ from warnings import catch_warnings
3
5
 
4
6
  import pandas as pd
5
7
  from openpyxl import load_workbook
@@ -67,12 +69,22 @@ def read_individual_sheet(
67
69
  expected_headers: list[str] | None = None,
68
70
  ) -> tuple[list[dict], SpreadsheetRead] | list[dict]:
69
71
  if expected_headers:
70
- target_row = _get_row_number(cast(Worksheet, load_workbook(excel_file)[sheet_name]), expected_headers)
72
+ with catch_warnings():
73
+ # When reading spreadsheets produced by neat, they contain dropdowns. These
74
+ # are not supported by openpyxl and will raise a warning as openpyxl cannot validate these.
75
+ # We ignore these warnings as Neat will do the same checks.
76
+ warnings.simplefilter("ignore")
77
+ target_row = _get_row_number(cast(Worksheet, load_workbook(excel_file)[sheet_name]), expected_headers)
71
78
  skiprows = target_row - 1 if target_row is not None else 0
72
79
  else:
73
80
  skiprows = 0
74
81
 
75
- raw = pd.read_excel(excel_file, sheet_name, skiprows=skiprows)
82
+ with catch_warnings():
83
+ # When reading spreadsheets produced by neat, they contain dropdowns. These
84
+ # are not supported by openpyxl and will raise a warning as openpyxl cannot validate these.
85
+ # We ignore these warnings as Neat will do the same checks.
86
+ warnings.simplefilter("ignore")
87
+ raw = pd.read_excel(excel_file, sheet_name, skiprows=skiprows)
76
88
  is_na = raw.isnull().all(axis=1)
77
89
  skip_rows = _find_rows_to_skip(raw)
78
90
  empty_rows = is_na[is_na].index.tolist()
cognite/neat/_version.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "0.117.2"
1
+ __version__ = "0.117.4"
2
2
  __engine__ = "^2.0.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: cognite-neat
3
- Version: 0.117.2
3
+ Version: 0.117.4
4
4
  Summary: Knowledge graph transformation
5
5
  License: Apache-2.0
6
6
  Author: Nikola Vasiljevic
@@ -110,11 +110,11 @@ cognite/neat/_rules/models/__init__.py,sha256=tf6tyWiYO0eC2PHCcpy208dwOHjEi9hg0s
110
110
  cognite/neat/_rules/models/_base_input.py,sha256=kAVI6QYAzsgQ79eLPc_hANJjl-o1e9IKeD7lF61ru9Y,6656
111
111
  cognite/neat/_rules/models/_base_rules.py,sha256=2jvkHZpPLanZHZAXz-IO8EZhb2whjzuB0vniPkWHBFk,14987
112
112
  cognite/neat/_rules/models/_types.py,sha256=6fHLiVPRlk5QsFjmvDFFqw1htPcPp-RfnUzYoMWNfeg,5418
113
- cognite/neat/_rules/models/data_types.py,sha256=157IlIAuzZfLUsEXBx8AKwszxztk_Ogqny4W-hmik94,10013
113
+ cognite/neat/_rules/models/data_types.py,sha256=OyiAiszU59wQssv05XHX8SihLkYmtfgmgmdVypJ7cwc,10095
114
114
  cognite/neat/_rules/models/dms/__init__.py,sha256=fRaUH0IwG0YwWd_DNKM6j-jHHFyiIVz4_8DPiS1KR0Y,695
115
115
  cognite/neat/_rules/models/dms/_exporter.py,sha256=2QiTLX4UF89jGd_YRz9EczDFprBphdO_oyaQWMBmSiM,28576
116
116
  cognite/neat/_rules/models/dms/_rules.py,sha256=BX65py8dD8l5_55-A1SjLqpK8It6R7puCyZc5yMOs9A,23249
117
- cognite/neat/_rules/models/dms/_rules_input.py,sha256=QGQH6SADokPkvHFgR_j59oTLqWHxpICcLAl_dMF62ZM,16390
117
+ cognite/neat/_rules/models/dms/_rules_input.py,sha256=JRRtUw7DYw1YKMXYC3ktv71F6j-ng6_EeQG3ejmJzKE,16405
118
118
  cognite/neat/_rules/models/dms/_validation.py,sha256=Uh6DaCywdpTljy3trmVGaHrRI1wqZSAHRBpSi1hemsU,32165
119
119
  cognite/neat/_rules/models/entities/__init__.py,sha256=Hlucp3LyV6ncLl79aqRTbSy2qgiGzoyN8x54D_zaJCY,1469
120
120
  cognite/neat/_rules/models/entities/_constants.py,sha256=g52-pFP_Qghp86NYk76pLDM52b3T4MXMztxhpeDW3Oc,344
@@ -172,15 +172,15 @@ cognite/neat/_utils/io_.py,sha256=D2Mg8sOxfBoDg3fC0jBzaxO3vkXmr0QvZSgYIv6xRkM,38
172
172
  cognite/neat/_utils/rdf_.py,sha256=v4m8DD9dcHkALSx6wStC2h3kj-e3BmhxJT20fydtw7g,9897
173
173
  cognite/neat/_utils/reader/__init__.py,sha256=fPkrNB_9hLB7CyHTCFV_xEbIfOMqUQzNly5JN33-QfM,146
174
174
  cognite/neat/_utils/reader/_base.py,sha256=Q35hz8tqAiQiELjE4DsDDKQHLtRmSTrty4Gep9rg_CU,5444
175
- cognite/neat/_utils/spreadsheet.py,sha256=_QaziVzo83X6vuXdAmqp4HgMmF3eb9PrTRwq8F1POl4,4652
175
+ cognite/neat/_utils/spreadsheet.py,sha256=EQRBnz9ngDmJOSiwURuA8MuGr4SBh--TXAiwHVh3AjA,5370
176
176
  cognite/neat/_utils/text.py,sha256=BFJoEOQBFgpelysL92FdF0OVRVFl0q9tRNoz-oRanNc,7779
177
177
  cognite/neat/_utils/time_.py,sha256=O30LUiDH9TdOYz8_a9pFqTtJdg8vEjC3qHCk8xZblG8,345
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=QPLtZ3sS71bmoKNu3TyTYKy7lRyMCDh2l6Ur8ITOlz8,46
180
+ cognite/neat/_version.py,sha256=52XUJLePfcMMg3CbEN5rLK6S5Ffu21qWeirN8F_SFb4,46
181
181
  cognite/neat/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
182
- cognite_neat-0.117.2.dist-info/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
183
- cognite_neat-0.117.2.dist-info/METADATA,sha256=ekCAFZpHqHGP0JjfiP9NOa7ETMffALadml3HTGnfWvQ,5361
184
- cognite_neat-0.117.2.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
185
- cognite_neat-0.117.2.dist-info/entry_points.txt,sha256=SsQlnl8SNMSSjE3acBI835JYFtsIinLSbVmHmMEXv6E,51
186
- cognite_neat-0.117.2.dist-info/RECORD,,
182
+ cognite_neat-0.117.4.dist-info/LICENSE,sha256=W8VmvFia4WHa3Gqxq1Ygrq85McUNqIGDVgtdvzT-XqA,11351
183
+ cognite_neat-0.117.4.dist-info/METADATA,sha256=V3A3pVKEpfbdkvaCv5DCY2qBx0kmRgukr2XwIhz7oig,5361
184
+ cognite_neat-0.117.4.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
185
+ cognite_neat-0.117.4.dist-info/entry_points.txt,sha256=SsQlnl8SNMSSjE3acBI835JYFtsIinLSbVmHmMEXv6E,51
186
+ cognite_neat-0.117.4.dist-info/RECORD,,