dcicutils 8.8.0.1b23__tar.gz → 8.8.0.1b24__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/PKG-INFO +1 -1
  2. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/portal_object_utils.py +7 -6
  3. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/portal_utils.py +1 -1
  4. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/structured_data.py +29 -15
  5. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/pyproject.toml +1 -1
  6. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/LICENSE.txt +0 -0
  7. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/README.rst +0 -0
  8. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/__init__.py +0 -0
  9. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/base.py +0 -0
  10. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/beanstalk_utils.py +0 -0
  11. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/bundle_utils.py +0 -0
  12. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/captured_output.py +0 -0
  13. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/cloudformation_utils.py +0 -0
  14. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/codebuild_utils.py +0 -0
  15. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/command_utils.py +0 -0
  16. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/common.py +0 -0
  17. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/contribution_scripts.py +0 -0
  18. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/contribution_utils.py +0 -0
  19. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/creds_utils.py +0 -0
  20. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/data_readers.py +0 -0
  21. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/data_utils.py +0 -0
  22. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/datetime_utils.py +0 -0
  23. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/deployment_utils.py +0 -0
  24. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/diff_utils.py +0 -0
  25. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/docker_utils.py +0 -0
  26. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/ecr_scripts.py +0 -0
  27. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/ecr_utils.py +0 -0
  28. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/ecs_utils.py +0 -0
  29. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/env_base.py +0 -0
  30. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/env_manager.py +0 -0
  31. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/env_scripts.py +0 -0
  32. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/env_utils.py +0 -0
  33. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/env_utils_legacy.py +0 -0
  34. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/es_utils.py +0 -0
  35. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/exceptions.py +0 -0
  36. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/ff_mocks.py +0 -0
  37. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/ff_utils.py +0 -0
  38. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/file_utils.py +0 -0
  39. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/function_cache_decorator.py +0 -0
  40. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/glacier_utils.py +0 -0
  41. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/jh_utils.py +0 -0
  42. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/kibana/dashboards.json +0 -0
  43. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/kibana/readme.md +0 -0
  44. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/lang_utils.py +0 -0
  45. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/license_policies/c4-infrastructure.jsonc +0 -0
  46. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/license_policies/c4-python-infrastructure.jsonc +0 -0
  47. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/license_policies/park-lab-common-server.jsonc +0 -0
  48. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/license_policies/park-lab-common.jsonc +0 -0
  49. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/license_policies/park-lab-gpl-pipeline.jsonc +0 -0
  50. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/license_policies/park-lab-pipeline.jsonc +0 -0
  51. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/license_utils.py +0 -0
  52. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/log_utils.py +0 -0
  53. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/misc_utils.py +0 -0
  54. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/obfuscation_utils.py +0 -0
  55. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/opensearch_utils.py +0 -0
  56. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/project_utils.py +0 -0
  57. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/qa_checkers.py +0 -0
  58. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/qa_utils.py +0 -0
  59. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/redis_tools.py +0 -0
  60. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/redis_utils.py +0 -0
  61. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/s3_utils.py +0 -0
  62. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/schema_utils.py +0 -0
  63. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/scripts/publish_to_pypi.py +0 -0
  64. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/scripts/run_license_checker.py +0 -0
  65. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/scripts/view_portal_object.py +0 -0
  66. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/secrets_utils.py +0 -0
  67. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/sheet_utils.py +0 -0
  68. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/snapshot_utils.py +0 -0
  69. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/ssl_certificate_utils.py +0 -0
  70. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/task_utils.py +0 -0
  71. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/tmpfile_utils.py +0 -0
  72. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/trace_utils.py +0 -0
  73. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/validation_utils.py +0 -0
  74. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/variant_utils.py +0 -0
  75. {dcicutils-8.8.0.1b23 → dcicutils-8.8.0.1b24}/dcicutils/zip_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcicutils
3
- Version: 8.8.0.1b23
3
+ Version: 8.8.0.1b24
4
4
  Summary: Utility package for interacting with the 4DN Data Portal and other 4DN resources
5
5
  Home-page: https://github.com/4dn-dcic/utils
6
6
  License: MIT
@@ -99,7 +99,8 @@ class PortalObject:
99
99
  def compare(self, value: Union[dict, PortalObject],
100
100
  consider_refs: bool = False, resolved_refs: List[dict] = None) -> Tuple[dict, int]:
101
101
  if consider_refs and isinstance(resolved_refs, list):
102
- this_data, nlookups = self._normalized_refs(refs=resolved_refs).data
102
+ normlized_portal_object, nlookups = self._normalized_refs(refs=resolved_refs)
103
+ this_data = normlized_portal_object.data
103
104
  else:
104
105
  this_data = self.data
