dcicutils 8.7.0.1b28__py3-none-any.whl → 8.7.0.1b29__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- dcicutils/structured_data.py +29 -0
- {dcicutils-8.7.0.1b28.dist-info → dcicutils-8.7.0.1b29.dist-info}/METADATA +1 -1
- {dcicutils-8.7.0.1b28.dist-info → dcicutils-8.7.0.1b29.dist-info}/RECORD +6 -6
- {dcicutils-8.7.0.1b28.dist-info → dcicutils-8.7.0.1b29.dist-info}/LICENSE.txt +0 -0
- {dcicutils-8.7.0.1b28.dist-info → dcicutils-8.7.0.1b29.dist-info}/WHEEL +0 -0
- {dcicutils-8.7.0.1b28.dist-info → dcicutils-8.7.0.1b29.dist-info}/entry_points.txt +0 -0
dcicutils/structured_data.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import copy
|
2
2
|
from functools import lru_cache
|
3
|
+
import glob
|
3
4
|
import json
|
4
5
|
from jsonschema import Draft7Validator as SchemaValidator
|
5
6
|
import os
|
@@ -111,6 +112,14 @@ class StructuredDataSet:
|
|
111
112
|
result.append({"type": type_name, "file": file_name})
|
112
113
|
return result
|
113
114
|
|
115
|
+
def upload_files_located(self,
|
116
|
+
location: Union[str, Optional[List[str]]] = None, recursive: bool = False) -> List[str]:
|
117
|
+
upload_files = copy.deepcopy(self.upload_files)
|
118
|
+
for upload_file in upload_files:
|
119
|
+
if file_path := _search_for_file(upload_file["file"], location=location, recursive=recursive):
|
120
|
+
upload_file["path"] = file_path
|
121
|
+
return upload_files
|
122
|
+
|
114
123
|
def _load_file(self, file: str) -> None:
|
115
124
|
# Returns a dictionary where each property is the name (i.e. the type) of the data,
|
116
125
|
# and the value is array of dictionaries for the data itself. Handle these kinds of files:
|
@@ -641,3 +650,23 @@ def _split_dotted_string(value: str):
|
|
641
650
|
|
642
651
|
def _split_array_string(value: str, unique: bool = False):
|
643
652
|
return split_string(value, ARRAY_VALUE_DELIMITER_CHAR, ARRAY_VALUE_DELIMITER_ESCAPE_CHAR, unique=unique)
|
653
|
+
|
654
|
+
|
655
|
+
def _search_for_file(file: str,
|
656
|
+
location: Union[str, Optional[List[str]]] = None, recursive: bool = False) -> Optional[str]:
|
657
|
+
if isinstance(file, str) or not file:
|
658
|
+
if not location:
|
659
|
+
location = "."
|
660
|
+
if location:
|
661
|
+
if isinstance(location, str):
|
662
|
+
location = [location]
|
663
|
+
if isinstance(location, list):
|
664
|
+
for directory in location:
|
665
|
+
if isinstance(directory, str) and os.path.exists(os.path.join(directory, file)):
|
666
|
+
return os.path.normpath(os.path.join(directory, file))
|
667
|
+
if recursive:
|
668
|
+
if not file.startswith("**/"):
|
669
|
+
file = "**/" + file
|
670
|
+
files = glob.glob(file, recursive=recursive)
|
671
|
+
if files:
|
672
|
+
return files[0]
|
@@ -58,15 +58,15 @@ dcicutils/secrets_utils.py,sha256=8dppXAsiHhJzI6NmOcvJV5ldvKkQZzh3Fl-cb8Wm7MI,19
|
|
58
58
|
dcicutils/sheet_utils.py,sha256=VlmzteONW5VF_Q4vo0yA5vesz1ViUah1MZ_yA1rwZ0M,33629
|
59
59
|
dcicutils/snapshot_utils.py,sha256=ymP7PXH6-yEiXAt75w0ldQFciGNqWBClNxC5gfX2FnY,22961
|
60
60
|
dcicutils/ssl_certificate_utils.py,sha256=F0ifz_wnRRN9dfrfsz7aCp4UDLgHEY8LaK7PjnNvrAQ,9707
|
61
|
-
dcicutils/structured_data.py,sha256
|
61
|
+
dcicutils/structured_data.py,sha256=aeFrqFkz_ij_wXouJBTZ71fnWr4OkymCwPcG8P5RG04,34849
|
62
62
|
dcicutils/task_utils.py,sha256=MF8ujmTD6-O2AC2gRGPHyGdUrVKgtr8epT5XU8WtNjk,8082
|
63
63
|
dcicutils/tmpfile_utils.py,sha256=n95XF8dZVbQRSXBZTGToXXfSs3JUVRyN6c3ZZ0nhAWI,1403
|
64
64
|
dcicutils/trace_utils.py,sha256=g8kwV4ebEy5kXW6oOrEAUsurBcCROvwtZqz9fczsGRE,1769
|
65
65
|
dcicutils/validation_utils.py,sha256=cMZIU2cY98FYtzK52z5WUYck7urH6JcqOuz9jkXpqzg,14797
|
66
66
|
dcicutils/variant_utils.py,sha256=2H9azNx3xAj-MySg-uZ2SFqbWs4kZvf61JnK6b-h4Qw,4343
|
67
67
|
dcicutils/zip_utils.py,sha256=rnjNv_k6L9jT2SjDSgVXp4BEJYLtz9XN6Cl2Fy-tqnM,2027
|
68
|
-
dcicutils-8.7.0.
|
69
|
-
dcicutils-8.7.0.
|
70
|
-
dcicutils-8.7.0.
|
71
|
-
dcicutils-8.7.0.
|
72
|
-
dcicutils-8.7.0.
|
68
|
+
dcicutils-8.7.0.1b29.dist-info/LICENSE.txt,sha256=qnwSmfnEWMl5l78VPDEzAmEbLVrRqQvfUQiHT0ehrOo,1102
|
69
|
+
dcicutils-8.7.0.1b29.dist-info/METADATA,sha256=qAWF7z9WUO4FKeKo158CYIUTXBFZgM9gqksX9bF4RWo,3315
|
70
|
+
dcicutils-8.7.0.1b29.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
|
71
|
+
dcicutils-8.7.0.1b29.dist-info/entry_points.txt,sha256=8wbw5csMIgBXhkwfgsgJeuFcoUc0WsucUxmOyml2aoA,209
|
72
|
+
dcicutils-8.7.0.1b29.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|