dcicutils 8.8.6.1b10__tar.gz → 8.8.6.1b12__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/PKG-INFO +1 -1
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/command_utils.py +69 -1
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/portal_utils.py +9 -2
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/pyproject.toml +1 -1
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/LICENSE.txt +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/README.rst +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/__init__.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/base.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/beanstalk_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/bundle_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/captured_output.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/cloudformation_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/codebuild_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/common.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/contribution_scripts.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/contribution_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/creds_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/data_readers.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/data_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/datetime_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/deployment_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/diff_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/docker_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/ecr_scripts.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/ecr_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/ecs_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/env_base.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/env_manager.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/env_scripts.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/env_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/env_utils_legacy.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/es_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/exceptions.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/ff_mocks.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/ff_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/file_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/function_cache_decorator.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/glacier_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/http_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/jh_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/kibana/dashboards.json +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/kibana/readme.md +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/lang_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/license_policies/c4-infrastructure.jsonc +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/license_policies/c4-python-infrastructure.jsonc +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/license_policies/park-lab-common-server.jsonc +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/license_policies/park-lab-common.jsonc +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/license_policies/park-lab-gpl-pipeline.jsonc +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/license_policies/park-lab-pipeline.jsonc +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/license_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/log_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/misc_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/obfuscation_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/opensearch_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/portal_object_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/progress_bar.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/project_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/qa_checkers.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/qa_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/redis_tools.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/redis_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/s3_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/schema_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/scripts/publish_to_pypi.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/scripts/run_license_checker.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/scripts/view_portal_object.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/secrets_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/sheet_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/snapshot_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/ssl_certificate_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/structured_data.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/submitr/progress_constants.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/submitr/ref_lookup_strategy.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/task_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/tmpfile_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/trace_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/validation_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/variant_utils.py +0 -0
- {dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/zip_utils.py +0 -0
@@ -1,3 +1,4 @@
|
|
1
|
+
from __future__ import annotations
|
1
2
|
import contextlib
|
2
3
|
import functools
|
3
4
|
import glob
|
@@ -7,7 +8,7 @@ import re
|
|
7
8
|
import requests
|
8
9
|
import subprocess
|
9
10
|
|
10
|
-
from typing import Optional
|
11
|
+
from typing import Callable, Optional
|
11
12
|
from .exceptions import InvalidParameterError
|
12
13
|
from .lang_utils import there_are
|
13
14
|
from .misc_utils import INPUT, PRINT, environ_bool, print_error_message, decorator
|
@@ -384,3 +385,70 @@ def script_catch_errors():
|
|
384
385
|
message = str(e) # Note: We ignore the type, which isn't intended to be shown.
|
385
386
|
PRINT(message)
|
386
387
|
exit(1)
|
388
|
+
|
389
|
+
|
390
|
+
class Question:
|
391
|
+
"""
|
392
|
+
Supports asking the user (via stdin) a yes/no question, possibly repeatedly; and after
|
393
|
+
some maximum number times of the same answer in a row (consecutively), then asks them
|
394
|
+
if they want to automatically give that same answer to any/all subsequent questions.
|
395
|
+
Supports static/global list of such Question instances, hashed (only) by the question text.
|
396
|
+
"""
|
397
|
+
_static_instances = {}
|
398
|
+
|
399
|
+
@staticmethod
|
400
|
+
def instance(question: Optional[str] = None,
|
401
|
+
max: Optional[int] = None, printf: Optional[Callable] = None) -> Question:
|
402
|
+
question = question if isinstance(question, str) else ""
|
403
|
+
if not (instance := Question._static_instances.get(question)):
|
404
|
+
Question._static_instances[question] = (instance := Question(question, max=max, printf=printf))
|
405
|
+
return instance
|
406
|
+
|
407
|
+
@staticmethod
|
408
|
+
def yes(question: Optional[str] = None,
|
409
|
+
max: Optional[int] = None, printf: Optional[Callable] = None) -> bool:
|
410
|
+
return Question.instance(question, max=max, printf=printf).ask()
|
411
|
+
|
412
|
+
def __init__(self, question: Optional[str] = None,
|
413
|
+
max: Optional[int] = None, printf: Optional[Callable] = None) -> None:
|
414
|
+
self._question = question if isinstance(question, str) else ""
|
415
|
+
self._max = max if isinstance(max, int) and max > 0 else None
|
416
|
+
self._print = printf if callable(printf) else print
|
417
|
+
self._yes_consecutive_count = 0
|
418
|
+
self._no_consecutive_count = 0
|
419
|
+
self._yes_automatic = False
|
420
|
+
self._no_automatic = False
|
421
|
+
|
422
|
+
def ask(self, question: Optional[str] = None) -> bool:
|
423
|
+
|
424
|
+
def question_automatic(value: str) -> bool:
|
425
|
+
nonlocal self
|
426
|
+
RARROW = "▶"
|
427
|
+
LARROW = "◀"
|
428
|
+
if yes_or_no(f"{RARROW}{RARROW}{RARROW}"
|
429
|
+
f" Do you want to answer {value} to all such questions?"
|
430
|
+
f" {LARROW}{LARROW}{LARROW}"):
|
431
|
+
return True
|
432
|
+
self._yes_consecutive_count = 0
|
433
|
+
self._no_consecutive_count = 0
|
434
|
+
|
435
|
+
if self._yes_automatic:
|
436
|
+
return True
|
437
|
+
elif self._no_automatic:
|
438
|
+
return False
|
439
|
+
elif yes_or_no((question if isinstance(question, str) else "") or self._question or "Undefined question"):
|
440
|
+
self._yes_consecutive_count += 1
|
441
|
+
self._no_consecutive_count = 0
|
442
|
+
if (self._no_consecutive_count == 0) and self._max and (self._yes_consecutive_count >= self._max):
|
443
|
+
# Have reached the maximum number of consecutive YES answers; ask if YES to all subsequent.
|
444
|
+
if question_automatic("YES"):
|
445
|
+
self._yes_automatic = True
|
446
|
+
return True
|
447
|
+
else:
|
448
|
+
self._no_consecutive_count += 1
|
449
|
+
self._yes_consecutive_count = 0
|
450
|
+
if (self._yes_consecutive_count == 0) and self._max and (self._no_consecutive_count >= self._max):
|
451
|
+
# Have reached the maximum number of consecutive NO answers; ask if NO to all subsequent.
|
452
|
+
if question_automatic("NO"):
|
453
|
+
self._no_automatic = True
|
454
|
+
return False
|
@@ -407,6 +407,7 @@ class Portal:
|
|
407
407
|
|
408
408
|
@function_cache(maxsize=100, serialize_key=True)
|
409
409
|
def get_identifying_paths(self, portal_object: dict, portal_type: Optional[Union[str, dict]] = None,
|
410
|
+
first_only: bool = False,
|
410
411
|
lookup_strategy: Optional[Union[Callable, bool]] = None) -> List[str]:
|
411
412
|
"""
|
412
413
|
Returns the list of the identifying Portal (URL) paths for the given Portal object. Favors any uuid
|
@@ -467,7 +468,10 @@ class Portal:
|
|
467
468
|
# And note the disction of just using /{uuid} here rather than /{type}/{uuid} as in the else
|
468
469
|
# statement below is not really necessary; just here for emphasis that this is all that's needed.
|
469
470
|
#
|
470
|
-
|
471
|
+
if first_only is True:
|
472
|
+
results.append(f"/{portal_type}/{identifying_value}")
|
473
|
+
else:
|
474
|
+
results.append(f"/{identifying_value}")
|
471
475
|
elif isinstance(identifying_value, list):
|
472
476
|
for identifying_value_item in identifying_value:
|
473
477
|
if identifying_value_item:
|
@@ -497,12 +501,15 @@ class Portal:
|
|
497
501
|
if is_lookup_subtypes(lookup_options):
|
498
502
|
for subtype_name in self.get_schema_subtype_names(portal_type):
|
499
503
|
results.append(f"/{subtype_name}/{identifying_value}")
|
504
|
+
if (first_only is True) and results:
|
505
|
+
return results
|
500
506
|
return results
|
501
507
|
|
502
508
|
@function_cache(maxsize=100, serialize_key=True)
|
503
509
|
def get_identifying_path(self, portal_object: dict, portal_type: Optional[Union[str, dict]] = None,
|
504
510
|
lookup_strategy: Optional[Union[Callable, bool]] = None) -> Optional[str]:
|
505
|
-
if identifying_paths := self.get_identifying_paths(portal_object, portal_type,
|
511
|
+
if identifying_paths := self.get_identifying_paths(portal_object, portal_type, first_only=True,
|
512
|
+
lookup_strategy=lookup_strategy):
|
506
513
|
return identifying_paths[0]
|
507
514
|
return None
|
508
515
|
|
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
|
File without changes
|
{dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/license_policies/c4-infrastructure.jsonc
RENAMED
File without changes
|
File without changes
|
File without changes
|
{dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/license_policies/park-lab-common.jsonc
RENAMED
File without changes
|
{dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/dcicutils/license_policies/park-lab-gpl-pipeline.jsonc
RENAMED
File without changes
|
{dcicutils-8.8.6.1b10 → dcicutils-8.8.6.1b12}/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
|
File without changes
|