105
106
  nlookups = 0
@@ -213,7 +214,7 @@ class PortalObject:
213
214
  if Portal.is_lookup_root(lookup_options) and not Portal.is_lookup_root_first(lookup_options):
214
215
  identifying_paths.append(f"/{identifying_value}")
215
216
  if Portal.is_lookup_subtypes(lookup_options):
216
- for subtype_name in self._portal.get_schemas_subtype_names():
217
+ for subtype_name in self._portal.get_schema_subtype_names(self.type):
217
218
  identifying_paths.append(f"/{subtype_name}/{identifying_value}")
218
219
  return identifying_paths or None
219
220
 
@@ -249,13 +250,13 @@ class PortalObject:
249
250
  if isinstance(value, dict):
250
251
  for key in value:
251
252
  path = f"{_path}.{key}" if _path else key
252
- value[key] = PortalObject._normalize_data_refs(value[key], refs=refs,
253
- schema=schema, portal=portal, _path=path)
253
+ value[key], nlookups = PortalObject._normalize_data_refs(value[key], refs=refs,
254
+ schema=schema, portal=portal, _path=path)
254
255
  elif isinstance(value, list):
255
256
  for index in range(len(value)):
256
257
  path = f"{_path or ''}#{index}"
257
- value[index] = PortalObject._normalize_data_refs(value[index], refs=refs,
258
- schema=schema, portal=portal, _path=path)
258
+ value[index], nlookups = PortalObject._normalize_data_refs(value[index], refs=refs,
259
+ schema=schema, portal=portal, _path=path)
259
260
  elif value_type := Schema.get_property_by_path(schema, _path):
260
261
  if link_to := value_type.get("linkTo"):
261
262
  ref_path = f"/{link_to}/{value}"
@@ -398,7 +398,7 @@ class Portal:
398
398
  return super_type_map_flattened
399
399
 
400
400
  @lru_cache(maxsize=64)
401
- def get_schemas_subtype_names(self, type_name: str) -> List[str]:
401
+ def get_schema_subtype_names(self, type_name: str) -> List[str]:
402
402
  if not (schemas_super_type_map := self.get_schemas_super_type_map()):
403
403
  return []
404
404
  return schemas_super_type_map.get(type_name, [])
@@ -222,6 +222,9 @@ class StructuredDataSet:
222
222
  diffs[type_name].append(create_readonly_object(path=identifying_path, uuid=None, diffs=None))
223
223
  if callable(progress):
224
224
  progress({"create": True, "lookups": nlookups})
225
+ else:
226
+ if callable(progress):
227
+ progress({"lookups": nlookups})
225
228
  if callable(progress):
226
229
  progress({"finish": True})
227
230
  return diffs
@@ -257,7 +260,7 @@ class StructuredDataSet:
257
260
  self._load_reader(CsvReader(file), type_name=Schema.type_name(file))
258
261
 
259
262
  def _load_excel_file(self, file: str) -> None:
260
- def calculate_total_rows_to_process() -> Tuple[int, int]:
263
+ def get_counts() -> Tuple[int, int]:
261
264
  nonlocal file
262
265
  excel = Excel(file)
263
266
  nrows = 0
@@ -266,18 +269,27 @@ class StructuredDataSet:
266
269
  nrows += 1
267
270
  return nrows, len(excel.sheet_names)
268
271
  if self._progress:
269
- self._progress_update(calculate_total_rows_to_process)
272
+ nrows, nsheets = get_counts()
273
+ self._progress({"start": True, "sheets": nsheets, "rows": nrows})
274
+ """
275
+ if self._progress:
276
+ self._progress_update(get_counts)
277
+ """
270
278
  excel = Excel(file) # Order the sheet names by any specified ordering (e.g. ala snovault.loadxl).
271
279
  order = {Schema.type_name(key): index for index, key in enumerate(self._order)} if self._order else {}
272
280
  for sheet_name in sorted(excel.sheet_names, key=lambda key: order.get(Schema.type_name(key), sys.maxsize)):
273
281
  self._load_reader(excel.sheet_reader(sheet_name), type_name=Schema.type_name(sheet_name))
282
+ if self._progress:
283
+ self._progress({"finish": True})
284
+ # TODO: Do we really need progress reporting for the below?
274
285
  # Check for unresolved reference errors which really are not because of ordering.
275
286
  # Yes such internal references will be handled correctly on actual database update via snovault.loadxl.
276
287
  if ref_errors := self.ref_errors:
277
288
  ref_errors_actual = []
278
289
  for ref_error in ref_errors:
279
290
  if not (resolved := self.portal.ref_exists(ref := ref_error["error"])):
