dcicutils 8.7.1.1b2__tar.gz → 8.7.1.1b4__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/PKG-INFO +1 -1
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/data_readers.py +10 -2
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/portal_object_utils.py +17 -4
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/portal_utils.py +2 -2
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/structured_data.py +7 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/pyproject.toml +1 -1
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/LICENSE.txt +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/README.rst +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/__init__.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/base.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/beanstalk_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/bundle_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/cloudformation_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/codebuild_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/command_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/common.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/contribution_scripts.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/contribution_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/creds_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/data_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/deployment_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/diff_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/docker_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/ecr_scripts.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/ecr_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/ecs_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/env_base.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/env_manager.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/env_scripts.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/env_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/env_utils_legacy.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/es_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/exceptions.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/ff_mocks.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/ff_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/file_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/function_cache_decorator.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/glacier_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/jh_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/kibana/dashboards.json +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/kibana/readme.md +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/lang_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/license_policies/c4-infrastructure.jsonc +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/license_policies/c4-python-infrastructure.jsonc +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/license_policies/park-lab-common-server.jsonc +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/license_policies/park-lab-common.jsonc +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/license_policies/park-lab-gpl-pipeline.jsonc +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/license_policies/park-lab-pipeline.jsonc +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/license_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/log_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/misc_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/obfuscation_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/opensearch_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/project_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/qa_checkers.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/qa_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/redis_tools.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/redis_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/s3_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/schema_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/scripts/publish_to_pypi.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/scripts/run_license_checker.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/secrets_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/sheet_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/snapshot_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/ssl_certificate_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/task_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/tmpfile_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/trace_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/validation_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/variant_utils.py +0 -0
- {dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/zip_utils.py +0 -0
@@ -10,6 +10,9 @@ Excel = Type["Excel"]
|
|
10
10
|
|
11
11
|
class RowReader(abc.ABC):
|
12
12
|
|
13
|
+
CELL_DELETION_VALUES = ["*delete*"] # cell values(s) indicating property deletion
|
14
|
+
CELL_DELETION_SENTINEL = object() # special cell deletion sentinel value
|
15
|
+
|
13
16
|
def __init__(self):
|
14
17
|
self.header = None
|
15
18
|
self.row_number = 0
|
@@ -45,8 +48,13 @@ class RowReader(abc.ABC):
|
|
45
48
|
def is_terminating_row(self, row: Union[List[Optional[Any]], Tuple[Optional[Any]]]) -> bool:
|
46
49
|
return False
|
47
50
|
|
48
|
-
def cell_value(self, value: Optional[Any]) ->
|
49
|
-
|
51
|
+
def cell_value(self, value: Optional[Any]) -> str:
|
52
|
+
if value is None:
|
53
|
+
return ""
|
54
|
+
elif (value := str(value).strip()) in RowReader.CELL_DELETION_VALUES:
|
55
|
+
return RowReader.CELL_DELETION_SENTINEL
|
56
|
+
else:
|
57
|
+
return value
|
50
58
|
|
51
59
|
def open(self) -> None:
|
52
60
|
pass
|
@@ -1,6 +1,7 @@
|
|
1
1
|
from functools import lru_cache
|
2
2
|
import re
|
3
3
|
from typing import Any, Callable, List, Optional, Tuple, Type, Union
|
4
|
+
from dcicutils.data_readers import RowReader
|
4
5
|
from dcicutils.portal_utils import Portal
|
5
6
|
from dcicutils.schema_utils import Schema
|
6
7
|
|
@@ -157,21 +158,33 @@ class PortalObject:
|
|
157
158
|
return f"{_path}.{key}" if _path else key
|
158
159
|
def list_to_dictionary(value: list) -> dict: # noqa
|
159
160
|
result = {}
|
160
|
-
for index, item in enumerate(
|
161
|
+
for index, item in enumerate(value):
|
161
162
|
result[f"#{index}"] = item
|
162
163
|
return result
|
163
164
|
diffs = {}
|
164
165
|
for key in a:
|
165
166
|
path = key_to_path(key)
|
166
167
|
if key not in b:
|
167
|
-
|
168
|
+
if a[key] != RowReader.CELL_DELETION_SENTINEL:
|
169
|
+
diffs[path] = {"value": a[key], "creating_value": True}
|
168
170
|
else:
|
169
171
|
if isinstance(a[key], dict) and isinstance(b[key], dict):
|
170
172
|
diffs.update(PortalObject._compare(a[key], b[key], compare=compare, _path=path))
|
171
173
|
elif isinstance(a[key], list) and isinstance(b[key], list):
|
174
|
+
# Note that lists will be compared in order, which means the when dealing with
|
175
|
+
# insertions/deletions to/from the list, we my easily mistakenly regard elements
|
176
|
+
# of the list to be different when they are really the same, since they occupy
|
177
|
+
# different indices within the array. This is just a known restriction of this
|
178
|
+
# comparison functionality; and perhaps actually technically correct, but probably
|
179
|
+
# in practice, at the application/semantic level, we likely regard the order of
|
180
|
+
# lists as unimportant, and with a little more work here we could try to detect
|
181
|
+
# and exclude from the diffs for a list, those elements in the list which are
|
182
|
+
# equal to each other but which reside at different indices with then two lists.
|
172
183
|
diffs.update(PortalObject._compare(list_to_dictionary(a[key]),
|
173
184
|
list_to_dictionary(b[key]), compare=compare, _path=path))
|
174
185
|
elif a[key] != b[key]:
|
175
|
-
if
|
176
|
-
diffs[path] = {"value":
|
186
|
+
if a[key] == RowReader.CELL_DELETION_SENTINEL:
|
187
|
+
diffs[path] = {"value": b[key], "deleting_value": True}
|
188
|
+
elif not callable(compare) or not compare(path, a[key], b[key]):
|
189
|
+
diffs[path] = {"value": a[key], "updating_value": b[key]}
|
177
190
|
return diffs
|
@@ -264,12 +264,12 @@ class Portal:
|
|
264
264
|
add_on = ""
|
265
265
|
return get_metadata(obj_id=object_id, vapp=self.vapp, key=self.key, add_on=add_on)
|
266
266
|
|
267
|
-
def patch_metadata(self, object_id: str, data:
|
267
|
+
def patch_metadata(self, object_id: str, data: dict) -> Optional[dict]:
|
268
268
|
if self.key:
|
269
269
|
return patch_metadata(obj_id=object_id, patch_item=data, key=self.key)
|
270
270
|
return self.patch(f"/{object_id}", data).json()
|
271
271
|
|
272
|
-
def post_metadata(self, object_type: str, data:
|
272
|
+
def post_metadata(self, object_type: str, data: dict) -> Optional[dict]:
|
273
273
|
if self.key:
|
274
274
|
return post_metadata(schema_name=object_type, post_item=data, key=self.key)
|
275
275
|
return self.post(f"/{object_type}", data).json()
|
@@ -64,6 +64,12 @@ class StructuredDataSet:
|
|
64
64
|
return StructuredDataSet(file=file, portal=portal, schemas=schemas, autoadd=autoadd, order=order, prune=prune)
|
65
65
|
|
66
66
|
def validate(self, force: bool = False) -> None:
|
67
|
+
def data_without_deleted_properties(data: dict) -> dict:
|
68
|
+
nonlocal self
|
69
|
+
if self._prune:
|
70
|
+
return {key: value for key, value in data.items() if value != RowReader.CELL_DELETION_SENTINEL}
|
71
|
+
else:
|
72
|
+
return {key: "" if value == RowReader.CELL_DELETION_SENTINEL else value for key, value in data.items()}
|
67
73
|
if self._validated and not force:
|
68
74
|
return
|
69
75
|
self._validated = True
|
@@ -71,6 +77,7 @@ class StructuredDataSet:
|
|
71
77
|
if (schema := Schema.load_by_name(type_name, portal=self._portal)):
|
72
78
|
row_number = 0
|
73
79
|
for data in self.data[type_name]:
|
80
|
+
data = data_without_deleted_properties(data)
|
74
81
|
row_number += 1
|
75
82
|
if (validation_errors := schema.validate(data)) is not None:
|
76
83
|
for validation_error in validation_errors:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "dcicutils"
|
3
|
-
version = "8.7.1.
|
3
|
+
version = "8.7.1.1b4" # TODO: To become 8.7.2
|
4
4
|
description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources"
|
5
5
|
authors = ["4DN-DCIC Team <support@4dnucleome.org>"]
|
6
6
|
license = "MIT"
|
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
|
{dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/license_policies/c4-infrastructure.jsonc
RENAMED
File without changes
|
File without changes
|
{dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/license_policies/park-lab-common-server.jsonc
RENAMED
File without changes
|
{dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/license_policies/park-lab-common.jsonc
RENAMED
File without changes
|
{dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/license_policies/park-lab-gpl-pipeline.jsonc
RENAMED
File without changes
|
{dcicutils-8.7.1.1b2 → dcicutils-8.7.1.1b4}/dcicutils/license_policies/park-lab-pipeline.jsonc
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
|