dcicutils 8.8.3.1b1__tar.gz → 8.8.3.1b2__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/PKG-INFO +1 -1
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/captured_output.py +18 -2
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/progress_bar.py +19 -7
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/structured_data.py +3 -1
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/pyproject.toml +1 -1
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/LICENSE.txt +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/README.rst +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/__init__.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/base.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/beanstalk_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/bundle_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/cloudformation_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/codebuild_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/command_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/common.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/contribution_scripts.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/contribution_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/creds_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/data_readers.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/data_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/datetime_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/deployment_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/diff_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/docker_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/ecr_scripts.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/ecr_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/ecs_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/env_base.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/env_manager.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/env_scripts.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/env_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/env_utils_legacy.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/es_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/exceptions.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/ff_mocks.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/ff_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/file_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/function_cache_decorator.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/glacier_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/jh_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/kibana/dashboards.json +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/kibana/readme.md +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/lang_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/license_policies/c4-infrastructure.jsonc +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/license_policies/c4-python-infrastructure.jsonc +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/license_policies/park-lab-common-server.jsonc +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/license_policies/park-lab-common.jsonc +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/license_policies/park-lab-gpl-pipeline.jsonc +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/license_policies/park-lab-pipeline.jsonc +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/license_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/log_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/misc_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/obfuscation_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/opensearch_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/portal_object_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/portal_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/project_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/qa_checkers.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/qa_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/redis_tools.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/redis_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/s3_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/schema_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/scripts/publish_to_pypi.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/scripts/run_license_checker.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/scripts/view_portal_object.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/secrets_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/sheet_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/snapshot_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/ssl_certificate_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/submitr/progress_constants.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/submitr/ref_lookup_strategy.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/task_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/tmpfile_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/trace_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/validation_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/variant_utils.py +0 -0
- {dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/zip_utils.py +0 -0
@@ -9,7 +9,7 @@ _real_stderr = sys.stderr
|
|
9
9
|
|
10
10
|
|
11
11
|
@contextmanager
|
12
|
-
def captured_output(capture: bool = True):
|
12
|
+
def captured_output(capture: bool = True, encoding: Optional[str] = None):
|
13
13
|
"""
|
14
14
|
Context manager to capture any/all output to stdout or stderr, and not actually output it to stdout
|
15
15
|
or stderr. Yields and object with a get_captured_output() method to get the output captured thus far,
|
@@ -24,7 +24,7 @@ def captured_output(capture: bool = True):
|
|
24
24
|
|
25
25
|
original_stdout = _real_stdout
|
26
26
|
original_stderr = _real_stderr
|
27
|
-
captured_output = io.StringIO()
|
27
|
+
captured_output = io.StringIO() if not encoding else _EncodedStringIO(encoding)
|
28
28
|
|
29
29
|
def set_original_output() -> None:
|
30
30
|
sys.stdout = original_stdout
|
@@ -68,3 +68,19 @@ def uncaptured_output():
|
|
68
68
|
finally:
|
69
69
|
sys.stdout = original_stdout
|
70
70
|
sys.stderr = original_stderr
|
71
|
+
|
72
|
+
|
73
|
+
class _EncodedStringIO:
|
74
|
+
def __init__(self, encoding: str = "utf-8"):
|
75
|
+
self.encoding = encoding
|
76
|
+
self.buffer = io.BytesIO()
|
77
|
+
def write(self, s): # noqa
|
78
|
+
self.buffer.write(s.encode(self.encoding))
|
79
|
+
def flush(self): # noqa
|
80
|
+
self.buffer.flush()
|
81
|
+
def getvalue(self): # noqa
|
82
|
+
return self.buffer.getvalue().decode(self.encoding)
|
83
|
+
def __str__(self): # noqa
|
84
|
+
return self.getvalue()
|
85
|
+
def __repr__(self): # noqa
|
86
|
+
return repr(self.getvalue())
|
@@ -5,7 +5,7 @@ import threading
|
|
5
5
|
import time
|
6
6
|
from tqdm import tqdm
|
7
7
|
from types import FrameType as frame
|
8
|
-
from typing import Callable, Optional, Union
|
8
|
+
from typing import Callable, List, Optional, Union
|
9
9
|
from contextlib import contextmanager
|
10
10
|
from dcicutils.command_utils import yes_or_no
|
11
11
|
|
@@ -54,12 +54,11 @@ class ProgressBar:
|
|
54
54
|
interrupt_exit: bool = False,
|
55
55
|
interrupt_exit_message: Optional[Union[Callable, str]] = None,
|
56
56
|
interrupt_message: Optional[str] = None,
|
57
|
-
|
58
|
-
|
57
|
+
tidy_output_hack: bool = True,
|
58
|
+
capture_output_for_testing: bool = False) -> None:
|
59
59
|
self._bar = None
|
60
60
|
self._disabled = False
|
61
61
|
self._done = False
|
62
|
-
self._printf = printf if callable(printf) else print
|
63
62
|
self._tidy_output_hack = (tidy_output_hack is True)
|
64
63
|
self._started = time.time()
|
65
64
|
self._stop_requested = False
|
@@ -90,7 +89,7 @@ class ProgressBar:
|
|
90
89
|
self._tidy_output_hack = self._define_tidy_output_hack()
|
91
90
|
self._total = total if isinstance(total, int) and total >= 0 else 0
|
92
91
|
self._description = self._format_description(description)
|
93
|
-
|
92
|
+
self._captured_output_for_testing = [] if capture_output_for_testing else None
|
94
93
|
|
95
94
|
def _initialize(self) -> bool:
|
96
95
|
# Do not actually create the tqdm object unless/until we have a positive total.
|
@@ -197,6 +196,10 @@ class ProgressBar:
|
|
197
196
|
def duration(self) -> None:
|
198
197
|
return time.time() - self._started
|
199
198
|
|
199
|
+
@property
|
200
|
+
def captured_output_for_testing(self) -> Optional[List[str]]:
|
201
|
+
return self._captured_output_for_testing
|
202
|
+
|
200
203
|
def _format_description(self, value: str) -> str:
|
201
204
|
if not isinstance(value, str):
|
202
205
|
value = ""
|
@@ -209,7 +212,7 @@ class ProgressBar:
|
|
209
212
|
nonlocal self
|
210
213
|
def handle_secondary_interrupt(signum: int, frame: frame) -> None: # noqa
|
211
214
|
nonlocal self
|
212
|
-
|
215
|
+
print("\nEnter 'yes' or 'no' or CTRL-\\ to completely abort ...")
|
213
216
|
self.disable()
|
214
217
|
self._interrupt(self) if self._interrupt else None
|
215
218
|
set_interrupt_handler(handle_secondary_interrupt)
|
@@ -226,7 +229,7 @@ class ProgressBar:
|
|
226
229
|
restore_interrupt_handler()
|
227
230
|
if self._interrupt_exit_message:
|
228
231
|
if isinstance(interrupt_exit_message := self._interrupt_exit_message(self), str):
|
229
|
-
|
232
|
+
print(interrupt_exit_message)
|
230
233
|
exit(1)
|
231
234
|
elif interrupt_stop is False or ((interrupt_stop is None) and (self._interrupt_exit is False)):
|
232
235
|
set_interrupt_handler(handle_interrupt)
|
@@ -261,6 +264,12 @@ class ProgressBar:
|
|
261
264
|
nonlocal self, sys_stdout_write, sentinel_internal, spina, spini, spinn
|
262
265
|
def replace_first(value: str, match: str, replacement: str) -> str: # noqa
|
263
266
|
return value[:i] + replacement + value[i + len(match):] if (i := value.find(match)) >= 0 else value
|
267
|
+
def remove_extra_trailing_spaces(text: str) -> str: # noqa
|
268
|
+
while text.endswith(" "):
|
269
|
+
text = text[:-1]
|
270
|
+
return text
|
271
|
+
if not text:
|
272
|
+
return
|
264
273
|
if (self._disabled or self._done) and sentinel_internal in text:
|
265
274
|
# Another hack to really disable output on interrupt; in this case we set
|
266
275
|
# tqdm.disable to True, but output can still dribble out, so if the output
|
@@ -270,11 +279,14 @@ class ProgressBar:
|
|
270
279
|
spinc = spina[spini % spinn] if not ("100%|" in text) else "| ✓" ; spini += 1 # noqa
|
271
280
|
text = replace_first(text, sentinel_internal, f" {spinc}")
|
272
281
|
text = replace_first(text, "%|", "% ◀|")
|
282
|
+
text = remove_extra_trailing_spaces(text)
|
273
283
|
# Another oddity: for the rate sometimes tqdm intermittently prints
|
274
284
|
# something like "1.54s/" rather than "1.54/s"; something to do with
|
275
285
|
# the unit we gave, which is empty; idunno; just replace it here.
|
276
286
|
text = replace_first(text, "s/ ", "/s ")
|
277
287
|
sys_stdout_write(text)
|
288
|
+
if self._captured_output_for_testing is not None:
|
289
|
+
self._captured_output_for_testing.append(text)
|
278
290
|
sys.stdout.flush()
|
279
291
|
def restore_stdout_write() -> None: # noqa
|
280
292
|
nonlocal sys_stdout_write
|
@@ -654,7 +654,9 @@ class Schema(SchemaBase):
|
|
654
654
|
nonlocal self, typeinfo
|
655
655
|
if self._norefs:
|
656
656
|
if value:
|
657
|
-
|
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))
|
658
660
|
return value
|
659
661
|
if not value:
|
660
662
|
if (column := typeinfo.get("column")) and column in self.data.get("required", []):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "dcicutils"
|
3
|
-
version = "8.8.3.
|
3
|
+
version = "8.8.3.1b2" # TODO: To become 8.8.4
|
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
|
File without changes
|
File without changes
|
{dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/license_policies/c4-infrastructure.jsonc
RENAMED
File without changes
|
File without changes
|
{dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/license_policies/park-lab-common-server.jsonc
RENAMED
File without changes
|
{dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/license_policies/park-lab-common.jsonc
RENAMED
File without changes
|
{dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/dcicutils/license_policies/park-lab-gpl-pipeline.jsonc
RENAMED
File without changes
|
{dcicutils-8.8.3.1b1 → dcicutils-8.8.3.1b2}/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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|