280
- # if not (resolved := self.portal.ref_exists_internally(ref := ref_error["error"])): # TODO
291
+ # TODO: Probably do this instead; and if so then no progress needed (per question above).
292
+ # if not (resolved := self.portal.ref_exists_internally(ref := ref_error["error"])):
281
293
  ref_errors_actual.append(ref_error)
282
294
  else:
283
295
  self._resolved_refs.add((ref, resolved.get("uuid")))
@@ -310,13 +322,15 @@ class StructuredDataSet:
310
322
  self._add_properties(structured_row, self._autoadd_properties, schema)
311
323
  self._add(type_name, structured_row)
312
324
  if self._progress:
313
- self._progress_update(-1,
314
- self.ref_total_count,
315
- self.ref_total_found_count,
316
- self.ref_total_notfound_count,
317
- self.ref_lookup_count,
318
- self.ref_lookup_cache_hit_count,
319
- self.ref_invalid_identifying_property_count)
325
+ self._progress({
326
+ "parse": True,
327
+ "refs": self.ref_total_count,
328
+ "refs_found": self.ref_total_found_count,
329
+ "refs_not_found": self.ref_total_notfound_count,
330
+ "refs_lookup": self.ref_lookup_count,
331
+ "refs_cache_hit": self.ref_lookup_cache_hit_count,
332
+ "refs_invalid": self.ref_invalid_identifying_property_count
333
+ })
320
334
  self._note_warning(reader.warnings, "reader")
321
335
  if schema:
322
336
  self._note_error(schema._unresolved_refs, "ref")
@@ -850,7 +864,7 @@ class Portal(PortalBase):
850
864
  return schemas
851
865
 
852
866
  @lru_cache(maxsize=64)
853
- def _get_schema_subtypes_names(self, type_name: str) -> List[str]:
867
+ def _get_schema_subtype_names(self, type_name: str) -> List[str]:
854
868
  if not (schemas_super_type_map := self.get_schemas_super_type_map()):
855
869
  return []
856
870
  return schemas_super_type_map.get(type_name, [])
@@ -913,7 +927,7 @@ class Portal(PortalBase):
913
927
  lookup_paths.append(f"/{type_name}/{value}")
914
928
  if is_ref_lookup_root and not is_ref_lookup_root_first:
915
929
  lookup_paths.append(f"/{value}")
916
- subtype_names = self._get_schema_subtypes_names(type_name) if is_ref_lookup_subtypes else []
930
+ subtype_names = self._get_schema_subtype_names(type_name) if is_ref_lookup_subtypes else []
917
931
  for subtype_name in subtype_names:
918
932
  lookup_paths.append(f"/{subtype_name}/{value}")
919
933
  if not lookup_paths:
@@ -952,7 +966,7 @@ class Portal(PortalBase):
952
966
  ref_lookup_strategy, ref_validator = (
953
967
  self._ref_lookup_strategy(type_name, self.get_schema(type_name), value))
954
968
  is_ref_lookup_subtypes = StructuredDataSet._is_ref_lookup_subtypes(ref_lookup_strategy)
955
- subtype_names = self._get_schema_subtypes_names(type_name) if is_ref_lookup_subtypes else []
969
+ subtype_names = self._get_schema_subtype_names(type_name) if is_ref_lookup_subtypes else []
956
970
  for type_name in [type_name] + subtype_names:
957
971
  is_resolved, resolved_item = self._ref_exists_single_internally(type_name, value)
958
972
  if is_resolved:
@@ -1014,7 +1028,7 @@ class Portal(PortalBase):
1014
1028
  if not is_uuid(property_value):
1015
1029
  return False
1016
1030
  return True
1017
- for schema_name in [type_name] + self._get_schema_subtypes_names(type_name):
1031
+ for schema_name in [type_name] + self._get_schema_subtype_names(type_name):
1018
1032
  if schema := self.get_schema(schema_name):
1019
1033
  if identifying_properties := schema.get("identifyingProperties"):
1020
1034
  for identifying_property in identifying_properties:
@@ -1039,7 +1053,7 @@ class Portal(PortalBase):
1039
1053
 
1040
1054
  def _cache_ref(self, type_name: str, value: str, resolved: List[str]) -> None:
1041
1055
  if self._ref_cache is not None:
1042
- subtype_names = self._get_schema_subtypes_names(type_name)
1056
+ subtype_names = self._get_schema_subtype_names(type_name)
1043
1057
  for type_name in [type_name] + subtype_names:
1044
1058
  self._ref_cache[f"/{type_name}/{value}"] = resolved
1045
1059
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "dcicutils"
3
- version = "8.8.0.1b23" # TODO: To become 8.8.1
3
+ version = "8.8.0.1b24" # TODO: To become 8.8.1
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"