dcicutils 8.7.2.1b1__tar.gz → 8.7.2.1b3__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/PKG-INFO +2 -1
- dcicutils-8.7.2.1b3/dcicutils/captured_output.py +70 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/data_readers.py +3 -2
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/datetime_utils.py +1 -1
- dcicutils-8.7.2.1b3/dcicutils/scripts/view_portal_object.py +155 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/structured_data.py +1 -1
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/pyproject.toml +3 -1
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/LICENSE.txt +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/README.rst +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/__init__.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/base.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/beanstalk_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/bundle_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/cloudformation_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/codebuild_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/command_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/common.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/contribution_scripts.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/contribution_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/creds_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/data_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/deployment_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/diff_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/docker_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/ecr_scripts.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/ecr_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/ecs_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/env_base.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/env_manager.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/env_scripts.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/env_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/env_utils_legacy.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/es_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/exceptions.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/ff_mocks.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/ff_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/file_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/function_cache_decorator.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/glacier_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/jh_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/kibana/dashboards.json +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/kibana/readme.md +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/lang_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/license_policies/c4-infrastructure.jsonc +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/license_policies/c4-python-infrastructure.jsonc +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/license_policies/park-lab-common-server.jsonc +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/license_policies/park-lab-common.jsonc +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/license_policies/park-lab-gpl-pipeline.jsonc +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/license_policies/park-lab-pipeline.jsonc +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/license_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/log_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/misc_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/obfuscation_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/opensearch_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/portal_object_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/portal_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/project_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/qa_checkers.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/qa_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/redis_tools.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/redis_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/s3_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/schema_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/scripts/publish_to_pypi.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/scripts/run_license_checker.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/secrets_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/sheet_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/snapshot_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/ssl_certificate_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/task_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/tmpfile_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/trace_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/validation_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/variant_utils.py +0 -0
- {dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/zip_utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: dcicutils
|
3
|
-
Version: 8.7.2.
|
3
|
+
Version: 8.7.2.1b3
|
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
|
@@ -36,6 +36,7 @@ Requires-Dist: jsonschema (>=4.19.0,<5.0.0)
|
|
36
36
|
Requires-Dist: openpyxl (>=3.1.2,<4.0.0)
|
37
37
|
Requires-Dist: opensearch-py (>=2.0.1,<3.0.0)
|
38
38
|
Requires-Dist: pyOpenSSL (>=23.1.1,<24.0.0)
|
39
|
+
Requires-Dist: pyperclip (>=1.8.2,<2.0.0)
|
39
40
|
Requires-Dist: pyramid (==1.10.4)
|
40
41
|
Requires-Dist: pytz (>=2020.4)
|
41
42
|
Requires-Dist: redis (>=4.5.1,<5.0.0)
|
@@ -0,0 +1,70 @@
|
|
1
|
+
from collections import namedtuple
|
2
|
+
from contextlib import contextmanager
|
3
|
+
import io
|
4
|
+
import sys
|
5
|
+
from typing import Optional
|
6
|
+
|
7
|
+
_real_stdout = sys.stdout
|
8
|
+
_real_stderr = sys.stderr
|
9
|
+
|
10
|
+
|
11
|
+
@contextmanager
|
12
|
+
def captured_output(capture: bool = True):
|
13
|
+
"""
|
14
|
+
Context manager to capture any/all output to stdout or stderr, and not actually output it to stdout
|
15
|
+
or stderr. Yields and object with a get_captured_output() method to get the output captured thus far,
|
16
|
+
and another uncaptured_print() method to actually print the given output to stdout, even though output
|
17
|
+
to stdout is being captured. Can be useful, for example, in creating command-line scripts which invoke
|
18
|
+
code which outputs a lot of info, warning, error, etc to stdout or stderr, and we want to suprress that
|
19
|
+
output; but with the yielded uncaptured_print() method output specific to the script can actually be
|
20
|
+
output (to stdout); and/or can also optionally output any/all captured output, e.g. for debugging or
|
21
|
+
troubleshooting purposes. Disable this capture, without having to restructure your code WRT the usage
|
22
|
+
of the with-clause with this context manager, pass False as an argument to this context manager.
|
23
|
+
"""
|
24
|
+
|
25
|
+
original_stdout = _real_stdout
|
26
|
+
original_stderr = _real_stderr
|
27
|
+
captured_output = io.StringIO()
|
28
|
+
|
29
|
+
def set_original_output() -> None:
|
30
|
+
sys.stdout = original_stdout
|
31
|
+
sys.stderr = original_stderr
|
32
|
+
|
33
|
+
def set_captured_output() -> None:
|
34
|
+
if capture:
|
35
|
+
sys.stdout = captured_output
|
36
|
+
sys.stderr = captured_output
|
37
|
+
|
38
|
+
def uncaptured_print(*args, **kwargs) -> None:
|
39
|
+
set_original_output()
|
40
|
+
print(*args, **kwargs)
|
41
|
+
set_captured_output()
|
42
|
+
|
43
|
+
def uncaptured_input(message: str) -> str:
|
44
|
+
set_original_output()
|
45
|
+
value = input(message)
|
46
|
+
set_captured_output()
|
47
|
+
return value
|
48
|
+
|
49
|
+
def get_captured_output() -> Optional[str]:
|
50
|
+
return captured_output.getvalue() if capture else None
|
51
|
+
|
52
|
+
try:
|
53
|
+
set_captured_output()
|
54
|
+
Result = namedtuple("Result", ["get_captured_output", "uncaptured_print", "uncaptured_input"])
|
55
|
+
yield Result(get_captured_output, uncaptured_print, uncaptured_input)
|
56
|
+
finally:
|
57
|
+
set_original_output()
|
58
|
+
|
59
|
+
|
60
|
+
@contextmanager
|
61
|
+
def uncaptured_output():
|
62
|
+
original_stdout = sys.stdout
|
63
|
+
original_stderr = sys.stderr
|
64
|
+
sys.stdout = _real_stdout
|
65
|
+
sys.stderr = _real_stderr
|
66
|
+
try:
|
67
|
+
yield
|
68
|
+
finally:
|
69
|
+
sys.stdout = original_stdout
|
70
|
+
sys.stderr = original_stderr
|
@@ -152,9 +152,10 @@ class ExcelSheetReader(RowReader):
|
|
152
152
|
|
153
153
|
class Excel:
|
154
154
|
|
155
|
-
def __init__(self, file: str, reader_class: Optional[Type] = None) -> None:
|
155
|
+
def __init__(self, file: str, reader_class: Optional[Type] = None, include_hidden_sheets: bool = False) -> None:
|
156
156
|
self._file = file
|
157
157
|
self._workbook = None
|
158
|
+
self._include_hidden_sheets = include_hidden_sheets
|
158
159
|
self.sheet_names = None
|
159
160
|
if isinstance(reader_class, Type) and issubclass(reader_class, ExcelSheetReader):
|
160
161
|
self._reader_class = reader_class
|
@@ -169,7 +170,7 @@ class Excel:
|
|
169
170
|
if self._workbook is None:
|
170
171
|
self._workbook = openpyxl.load_workbook(self._file, data_only=True)
|
171
172
|
self.sheet_names = [sheet_name for sheet_name in self._workbook.sheetnames
|
172
|
-
if self._workbook[sheet_name].sheet_state != "hidden"]
|
173
|
+
if self._include_hidden_sheets or (self._workbook[sheet_name].sheet_state != "hidden")]
|
173
174
|
|
174
175
|
def __del__(self) -> None:
|
175
176
|
if (workbook := self._workbook) is not None:
|
@@ -65,7 +65,7 @@ def normalize_datetime_string(value: str) -> Optional[str]:
|
|
65
65
|
or if ill-formated then returns None. The given string is assumed to be in the format "YYYY-MM-DD hh:mm:ss"
|
66
66
|
and with an optional timezone suffix in format "+hh:mm" or "+hh". Also allowed is just a date of the
|
67
67
|
format "YYYY-MM-DD" in which case a time of "00:00:00" is assumed. If no timezone is specified then
|
68
|
-
the local timezone is assumed.
|
68
|
+
the local timezone is assumed. The returned format looks like this: "2024-02-08T10:37:51-05:00"
|
69
69
|
"""
|
70
70
|
dt = parse_datetime_string(value)
|
71
71
|
return dt.isoformat() if dt else None
|
@@ -0,0 +1,155 @@
|
|
1
|
+
# ------------------------------------------------------------------------------------------------------
|
2
|
+
# Command-line utility to retrieve and print the given object (UUID) from a SMaHT/CGAP/Fourfront Portal.
|
3
|
+
# ------------------------------------------------------------------------------------------------------
|
4
|
+
# Example command:
|
5
|
+
# view-portal-object 4483b19d-62e7-4e7f-a211-0395343a35df --yaml
|
6
|
+
#
|
7
|
+
# Example output:
|
8
|
+
# '@context': /terms/
|
9
|
+
# '@id': /access-keys/3968e38e-c11f-472e-8531-8650e2e296d4/
|
10
|
+
# '@type':
|
11
|
+
# - AccessKey
|
12
|
+
# - Item
|
13
|
+
# access_key_id: NSVCZ75O
|
14
|
+
# date_created: '2023-09-06T13:11:59.704005+00:00'
|
15
|
+
# description: Manually generated local access-key for testing.
|
16
|
+
# display_title: AccessKey from 2023-09-06
|
17
|
+
# expiration_date: '2023-12-05T13:11:59.714106'
|
18
|
+
# last_modified:
|
19
|
+
# date_modified: '2023-09-06T13:11:59.711367+00:00'
|
20
|
+
# modified_by:
|
21
|
+
# '@id': /users/3202fd57-44d2-44fb-a131-afb1e43d8ae5/
|
22
|
+
# '@type':
|
23
|
+
# - User
|
24
|
+
# - Item
|
25
|
+
# status: current
|
26
|
+
# uuid: 3202fd57-44d2-44fb-a131-afb1e43d8ae5
|
27
|
+
# principals_allowed:
|
28
|
+
# edit:
|
29
|
+
# - group.admin
|
30
|
+
# - userid.74fef71a-dfc1-4aa4-acc0-cedcb7ac1d68
|
31
|
+
# view:
|
32
|
+
# - group.admin
|
33
|
+
# - group.read-only-admin
|
34
|
+
# - userid.74fef71a-dfc1-4aa4-acc0-cedcb7ac1d68
|
35
|
+
# schema_version: '1'
|
36
|
+
# status: current
|
37
|
+
# user:
|
38
|
+
# '@id': /users/74fef71a-dfc1-4aa4-acc0-cedcb7ac1d68/
|
39
|
+
# '@type':
|
40
|
+
# - User
|
41
|
+
# - Item
|
42
|
+
# display_title: David Michaels
|
43
|
+
# principals_allowed:
|
44
|
+
# edit:
|
45
|
+
# - group.admin
|
46
|
+
# view:
|
47
|
+
# - group.admin
|
48
|
+
# - group.read-only-admin
|
49
|
+
# status: current
|
50
|
+
# uuid: 74fef71a-dfc1-4aa4-acc0-cedcb7ac1d68
|
51
|
+
# uuid: 3968e38e-c11f-472e-8531-8650e2e296d4
|
52
|
+
#
|
53
|
+
# Note that instead of a uuid you can also actually use a path, for example:
|
54
|
+
# view-local-object /file-formats/vcf_gz_tbi
|
55
|
+
#
|
56
|
+
# --------------------------------------------------------------------------------------------------
|
57
|
+
|
58
|
+
import argparse
|
59
|
+
import json
|
60
|
+
import pyperclip
|
61
|
+
import sys
|
62
|
+
from typing import Optional
|
63
|
+
import yaml
|
64
|
+
from dcicutils.misc_utils import get_error_message
|
65
|
+
from dcicutils.portal_utils import Portal
|
66
|
+
from dcicutils.captured_output import captured_output, uncaptured_output
|
67
|
+
|
68
|
+
|
69
|
+
def main():
|
70
|
+
|
71
|
+
parser = argparse.ArgumentParser(description="View Portal object.")
|
72
|
+
parser.add_argument("uuid", type=str,
|
73
|
+
help=f"The uuid (or path) of the object to fetch and view. ")
|
74
|
+
parser.add_argument("--ini", type=str, required=False, default=None,
|
75
|
+
help=f"Name of the application .ini file.")
|
76
|
+
parser.add_argument("--env", "-e", type=str, required=False, default=None,
|
77
|
+
help=f"Environment name (key from ~/.smaht-keys.json).")
|
78
|
+
parser.add_argument("--server", "-s", type=str, required=False, default=None,
|
79
|
+
help=f"Environment server name (server from key in ~/.smaht-keys.json).")
|
80
|
+
parser.add_argument("--app", type=str, required=False, default=None,
|
81
|
+
help=f"Application name (one of: smaht, cgap, fourfront).")
|
82
|
+
parser.add_argument("--raw", action="store_true", required=False, default=False, help="Raw output.")
|
83
|
+
parser.add_argument("--database", action="store_true", required=False, default=False,
|
84
|
+
help="Read from database output.")
|
85
|
+
parser.add_argument("--yaml", action="store_true", required=False, default=False, help="YAML output.")
|
86
|
+
parser.add_argument("--copy", "-c", action="store_true", required=False, default=False,
|
87
|
+
help="Copy object data to clipboard.")
|
88
|
+
parser.add_argument("--verbose", action="store_true", required=False, default=False, help="Verbose output.")
|
89
|
+
parser.add_argument("--debug", action="store_true", required=False, default=False, help="Debugging output.")
|
90
|
+
args = parser.parse_args()
|
91
|
+
|
92
|
+
portal = _create_portal(ini=args.ini, env=args.env, server=args.server, app=args.app, debug=args.debug)
|
93
|
+
data = _get_portal_object(portal=portal, uuid=args.uuid, raw=args.raw, database=args.database, verbose=args.verbose)
|
94
|
+
|
95
|
+
if args.copy:
|
96
|
+
pyperclip.copy(json.dumps(data, indent=4))
|
97
|
+
if args.yaml:
|
98
|
+
_print(yaml.dump(data))
|
99
|
+
else:
|
100
|
+
_print(json.dumps(data, default=str, indent=4))
|
101
|
+
|
102
|
+
|
103
|
+
def _create_portal(ini: str, env: Optional[str] = None,
|
104
|
+
server: Optional[str] = None, app: Optional[str] = None, debug: bool = False) -> Portal:
|
105
|
+
with captured_output(not debug):
|
106
|
+
return Portal(env, server=server, app=app) if env or app else Portal(ini)
|
107
|
+
|
108
|
+
|
109
|
+
def _get_portal_object(portal: Portal, uuid: str,
|
110
|
+
raw: bool = False, database: bool = False, verbose: bool = False) -> dict:
|
111
|
+
if verbose:
|
112
|
+
_print(f"Getting object ({uuid}) from portal ... ", end="")
|
113
|
+
response = None
|
114
|
+
try:
|
115
|
+
if not uuid.startswith("/"):
|
116
|
+
path = f"/{uuid}"
|
117
|
+
else:
|
118
|
+
path = uuid
|
119
|
+
response = portal.get(path, raw=raw, database=database)
|
120
|
+
except Exception as e:
|
121
|
+
if "404" in str(e) and "not found" in str(e).lower():
|
122
|
+
if verbose:
|
123
|
+
_print("Not found!")
|
124
|
+
else:
|
125
|
+
_print(f"Object ({uuid}) not found!")
|
126
|
+
_exit_without_action()
|
127
|
+
_exit_without_action(f"Exception getting object ({uuid}) -> {get_error_message(e)}", newline=verbose)
|
128
|
+
if not response:
|
129
|
+
_exit_without_action(f"Null response getting object {uuid}).")
|
130
|
+
if response.status_code not in [200, 307]:
|
131
|
+
# TODO: Understand why the /me endpoint returns HTTP status code 307, which is only why we mention it above.
|
132
|
+
_exit_without_action(f"Invalid status code ({response.status_code}) getting object: {uuid}")
|
133
|
+
if not response.json:
|
134
|
+
_exit_without_action(f"Invalid JSON getting object {uuid}).")
|
135
|
+
if verbose:
|
136
|
+
_print("OK")
|
137
|
+
return response.json()
|
138
|
+
|
139
|
+
|
140
|
+
def _print(*args, **kwargs):
|
141
|
+
with uncaptured_output():
|
142
|
+
print(*args, **kwargs)
|
143
|
+
sys.stdout.flush()
|
144
|
+
|
145
|
+
|
146
|
+
def _exit_without_action(message: Optional[str] = None, newline: bool = True) -> None:
|
147
|
+
if message:
|
148
|
+
if newline:
|
149
|
+
_print()
|
150
|
+
_print(f"ERROR: {message}")
|
151
|
+
exit(1)
|
152
|
+
|
153
|
+
|
154
|
+
if __name__ == "__main__":
|
155
|
+
main()
|
@@ -717,7 +717,7 @@ class Portal(PortalBase):
|
|
717
717
|
for item in items:
|
718
718
|
if (ivalue := next((item[iproperty] for iproperty in iproperties if iproperty in item), None)):
|
719
719
|
if isinstance(ivalue, list) and value in ivalue or ivalue == value:
|
720
|
-
return True, ivalue if is_uuid(ivalue) else None
|
720
|
+
return True, (ivalue if isinstance(ivalue, str) and is_uuid(ivalue) else None)
|
721
721
|
if (value := self.get_metadata(f"/{type_name}/{value}")) is None:
|
722
722
|
return False, None
|
723
723
|
return True, value.get("uuid")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "dcicutils"
|
3
|
-
version = "8.7.2.
|
3
|
+
version = "8.7.2.1b3" # TODO: To become 8.8.0
|
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"
|
@@ -56,6 +56,7 @@ PyJWT = "^2.6.0"
|
|
56
56
|
pyramid = "1.10.4"
|
57
57
|
pytz = ">=2020.4"
|
58
58
|
redis = "^4.5.1"
|
59
|
+
pyperclip = "^1.8.2"
|
59
60
|
PyYAML = "^6.0.1"
|
60
61
|
requests = "^2.21.0"
|
61
62
|
rfc3986 = "^1.4.0"
|
@@ -88,6 +89,7 @@ pytest-runner = ">=5.1"
|
|
88
89
|
publish-to-pypi = "dcicutils.scripts.publish_to_pypi:main"
|
89
90
|
show-contributors = "dcicutils.contribution_scripts:show_contributors_main"
|
90
91
|
run-license-checker = "dcicutils.scripts.run_license_checker:main"
|
92
|
+
view-portal-object = "dcicutils.scripts.view_portal_object:main"
|
91
93
|
|
92
94
|
|
93
95
|
[tool.pytest.ini_options]
|
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.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/license_policies/c4-infrastructure.jsonc
RENAMED
File without changes
|
File without changes
|
{dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/license_policies/park-lab-common-server.jsonc
RENAMED
File without changes
|
{dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/license_policies/park-lab-common.jsonc
RENAMED
File without changes
|
{dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/dcicutils/license_policies/park-lab-gpl-pipeline.jsonc
RENAMED
File without changes
|
{dcicutils-8.7.2.1b1 → dcicutils-8.7.2.1b3}/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
|