dcicutils 8.8.3.1b7__py3-none-any.whl → 8.8.3.1b8__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.
@@ -154,7 +154,32 @@ class StructuredDataSet:
154
154
 
155
155
  @property
156
156
  def resolved_refs_with_uuids(self) -> List[str]:
157
- return list([{"path": resolved_ref[0], "uuid": resolved_ref[1]} for resolved_ref in self._resolved_refs])
157
+ return list([{"path": resolved_ref[0],
158
+ "uuid": resolved_ref[1] if len(resolved_ref) >= 2 else None}
159
+ for resolved_ref in self._resolved_refs])
160
+
161
+ @property
162
+ def unchecked_refs(self) -> List[str]:
163
+ """
164
+ Returns list of unchecked (for existence) references, grouped by reference path;
165
+ each object in the list has a path property and a srcs property which is a list of
166
+ src objects containing the type, column and row of the reference to the reference.
167
+ Note that this is only populated if the norefs option is specified.
168
+ """
169
+ def load_json(value: str) -> Optional[dict]:
170
+ try:
171
+ return json.loads(value)
172
+ except Exception:
173
+ return None
174
+ result = []
175
+ if self._norefs:
176
+ for ref in self._resolved_refs:
177
+ if len(ref) >= 3 and (ref_path := ref[0]) and (ref_src := load_json(ref[2])):
178
+ if existing_ref := [item for item in result if item.get("path") == ref_path]:
179
+ existing_ref[0]["srcs"].append(ref_src)
180
+ else:
181
+ result.append({"path": ref_path, "srcs": [ref_src]})
182
+ return result
158
183
 
159
184
  @property
160
185
  def upload_files(self) -> List[str]:
@@ -653,10 +678,14 @@ class Schema(SchemaBase):
653
678
  def map_ref(value: str, link_to: str, portal: Optional[Portal], src: Optional[str]) -> Any:
654
679
  nonlocal self, typeinfo
655
680
  if self._norefs:
681
+ # Here the caller has specified the (StructuredDataSet) norefs option
682
+ # which means we do not check for the existence of references at all.
656
683
  if value:
657
- # Dump the src because this cannot add dictionary to a set; note that
658
- # this is ONLY used for smaht-submitr/submit-metadata-bundle --info --refs.
659
- self._resolved_refs.add((f"/{link_to}/{value}", json.dumps(src) if isinstance(src, dict) else None))
684
+ # Dump the src as a JSON string because a dictionary cannot be added to a set; note
685
+ # that this is ONLY used for smaht-submitr/submit-metadata-bundle --info --refs.
686
+ # This info can be gotten at using StructureDataSet.unchecked_refs.
687
+ self._resolved_refs.add((f"/{link_to}/{value}", None,
688
+ json.dumps(src) if isinstance(src, dict) else None))
660
689
  return value
661
690
  if not value:
662
691
  if (column := typeinfo.get("column")) and column in self.data.get("required", []):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcicutils
3
- Version: 8.8.3.1b7
3
+ Version: 8.8.3.1b8
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
@@ -63,7 +63,7 @@ dcicutils/secrets_utils.py,sha256=8dppXAsiHhJzI6NmOcvJV5ldvKkQZzh3Fl-cb8Wm7MI,19
63
63
  dcicutils/sheet_utils.py,sha256=VlmzteONW5VF_Q4vo0yA5vesz1ViUah1MZ_yA1rwZ0M,33629
64
64
  dcicutils/snapshot_utils.py,sha256=ymP7PXH6-yEiXAt75w0ldQFciGNqWBClNxC5gfX2FnY,22961
65
65
  dcicutils/ssl_certificate_utils.py,sha256=F0ifz_wnRRN9dfrfsz7aCp4UDLgHEY8LaK7PjnNvrAQ,9707
66
- dcicutils/structured_data.py,sha256=YCLGtjsCMXCm5ZM96aiTRQ9OPUuj0lK8O9vSkLx1gv8,58450
66
+ dcicutils/structured_data.py,sha256=Ho97KAqPgfn9QVfIMpjp0gS1FXLAnEJu6usdVi2lGHc,59927
67
67
  dcicutils/submitr/progress_constants.py,sha256=5bxyX77ql8qEJearfHEvsvXl7D0GuUODW0T65mbRmnE,2895
68
68
  dcicutils/submitr/ref_lookup_strategy.py,sha256=Js2cVznTmgjciLWBPLCvMiwLIHXjDn3jww-gJPjYuFw,3467
69
69
  dcicutils/task_utils.py,sha256=MF8ujmTD6-O2AC2gRGPHyGdUrVKgtr8epT5XU8WtNjk,8082
@@ -72,8 +72,8 @@ dcicutils/trace_utils.py,sha256=g8kwV4ebEy5kXW6oOrEAUsurBcCROvwtZqz9fczsGRE,1769
72
72
  dcicutils/validation_utils.py,sha256=cMZIU2cY98FYtzK52z5WUYck7urH6JcqOuz9jkXpqzg,14797
73
73
  dcicutils/variant_utils.py,sha256=2H9azNx3xAj-MySg-uZ2SFqbWs4kZvf61JnK6b-h4Qw,4343
74
74
  dcicutils/zip_utils.py,sha256=rnjNv_k6L9jT2SjDSgVXp4BEJYLtz9XN6Cl2Fy-tqnM,2027
75
- dcicutils-8.8.3.1b7.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
76
- dcicutils-8.8.3.1b7.dist-info/METADATA,sha256=v8fZzOT3EWHNMI-R_bT-jbA1LTjKnGd1LOGD_oLn1Yg,3356
77
- dcicutils-8.8.3.1b7.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
78
- dcicutils-8.8.3.1b7.dist-info/entry_points.txt,sha256=51Q4F_2V10L0282W7HFjP4jdzW4K8lnWDARJQVFy_hw,270
79
- dcicutils-8.8.3.1b7.dist-info/RECORD,,
75
+ dcicutils-8.8.3.1b8.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
76
+ dcicutils-8.8.3.1b8.dist-info/METADATA,sha256=saFsKdu4mbE4RBPh2331yy2nC-ZUcE5n3fT740wn9iY,3356
77
+ dcicutils-8.8.3.1b8.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
78
+ dcicutils-8.8.3.1b8.dist-info/entry_points.txt,sha256=51Q4F_2V10L0282W7HFjP4jdzW4K8lnWDARJQVFy_hw,270
79
+ dcicutils-8.8.3.1b8.dist-info/RECORD,,