python-eigen-ingenuity-nocli 0.5.30b4__tar.gz → 0.5.30b5__tar.gz
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.
- {python_eigen_ingenuity_nocli-0.5.30b4/python_eigen_ingenuity_nocli.egg-info → python_eigen_ingenuity_nocli-0.5.30b5}/PKG-INFO +1 -1
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/csvcontentsmanager.py +15 -25
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/fileanalyser.py +67 -38
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/processors/labelmanager.py +6 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/processors/nodefileprocessor.py +6 -16
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/processors/relationshipfileprocessor.py +12 -67
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/property.py +8 -4
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5/python_eigen_ingenuity_nocli.egg-info}/PKG-INFO +1 -1
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/MANIFEST.in +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/README-nocli.md +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/README.md +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/eigeningenuity/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/eigeningenuity/assetmodel.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/eigeningenuity/auth.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/eigeningenuity/commonmenu.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/eigeningenuity/core/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/eigeningenuity/elastic.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/eigeningenuity/events.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/eigeningenuity/historian.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/eigeningenuity/historianmulti.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/eigeningenuity/logformatter.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/eigeningenuity/settings.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/eigeningenuity/sql.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/eigeningenuity/util.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/common.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/config.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/demo.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historian/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historian/test_getCurrentDataPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historian/test_getInterpolatedPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historian/test_getInterpolatedRange.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historian/test_getMetaData.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historian/test_getRawDataPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historian/test_listDataTags.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historian/test_writePoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historianmulti/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historianmulti/common_multi.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historianmulti/test_getClosestRawPoint.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historianmulti/test_getCurrentDataPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historianmulti/test_getInterpolatedPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historianmulti/test_getInterpolatedRange.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historianmulti/test_getMetaData.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historianmulti/test_getRawDatapoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historianmulti/test_listDataTags.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historianmulti/test_tagManagement.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/historianmulti/test_writePoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/run_tests.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/assetmodelbuilder.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/assetmodelcsvwriter.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/assetmodelutilities.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/configmanager.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/connectors/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/connectors/boltconnector.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/connectors/dbconnectors.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/connectors/genericconnector.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/connectors/httpsconnector.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/csvwriter.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/filemanager.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/messages.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/processors/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/processors/cypherfileprocessor.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/processors/propertymanager.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/processors/relationshipmanager.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/queries/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/queries/cypherbuilder.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/queries/query.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/querymanager.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/modelbuilder/src/versionmanager.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/pyproject.toml +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/python_eigen_ingenuity_nocli.egg-info/SOURCES.txt +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/python_eigen_ingenuity_nocli.egg-info/dependency_links.txt +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/python_eigen_ingenuity_nocli.egg-info/requires.txt +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/python_eigen_ingenuity_nocli.egg-info/top_level.txt +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/common.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/common_multi.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian/common.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian/test_getCurrentDataPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian/test_getInterpolatedPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian/test_getInterpolatedRange.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian/test_getMetaData.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian/test_getRawDataPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian/test_listDataTags.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian/test_writePoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian-multi/__init__.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian-multi/common_multi.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian-multi/test_getClosestRawPoint.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian-multi/test_getCurrentDataPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian-multi/test_getInterpolatedPoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian-multi/test_getInterpolatedRange.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian-multi/test_getMetaData.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian-multi/test_getRawDatapoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian-multi/test_listDataTags.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian-multi/test_tagManagement.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/regressiontests/eigeningenuity/historian-multi/test_writePoints.py +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/requirements.txt +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/setup.cfg +0 -0
- {python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/setup.py +0 -0
|
@@ -133,34 +133,24 @@ class CSVContentsManager:
|
|
|
133
133
|
|
|
134
134
|
def get_property_values_dict(self, row_number, column_numbers, allow_blank_property_list, default_key='', prefix='', blank_override='', allow_split=True):
|
|
135
135
|
this_row = self.data_list[row_number]
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
else:
|
|
139
|
-
split_values = [[this_row[column]] for column in column_numbers]
|
|
140
|
-
split_keys = [(value[0] + ':').split(':') for value in split_values]
|
|
141
|
-
this_list = {prefix + (self.mapped_keys[column] or default_key): Neo4jProperty(prefix + (self.mapped_keys[column] or default_key), this_row[column], self.formats[column], blank_override=blank_override) if len(split_values[count]) == 1 else {prefix + (split_keys[count][0] or default_key): Neo4jProperty(prefix + (split_keys[count][0] or default_key), split_values[count][1], split_keys[count][1] or self.formats[column], blank_override=blank_override)} for count, column in enumerate(column_numbers) if this_row[column] or self.mapped_keys[column] in allow_blank_property_list or allow_blank_property_list == []}
|
|
136
|
+
split_values, labels, split_keys = self.get_property_value_data(this_row, column_numbers, allow_split)
|
|
137
|
+
this_list = {prefix + (self.mapped_keys[column] or default_key): Neo4jProperty(prefix + (self.mapped_keys[column] or default_key), this_row[column], self.formats[column], blank_override=blank_override, labels=labels[count]) if len(split_values[count]) == 1 else {prefix + (split_keys[count][0] or default_key): Neo4jProperty(prefix + (split_keys[count][0] or default_key), split_values[count][1], split_keys[count][1] or self.formats[column], blank_override=blank_override, labels=labels[0])} for count, column in enumerate(column_numbers) if this_row[column] or self.mapped_keys[column] in allow_blank_property_list or allow_blank_property_list == []}
|
|
142
138
|
return this_list
|
|
143
139
|
|
|
144
|
-
def parse_property_value_with_labels(self, raw_value, default_key, override_key, format_value):
|
|
145
|
-
match_labels = ''
|
|
146
|
-
value_parts = raw_value.split('$$', 1)
|
|
147
|
-
value = value_parts[0]
|
|
148
|
-
if len(value_parts) > 1:
|
|
149
|
-
match_labels = value_parts[1]
|
|
150
|
-
|
|
151
|
-
if '::' in value:
|
|
152
|
-
key_value_parts = value.split('::', 1)
|
|
153
|
-
key = key_value_parts[0] or default_key
|
|
154
|
-
value = key_value_parts[1]
|
|
155
|
-
else:
|
|
156
|
-
key = override_key or default_key
|
|
157
|
-
|
|
158
|
-
return Neo4jProperty(key, value, format_value, match_labels=match_labels)
|
|
159
|
-
|
|
160
140
|
def get_property_values_list(self, row_number, column_numbers, default_key='', override_key='', allow_split=True, override_format=None):
|
|
161
141
|
this_row = self.data_list[row_number]
|
|
142
|
+
split_values, labels, split_keys = self.get_property_value_data(this_row, column_numbers, allow_split)
|
|
143
|
+
these_keys = [override_key or self.mapped_keys[column] if self.types[column] == '' else self.mapped_keys[column] or default_key for column in column_numbers]
|
|
144
|
+
this_list = [Neo4jProperty(these_keys[count], split_values[count][0], override_format or self.formats[column], labels=labels[count]) if len(split_values[count]) == 1 else Neo4jProperty(split_values[count][0] or default_key, split_values[count][1], override_format or split_keys[count][1] or self.formats[column], labels=labels[count]) for count, column in enumerate(column_numbers) if this_row[column]]
|
|
145
|
+
return this_list
|
|
146
|
+
|
|
147
|
+
def get_property_value_data(self, this_row, column_numbers, allow_split=True):
|
|
162
148
|
if allow_split:
|
|
163
|
-
|
|
149
|
+
split_vals = [this_row[column].split('::') for column in column_numbers]
|
|
164
150
|
else:
|
|
165
|
-
|
|
166
|
-
|
|
151
|
+
split_vals = [[this_row[column]] for column in column_numbers]
|
|
152
|
+
split_values = [[split_val[0].split(':')[0]] if len(split_val) == 1 else [split_val[0], split_val[1].split(':')[0]] for split_val in split_vals]
|
|
153
|
+
labels = [[(split_val[-1]+':').split(':', 1)[1][0:-1]] for split_val in split_vals]
|
|
154
|
+
split_keys = [(value[0] + ':').split(':') for value in split_values]
|
|
155
|
+
|
|
156
|
+
return split_values, labels, split_keys
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import csv
|
|
2
|
+
from io import StringIO
|
|
3
|
+
from charset_normalizer import from_bytes
|
|
4
|
+
import unicodedata
|
|
2
5
|
|
|
3
6
|
import messages
|
|
4
7
|
from csvcontentsmanager import CSVContentsManager
|
|
@@ -49,26 +52,40 @@ class FileAnalyser():
|
|
|
49
52
|
contents = CSVContentsManager(csv_data, self.header_mappings, self.alias_mappings, self.default_data_type)
|
|
50
53
|
except Exception as exc:
|
|
51
54
|
self.logger(f"Error reading file with forced encoding {self.force_encoding}: {exc}")
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
with open(file_name, encoding='utf-8') as csv_file:
|
|
55
|
-
csv_data = csv.reader(csv_file, delimiter=self.separator)
|
|
56
|
-
contents = CSVContentsManager(csv_data, self.header_mappings, self.alias_mappings, self.default_data_type)
|
|
57
|
-
except:
|
|
58
|
-
try:
|
|
59
|
-
self.logger('utf-8 encoding failed, trying to auto-detect encoding')
|
|
60
|
-
with open(file_name) as csv_file:
|
|
61
|
-
csv_data = csv.reader(csv_file, delimiter=self.separator)
|
|
62
|
-
contents = CSVContentsManager(csv_data, self.header_mappings, self.alias_mappings, self.default_data_type)
|
|
63
|
-
except:
|
|
55
|
+
match file_format:
|
|
56
|
+
case 'csv':
|
|
64
57
|
try:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
58
|
+
with open(file_name, "rb") as f:
|
|
59
|
+
raw = f.read()
|
|
60
|
+
|
|
61
|
+
# detect encoding
|
|
62
|
+
result = from_bytes(raw)
|
|
63
|
+
best = result.best()
|
|
64
|
+
|
|
65
|
+
if best is None:
|
|
66
|
+
return 'incorrect file format', None, []
|
|
67
|
+
|
|
68
|
+
text = str(best)
|
|
69
|
+
|
|
70
|
+
# normalize unicode (fix Mac/Windows accent differences)
|
|
71
|
+
text = unicodedata.normalize("NFC", text)
|
|
72
|
+
|
|
73
|
+
csv_data = csv.reader(
|
|
74
|
+
StringIO(text),
|
|
75
|
+
delimiter=self.separator
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
contents = CSVContentsManager(
|
|
79
|
+
csv_data,
|
|
80
|
+
self.header_mappings,
|
|
81
|
+
self.alias_mappings,
|
|
82
|
+
self.default_data_type
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
except Exception:
|
|
86
|
+
return 'incorrect file format', None, []
|
|
87
|
+
case _:
|
|
88
|
+
pass
|
|
72
89
|
elif self.detect_encoding:
|
|
73
90
|
try:
|
|
74
91
|
self.logger('Detecting file encoding...')
|
|
@@ -92,28 +109,40 @@ class FileAnalyser():
|
|
|
92
109
|
match file_format:
|
|
93
110
|
case 'csv':
|
|
94
111
|
try:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
with open(file_name, "rb") as f:
|
|
113
|
+
raw = f.read()
|
|
114
|
+
|
|
115
|
+
# detect encoding
|
|
116
|
+
result = from_bytes(raw)
|
|
117
|
+
best = result.best()
|
|
118
|
+
|
|
119
|
+
if best is None:
|
|
120
|
+
return 'incorrect file format', None, []
|
|
121
|
+
|
|
122
|
+
text = str(best)
|
|
123
|
+
|
|
124
|
+
# normalize unicode (fix Mac/Windows accent differences)
|
|
125
|
+
text = unicodedata.normalize("NFC", text)
|
|
126
|
+
|
|
127
|
+
csv_data = csv.reader(
|
|
128
|
+
StringIO(text),
|
|
129
|
+
delimiter=self.separator
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
contents = CSVContentsManager(
|
|
133
|
+
csv_data,
|
|
134
|
+
self.header_mappings,
|
|
135
|
+
self.alias_mappings,
|
|
136
|
+
self.default_data_type
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
except Exception:
|
|
140
|
+
return 'incorrect file format', None, []
|
|
114
141
|
case _:
|
|
115
142
|
pass
|
|
116
143
|
|
|
144
|
+
|
|
145
|
+
|
|
117
146
|
num_node_columns = contents.get_column_count(self.node_alias, self.node_types)
|
|
118
147
|
num_from_columns = contents.get_column_count(self.from_node_alias, self.from_types)
|
|
119
148
|
num_to_columns = contents.get_column_count(self.to_node_alias, self.to_types)
|
|
@@ -121,6 +121,12 @@ def strip_quotes(quote_list):
|
|
|
121
121
|
return stripped_list
|
|
122
122
|
|
|
123
123
|
|
|
124
|
+
def merge_node_labels(merge_labels, node_labels):
|
|
125
|
+
wanted, _, remove = sort_labels(merge_labels, node_labels)
|
|
126
|
+
merged_labels = [i for i in merge_labels + wanted if not i in remove]
|
|
127
|
+
return merged_labels
|
|
128
|
+
|
|
129
|
+
|
|
124
130
|
def merge_labels(self, required_labels, unrequired_labels, remove_labels):
|
|
125
131
|
merged_labels = [i for i in self.required_labels + required_labels if (not ('!' + i in unrequired_labels) and not (i in remove_labels) and not (i.startswith('!')))]
|
|
126
132
|
return merged_labels
|
|
@@ -50,16 +50,6 @@ class NodeFileProcessor:
|
|
|
50
50
|
last_row = min(num_rows, self.last_row)
|
|
51
51
|
return last_row
|
|
52
52
|
|
|
53
|
-
def get_inline_merge_labels(self, label_string):
|
|
54
|
-
# For node MERGE, only colon-separated labels are directly supported.
|
|
55
|
-
# OR expressions (label1|label2) are ignored here because MERGE cannot express label OR.
|
|
56
|
-
if not label_string:
|
|
57
|
-
return []
|
|
58
|
-
if '|' in label_string:
|
|
59
|
-
messages.warning_message('Unsupported inline node label expression: ', f'{label_string} (ignoring OR labels for MERGE)')
|
|
60
|
-
return []
|
|
61
|
-
return lm.validate_label_string_to_list(label_string)
|
|
62
|
-
|
|
63
53
|
def process_node_file(self):
|
|
64
54
|
|
|
65
55
|
# For each line in the file, build a cypher query to MERGE a node
|
|
@@ -91,13 +81,13 @@ class NodeFileProcessor:
|
|
|
91
81
|
|
|
92
82
|
for primary_property in self.contents.get_property_values_list(this_row, node_columns, self.primary_property, allow_split=True, override_format='str'):
|
|
93
83
|
time_now = amu.get_formatted_time_now()
|
|
94
|
-
|
|
95
|
-
|
|
84
|
+
merge_labels, new_labels, remove_labels = lm.sort_node_labels(self.required_labels, validated_csv_labels)
|
|
85
|
+
node_labels = lm.merge_node_labels(merge_labels, primary_property.labels)
|
|
96
86
|
|
|
97
87
|
# Build a simple MERGE query using queries
|
|
98
88
|
query_text = (QueryBuilder()
|
|
99
89
|
.merge()
|
|
100
|
-
.node(labels=
|
|
90
|
+
.node(labels=node_labels, ref_name=property_ref, properties=primary_property)
|
|
101
91
|
)
|
|
102
92
|
|
|
103
93
|
# Add in System properties if required
|
|
@@ -170,8 +160,8 @@ class NodeFileProcessor:
|
|
|
170
160
|
row_properties = self.contents.get_property_values_dict(this_row, property_columns, self.blank_property_list, blank_override=self.blank_property_override, allow_split=False)
|
|
171
161
|
|
|
172
162
|
for primary_property in self.contents.get_property_values_list(this_row, node_columns, self.primary_property, allow_split=True, override_format='str'):
|
|
173
|
-
|
|
174
|
-
|
|
163
|
+
merge_labels, new_labels, remove_labels = lm.sort_node_labels(self.required_labels, validated_csv_labels)
|
|
164
|
+
node_labels = lm.merge_node_labels(merge_labels, primary_property.labels)
|
|
175
165
|
properties = pm.combine_properties(self.required_properties, row_properties)
|
|
176
166
|
# Remove any properties we don't want
|
|
177
167
|
for unwanted in self.unrequired_properties:
|
|
@@ -193,7 +183,7 @@ class NodeFileProcessor:
|
|
|
193
183
|
# So now we know all about this particular update. Let's put it in the query dictionary
|
|
194
184
|
# We'll group these by unique combinations of labels and primary key type
|
|
195
185
|
# Have to use a list since a dictionary key can't be a dictionary
|
|
196
|
-
dictionary_key = [new_labels,
|
|
186
|
+
dictionary_key = [new_labels, node_labels, remove_labels, [primary_property.key], calculated_properties.keys()]
|
|
197
187
|
try:
|
|
198
188
|
dictionary_index = batch_keys.index(dictionary_key)
|
|
199
189
|
query_dictionary[dictionary_index] += query_data_list
|
|
@@ -58,45 +58,6 @@ class RelationshipFileProcessor:
|
|
|
58
58
|
last_row = min(num_rows, self.last_row)
|
|
59
59
|
return last_row
|
|
60
60
|
|
|
61
|
-
def get_inline_match_labels(self, node_ref, label_string):
|
|
62
|
-
# Supports:
|
|
63
|
-
# label1 -> node_ref:label1
|
|
64
|
-
# label1:label2 -> node_ref:label1 AND node_ref:label2
|
|
65
|
-
# label1|label2 -> node_ref:label1 OR node_ref:label2
|
|
66
|
-
# label1:label2|label3 -> (node_ref:label1 AND node_ref:label2) OR node_ref:label3
|
|
67
|
-
if not label_string:
|
|
68
|
-
return [], ''
|
|
69
|
-
|
|
70
|
-
# Grouped expression support:
|
|
71
|
-
# prefix:(a|b) -> required label 'prefix' + WHERE (node_ref:a OR node_ref:b)
|
|
72
|
-
# prefix1:prefix2:(a|b) -> required labels 'prefix1' and 'prefix2' + grouped OR
|
|
73
|
-
if label_string.endswith(')') and ':(' in label_string:
|
|
74
|
-
prefix, grouped = label_string.rsplit(':(', 1)
|
|
75
|
-
grouped = grouped[:-1]
|
|
76
|
-
if grouped and '|' in grouped:
|
|
77
|
-
required_labels = lm.validate_label_string_to_list(prefix)
|
|
78
|
-
option_literals = []
|
|
79
|
-
for option in grouped.split('|'):
|
|
80
|
-
these_labels = lm.validate_label_string_to_list(option)
|
|
81
|
-
if these_labels:
|
|
82
|
-
option_literals.append('(' + ' AND '.join([f'{node_ref}:{label}' for label in these_labels]) + ')')
|
|
83
|
-
if option_literals:
|
|
84
|
-
return required_labels, '(' + ' OR '.join(option_literals) + ')'
|
|
85
|
-
|
|
86
|
-
if '|' not in label_string:
|
|
87
|
-
return lm.validate_label_string_to_list(label_string), ''
|
|
88
|
-
|
|
89
|
-
option_literals = []
|
|
90
|
-
for option in label_string.split('|'):
|
|
91
|
-
these_labels = lm.validate_label_string_to_list(option)
|
|
92
|
-
if these_labels:
|
|
93
|
-
option_literals.append('(' + ' AND '.join([f'{node_ref}:{label}' for label in these_labels]) + ')')
|
|
94
|
-
|
|
95
|
-
if not option_literals:
|
|
96
|
-
return [], ''
|
|
97
|
-
|
|
98
|
-
return [], '(' + ' OR '.join(option_literals) + ')'
|
|
99
|
-
|
|
100
61
|
def process_relationship_file(self):
|
|
101
62
|
|
|
102
63
|
# For each line in the file, build a cypher query to MERGE a relationship
|
|
@@ -136,12 +97,12 @@ class RelationshipFileProcessor:
|
|
|
136
97
|
# If there are multiple From or To nodes, create a relationship query for each combination
|
|
137
98
|
for from_node in self.contents.get_property_values_list(this_row, from_columns, self.primary_property, self.from_property, override_format='str'):
|
|
138
99
|
validated_csv_from_labels = lm.validate_labels(self.contents.get_column_values_list(this_row, from_label_columns))
|
|
139
|
-
|
|
140
|
-
|
|
100
|
+
from_labels = lm.sort_relationship_labels(self.required_labels + self.from_required_labels, validated_csv_from_labels)
|
|
101
|
+
from_node_labels = lm.merge_node_labels(from_labels, from_node.labels)
|
|
141
102
|
for to_node in self.contents.get_property_values_list(this_row, to_columns, self.primary_property, self.to_property, override_format='str'):
|
|
142
103
|
validated_csv_to_labels = lm.validate_labels(self.contents.get_column_values_list(this_row, to_label_columns))
|
|
143
|
-
|
|
144
|
-
|
|
104
|
+
to_labels = lm.sort_relationship_labels(self.required_labels + self.to_required_labels, validated_csv_to_labels)
|
|
105
|
+
to_node_labels = lm.merge_node_labels(to_labels, to_node.labels)
|
|
145
106
|
|
|
146
107
|
# Build a MERGE query for the relationship(s)
|
|
147
108
|
for relationship in relationships:
|
|
@@ -151,16 +112,9 @@ class RelationshipFileProcessor:
|
|
|
151
112
|
time_now = amu.get_formatted_time_now()
|
|
152
113
|
query_text = (QueryBuilder()
|
|
153
114
|
.match()
|
|
154
|
-
.node(labels=
|
|
115
|
+
.node(labels=from_node_labels, ref_name=from_ref, properties=from_node)
|
|
155
116
|
.match()
|
|
156
|
-
.node(labels=
|
|
157
|
-
)
|
|
158
|
-
|
|
159
|
-
where_literals = [i for i in [inline_from_where, inline_to_where] if i]
|
|
160
|
-
if where_literals:
|
|
161
|
-
query_text = query_text.where_literal(' AND '.join(where_literals))
|
|
162
|
-
|
|
163
|
-
query_text = (query_text
|
|
117
|
+
.node(labels=to_node_labels, ref_name=to_ref, properties=to_node)
|
|
164
118
|
.merge()
|
|
165
119
|
.node(ref_name=from_ref)
|
|
166
120
|
.related_to(label=relation, ref_name=relation_ref)
|
|
@@ -182,7 +136,7 @@ class RelationshipFileProcessor:
|
|
|
182
136
|
query_list = self.query_manager.parameterise(query_text, self.section)
|
|
183
137
|
|
|
184
138
|
for a_query in query_list:
|
|
185
|
-
query = Neo4jQuery('
|
|
139
|
+
query = Neo4jQuery('relationship', a_query, time_now)
|
|
186
140
|
if self.validate_only and not self.summarise:
|
|
187
141
|
print(a_query)
|
|
188
142
|
queries.append(query)
|
|
@@ -243,12 +197,12 @@ class RelationshipFileProcessor:
|
|
|
243
197
|
# If there are multiple From or To nodes, create a relationship query for each combination
|
|
244
198
|
for from_node in self.contents.get_property_values_list(this_row, from_columns, self.primary_property, self.from_property, override_format='str'):
|
|
245
199
|
validated_csv_from_labels = lm.validate_labels(self.contents.get_column_values_list(this_row, from_label_columns))
|
|
246
|
-
|
|
247
|
-
|
|
200
|
+
from_labels = lm.sort_relationship_labels(self.required_labels + self.from_required_labels, validated_csv_from_labels)
|
|
201
|
+
from_node_labels = lm.merge_node_labels(from_labels, from_node.labels)
|
|
248
202
|
for to_node in self.contents.get_property_values_list(this_row, to_columns, self.primary_property, self.to_property, override_format='str'):
|
|
249
203
|
validated_csv_to_labels = lm.validate_labels(self.contents.get_column_values_list(this_row, to_label_columns))
|
|
250
|
-
|
|
251
|
-
|
|
204
|
+
to_labels = lm.sort_relationship_labels(self.required_labels + self.to_required_labels, validated_csv_to_labels)
|
|
205
|
+
to_node_labels = lm.merge_node_labels(to_labels, to_node.labels)
|
|
252
206
|
|
|
253
207
|
# Build a MERGE query for the relationship(s)
|
|
254
208
|
for relationship in relationships:
|
|
@@ -264,7 +218,7 @@ class RelationshipFileProcessor:
|
|
|
264
218
|
|
|
265
219
|
query_data_list = []
|
|
266
220
|
for count in range(max(len(param_from_nodes), len(param_to_nodes), len(param_explicit_props), len(param_calc_props))):
|
|
267
|
-
new_labels_list = [[
|
|
221
|
+
new_labels_list = [[from_node_labels, to_node_labels, relation, from_node.key, to_node.key, param_calc_props[min(count, len(param_calc_props) - 1)]]]
|
|
268
222
|
query_data_list += [[param_from_nodes[min(count, len(param_from_nodes) - 1)].value.replace('\\\\n', '\n'), param_to_nodes[min(count, len(param_to_nodes) - 1)].value.replace('\\\\n', '\n'), param_explicit_props[min(count, len(param_explicit_props) - 1)], param_calc_props[min(count, len(param_calc_props) - 1)], time_now]]
|
|
269
223
|
|
|
270
224
|
# So now we know all about this particular update. Let's put it in the query dictionary
|
|
@@ -295,8 +249,6 @@ class RelationshipFileProcessor:
|
|
|
295
249
|
relationship = batch_keys[from_to_labels][2]
|
|
296
250
|
from_node = batch_keys[from_to_labels][3]
|
|
297
251
|
to_node = batch_keys[from_to_labels][4]
|
|
298
|
-
from_where = batch_keys[from_to_labels][5]
|
|
299
|
-
to_where = batch_keys[from_to_labels][6]
|
|
300
252
|
batch_num = 1
|
|
301
253
|
while batch_num <= num_batches:
|
|
302
254
|
if batch_num == num_batches:
|
|
@@ -337,13 +289,6 @@ class RelationshipFileProcessor:
|
|
|
337
289
|
.node(labels=from_labels, ref_name=from_ref, properties_literal=from_keys)
|
|
338
290
|
.match()
|
|
339
291
|
.node(labels=to_labels, ref_name=to_ref, properties_literal=to_keys)
|
|
340
|
-
)
|
|
341
|
-
|
|
342
|
-
where_literals = [i for i in [from_where, to_where] if i]
|
|
343
|
-
if where_literals:
|
|
344
|
-
query_text = query_text.where_literal(' AND '.join(where_literals))
|
|
345
|
-
|
|
346
|
-
query_text = (query_text
|
|
347
292
|
.merge()
|
|
348
293
|
.node(ref_name=from_ref)
|
|
349
294
|
.related_to(label=relationship, ref_name=relation_ref)
|
|
@@ -2,15 +2,20 @@ import datetime
|
|
|
2
2
|
import messages
|
|
3
3
|
import ast
|
|
4
4
|
import processors.propertymanager as pm
|
|
5
|
+
import processors.labelmanager as lm
|
|
5
6
|
from querymanager import QueryManager
|
|
6
7
|
|
|
7
8
|
class Neo4jProperty():
|
|
8
9
|
|
|
9
|
-
def __init__(self, key, value
|
|
10
|
+
def __init__(self, key, value=None, format=None, type=None, blank_override=False, labels=[]):
|
|
10
11
|
|
|
11
12
|
self.key = pm.validate_property(key)
|
|
12
13
|
# Sanitise the value
|
|
13
14
|
self.value = value.replace('\\', '\\\\').replace('\r', '\\r').replace('"', '\\"')
|
|
15
|
+
if labels == ['']:
|
|
16
|
+
self.labels = []
|
|
17
|
+
else:
|
|
18
|
+
self.labels = lm.validate_labels(labels)
|
|
14
19
|
|
|
15
20
|
if self.value == "":
|
|
16
21
|
if blank_override:
|
|
@@ -20,8 +25,6 @@ class Neo4jProperty():
|
|
|
20
25
|
self.format = format
|
|
21
26
|
# type is the kind of thing this is, such as ID, START_ID etc. See assetmodelutilities.py for the full list
|
|
22
27
|
self.type = type
|
|
23
|
-
# Optional inline label selector used when matching nodes from csv values such as key::value::labelA|labelB
|
|
24
|
-
self.match_labels = match_labels
|
|
25
28
|
|
|
26
29
|
# We'll format the value the first time someone wants it, so say it's not formatted yet
|
|
27
30
|
self.formatted_values = {}
|
|
@@ -56,7 +59,7 @@ class Neo4jProperty():
|
|
|
56
59
|
|
|
57
60
|
def get_value(self, ref):
|
|
58
61
|
# Check to see if we have a formatted value, and if not do it now
|
|
59
|
-
if not
|
|
62
|
+
if ref not in self.formatted_values.keys():
|
|
60
63
|
self.formatted_values[ref] = format_value(self, ref)
|
|
61
64
|
|
|
62
65
|
return self.formatted_values[ref]
|
|
@@ -338,6 +341,7 @@ def format(properties, property_ref='', query_manager = None, section='DEFAULT')
|
|
|
338
341
|
return QueryManager.parameterise(query_manager, pair_data, section)
|
|
339
342
|
|
|
340
343
|
|
|
344
|
+
|
|
341
345
|
def to_str(properties, comparison_operator: str = ':', boolean_operator: str = ',', property_ref='', key_ref='') -> str:
|
|
342
346
|
pairs = [f'{key_ref}{key.split(":")[0]}{comparison_operator}{Neo4jProperty(key, str(value)).get_value(property_ref)}' for key, value in properties.items()]
|
|
343
347
|
res = boolean_operator.join(pairs)
|
|
File without changes
|
{python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/README-nocli.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/local-tests/demo.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/pyproject.toml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_eigen_ingenuity_nocli-0.5.30b4 → python_eigen_ingenuity_nocli-0.5.30b5}/requirements.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|