dcicutils 8.8.0.1b11__py3-none-any.whl → 8.8.0.1b13__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.
@@ -6,6 +6,7 @@ import os
6
6
  from pyramid.router import Router
7
7
  import re
8
8
  import sys
9
+ import time
9
10
  from tqdm import tqdm
10
11
  from typing import Any, Callable, List, Optional, Tuple, Type, Union
11
12
  from webtest.app import TestApp
@@ -69,7 +70,8 @@ class StructuredDataSet:
69
70
  order: Optional[List[str]] = None, prune: bool = True,
70
71
  ref_lookup_strategy: Optional[Callable] = None,
71
72
  ref_lookup_nocache: bool = False,
72
- progress: bool = False) -> None:
73
+ progress: bool = False,
74
+ debug_sleep: Optional[str] = None) -> None:
73
75
  progress = False
74
76
  self._progress = progress
75
77
  self._data = {}
@@ -83,6 +85,12 @@ class StructuredDataSet:
83
85
  self._resolved_refs = set()
84
86
  self._validated = False
85
87
  self._autoadd_properties = autoadd if isinstance(autoadd, dict) and autoadd else None
88
+ self._debug_sleep = None
89
+ if debug_sleep:
90
+ try:
91
+ self._debug_sleep = float(debug_sleep)
92
+ except Exception:
93
+ self._debug_sleep = None
86
94
  self._load_file(file) if file else None
87
95
 
88
96
  def _progress_add(self, amount: Union[int, Callable]) -> None:
@@ -113,9 +121,10 @@ class StructuredDataSet:
113
121
  schemas: Optional[List[dict]] = None, autoadd: Optional[dict] = None,
114
122
  order: Optional[List[str]] = None, prune: bool = True,
115
123
  ref_lookup_strategy: Optional[Callable] = None,
116
- ref_lookup_nocache: bool = False) -> StructuredDataSet:
124
+ ref_lookup_nocache: bool = False, debug_sleep: Optional[str] = None) -> StructuredDataSet:
117
125
  return StructuredDataSet(file=file, portal=portal, schemas=schemas, autoadd=autoadd, order=order, prune=prune,
118
- ref_lookup_strategy=ref_lookup_strategy, ref_lookup_nocache=ref_lookup_nocache)
126
+ ref_lookup_strategy=ref_lookup_strategy, ref_lookup_nocache=ref_lookup_nocache,
127
+ debug_sleep=debug_sleep)
119
128
 
120
129
  def validate(self, force: bool = False) -> None:
121
130
  def data_without_deleted_properties(data: dict) -> dict:
@@ -205,7 +214,7 @@ class StructuredDataSet:
205
214
  diffs[object_type].append(create_readonly_object(path=identifying_path,
206
215
  uuid=existing_object.uuid,
207
216
  diffs=object_diffs or None))
208
- else:
217
+ elif identifying_path:
209
218
  # If there is no existing object we still create a record for this object
210
219
  # but with no uuid which will be the indication that it does not exist.
211
220
  diffs[object_type].append(create_readonly_object(path=identifying_path, uuid=None, diffs=None))
@@ -278,6 +287,8 @@ class StructuredDataSet:
278
287
  noschema = False
279
288
  structured_row_template = None
280
289
  for row in reader:
290
+ if self._debug_sleep:
291
+ time.sleep(float(self._debug_sleep))
281
292
  if not structured_row_template: # Delay creation just so we don't reference schema if there are no rows.
282
293
  if not schema and not noschema and not (schema := Schema.load_by_name(type_name, portal=self._portal)):
283
294
  noschema = True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcicutils
3
- Version: 8.8.0.1b11
3
+ Version: 8.8.0.1b13
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
@@ -62,15 +62,15 @@ dcicutils/secrets_utils.py,sha256=8dppXAsiHhJzI6NmOcvJV5ldvKkQZzh3Fl-cb8Wm7MI,19
62
62
  dcicutils/sheet_utils.py,sha256=VlmzteONW5VF_Q4vo0yA5vesz1ViUah1MZ_yA1rwZ0M,33629
63
63
  dcicutils/snapshot_utils.py,sha256=ymP7PXH6-yEiXAt75w0ldQFciGNqWBClNxC5gfX2FnY,22961
64
64
  dcicutils/ssl_certificate_utils.py,sha256=F0ifz_wnRRN9dfrfsz7aCp4UDLgHEY8LaK7PjnNvrAQ,9707
65
- dcicutils/structured_data.py,sha256=mUk6NNyhgpjx9Vte3KS5sLGByJiTh4DsqutvdFyVVgE,52537
65
+ dcicutils/structured_data.py,sha256=72nX3ijfc2QACqfyjWFlQIX-VX1B8RPRc4GA-Ly2G5E,52998
66
66
  dcicutils/task_utils.py,sha256=MF8ujmTD6-O2AC2gRGPHyGdUrVKgtr8epT5XU8WtNjk,8082
67
67
  dcicutils/tmpfile_utils.py,sha256=n95XF8dZVbQRSXBZTGToXXfSs3JUVRyN6c3ZZ0nhAWI,1403
68
68
  dcicutils/trace_utils.py,sha256=g8kwV4ebEy5kXW6oOrEAUsurBcCROvwtZqz9fczsGRE,1769
69
69
  dcicutils/validation_utils.py,sha256=cMZIU2cY98FYtzK52z5WUYck7urH6JcqOuz9jkXpqzg,14797
70
70
  dcicutils/variant_utils.py,sha256=2H9azNx3xAj-MySg-uZ2SFqbWs4kZvf61JnK6b-h4Qw,4343
71
71
  dcicutils/zip_utils.py,sha256=rnjNv_k6L9jT2SjDSgVXp4BEJYLtz9XN6Cl2Fy-tqnM,2027
72
- dcicutils-8.8.0.1b11.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
73
- dcicutils-8.8.0.1b11.dist-info/METADATA,sha256=FngKaVgxXMIK9eHOhFlx_ESyz9NgJaihgNCKqHZem9g,3357
74
- dcicutils-8.8.0.1b11.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
75
- dcicutils-8.8.0.1b11.dist-info/entry_points.txt,sha256=51Q4F_2V10L0282W7HFjP4jdzW4K8lnWDARJQVFy_hw,270
76
- dcicutils-8.8.0.1b11.dist-info/RECORD,,
72
+ dcicutils-8.8.0.1b13.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
73
+ dcicutils-8.8.0.1b13.dist-info/METADATA,sha256=_QuHO_XVPM0VCTHDGz89YJGi4cAf4ApoaPZCGJW8rgU,3357
74
+ dcicutils-8.8.0.1b13.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
75
+ dcicutils-8.8.0.1b13.dist-info/entry_points.txt,sha256=51Q4F_2V10L0282W7HFjP4jdzW4K8lnWDARJQVFy_hw,270
76
+ dcicutils-8.8.0.1b13.dist-info/RECORD,,