pybiolib 1.1.2175__py3-none-any.whl → 1.1.2180__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.
- biolib/_data_record/data_record.py +9 -11
- biolib/_runtime/runtime.py +7 -6
- {pybiolib-1.1.2175.dist-info → pybiolib-1.1.2180.dist-info}/METADATA +1 -1
- {pybiolib-1.1.2175.dist-info → pybiolib-1.1.2180.dist-info}/RECORD +7 -7
- {pybiolib-1.1.2175.dist-info → pybiolib-1.1.2180.dist-info}/LICENSE +0 -0
- {pybiolib-1.1.2175.dist-info → pybiolib-1.1.2180.dist-info}/WHEEL +0 -0
- {pybiolib-1.1.2175.dist-info → pybiolib-1.1.2180.dist-info}/entry_points.txt +0 -0
@@ -4,7 +4,7 @@ from datetime import datetime
|
|
4
4
|
from fnmatch import fnmatch
|
5
5
|
from pathlib import Path
|
6
6
|
from struct import Struct
|
7
|
-
from typing import Callable, Dict, List, Union, cast
|
7
|
+
from typing import Callable, Dict, List, Optional, Union, cast
|
8
8
|
|
9
9
|
from biolib import api, utils
|
10
10
|
from biolib._internal import types
|
@@ -20,11 +20,9 @@ from biolib.biolib_binary_format import LazyLoadedFile
|
|
20
20
|
from biolib.biolib_binary_format.utils import RemoteIndexableBuffer
|
21
21
|
from biolib.biolib_errors import BioLibError
|
22
22
|
from biolib.biolib_logging import logger
|
23
|
-
from biolib.typing_utils import Optional as _Optional
|
24
23
|
from biolib.utils.app_uri import parse_app_uri
|
25
24
|
from biolib.utils.zip.remote_zip import RemoteZip
|
26
25
|
|
27
|
-
|
28
26
|
PathFilter = Union[str, Callable[[str], bool]]
|
29
27
|
|
30
28
|
|
@@ -51,7 +49,7 @@ class DataRecord:
|
|
51
49
|
|
52
50
|
return uri_parsed['app_name']
|
53
51
|
|
54
|
-
def list_files(self, path_filter:
|
52
|
+
def list_files(self, path_filter: Optional[PathFilter] = None) -> List[LazyLoadedFile]:
|
55
53
|
remote_storage_endpoint = DataRecordRemoteStorageEndpoint(
|
56
54
|
resource_version_uuid=self._state['resource_version_uuid'],
|
57
55
|
)
|
@@ -69,7 +67,7 @@ class DataRecord:
|
|
69
67
|
)
|
70
68
|
HttpClient.request(url=remote_storage_endpoint.get_remote_url(), response_path=output_path)
|
71
69
|
|
72
|
-
def download_files(self, output_dir: str, path_filter:
|
70
|
+
def download_files(self, output_dir: str, path_filter: Optional[PathFilter] = None) -> None:
|
73
71
|
filtered_files = self.list_files(path_filter=path_filter)
|
74
72
|
|
75
73
|
if len(filtered_files) == 0:
|
@@ -83,10 +81,10 @@ class DataRecord:
|
|
83
81
|
for chunk in file.get_data_iterator():
|
84
82
|
file_handle.write(chunk)
|
85
83
|
|
86
|
-
def save_files(self, output_dir: str, path_filter:
|
84
|
+
def save_files(self, output_dir: str, path_filter: Optional[PathFilter] = None) -> None:
|
87
85
|
self.download_files(output_dir=output_dir, path_filter=path_filter)
|
88
86
|
|
89
|
-
def update(self, data_path: str, chunk_size_in_mb:
|
87
|
+
def update(self, data_path: str, chunk_size_in_mb: Optional[int] = None) -> None:
|
90
88
|
assert os.path.isdir(data_path), f'The path "{data_path}" is not a directory.'
|
91
89
|
BiolibApiClient.assert_is_signed_in(authenticated_action_description='push data to a Data Record')
|
92
90
|
|
@@ -108,11 +106,11 @@ class DataRecord:
|
|
108
106
|
logger.info(f"Validating data record of type {data_record_type['name']}")
|
109
107
|
for rule in data_record_type['validation_rules']:
|
110
108
|
logger.info(f"Validating rule {rule['type']} for {rule['path']}...")
|
111
|
-
if rule['type'] ==
|
109
|
+
if rule['type'] == 'sqlite-v1':
|
112
110
|
try:
|
113
111
|
validate_sqlite_v1(schema=rule['rule'], sqlite_file=Path(rule['path']))
|
114
112
|
except Exception as error:
|
115
|
-
raise Exception(
|
113
|
+
raise Exception('Data Record Validation failed') from error
|
116
114
|
else:
|
117
115
|
raise Exception(f"Error processing data record validation: unknown rule type {rule['type']}")
|
118
116
|
|
@@ -158,7 +156,7 @@ class DataRecord:
|
|
158
156
|
return DataRecord(_internal_state=get_data_record_state_from_uri(uri))
|
159
157
|
|
160
158
|
@staticmethod
|
161
|
-
def create(destination: str, data_path:
|
159
|
+
def create(destination: str, data_path: Optional[str] = None) -> 'DataRecord':
|
162
160
|
BiolibApiClient.assert_is_signed_in(authenticated_action_description='create a Data Record')
|
163
161
|
if data_path is not None:
|
164
162
|
assert os.path.isdir(data_path), f'The path "{data_path}" is not a directory.'
|
@@ -188,7 +186,7 @@ class DataRecord:
|
|
188
186
|
return DataRecord.get_by_uri(uri=data_record_info['uri'])
|
189
187
|
|
190
188
|
@staticmethod
|
191
|
-
def fetch(uri:
|
189
|
+
def fetch(uri: Optional[str] = None, count: Optional[int] = None) -> List['DataRecord']:
|
192
190
|
max_page_size = 1_000
|
193
191
|
params: Dict[str, Union[str, int]] = {
|
194
192
|
'page_size': str(count or max_page_size),
|
biolib/_runtime/runtime.py
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
from biolib import api
|
2
|
-
from biolib._internal.runtime import BioLibRuntimeError, BioLibRuntimeNotRecognizedError, RuntimeJobDataDict
|
3
|
-
from biolib.typing_utils import cast, Optional as _Optional
|
4
|
-
|
5
1
|
import json
|
6
2
|
import re
|
3
|
+
from typing import Optional
|
4
|
+
|
5
|
+
from biolib import api
|
6
|
+
from biolib._internal.runtime import BioLibRuntimeError, BioLibRuntimeNotRecognizedError, RuntimeJobDataDict
|
7
|
+
from biolib.typing_utils import cast
|
7
8
|
|
8
9
|
|
9
10
|
class Runtime:
|
10
|
-
_job_data:
|
11
|
+
_job_data: Optional[RuntimeJobDataDict] = None
|
11
12
|
|
12
13
|
@staticmethod
|
13
14
|
def check_is_environment_biolib_app() -> bool:
|
@@ -56,7 +57,7 @@ class Runtime:
|
|
56
57
|
api.client.post(data={'note': note}, path=f'/jobs/{job_id}/notes/')
|
57
58
|
|
58
59
|
@staticmethod
|
59
|
-
def _try_to_get_job_data() ->
|
60
|
+
def _try_to_get_job_data() -> Optional[RuntimeJobDataDict]:
|
60
61
|
if not Runtime._job_data:
|
61
62
|
try:
|
62
63
|
with open('/biolib/secrets/biolib_system_secret') as file:
|
@@ -1,7 +1,7 @@
|
|
1
1
|
LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
2
2
|
README.md,sha256=_IH7pxFiqy2bIAmaVeA-iVTyUwWRjMIlfgtUbYTtmls,368
|
3
3
|
biolib/__init__.py,sha256=_tThyzISH81yS9KXP_X3qEiKXmsIp5XOBcJIODfLVnc,4338
|
4
|
-
biolib/_data_record/data_record.py,sha256=
|
4
|
+
biolib/_data_record/data_record.py,sha256=6PD-jBgWU2Cc4PwT-hLNPTFZygb4r0LBL617U-1eijE,12633
|
5
5
|
biolib/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
biolib/_internal/data_record/__init__.py,sha256=fGdME6JGRU_2VxpJbYpGXYndjN-feUkmKY4fuMyq3cg,76
|
7
7
|
biolib/_internal/data_record/data_record.py,sha256=YmaAABR57goDCE8-rKb2j0FPMSbDtRPCm_HhT3mM074,4299
|
@@ -23,7 +23,7 @@ biolib/_internal/types/experiment.py,sha256=D94iBdn2nS92lRW-TOs1a2WKXJD5ZtmzL4yp
|
|
23
23
|
biolib/_internal/types/resource.py,sha256=G-vPkZoe4Um6FPxsQZtRzAlbSW5sDW4NFkbjn21I3V4,372
|
24
24
|
biolib/_internal/types/typing.py,sha256=D4EKKEe7kDx0K6lJi-H_XLtk-8w6nu2fdqn9bvzI-Xo,288
|
25
25
|
biolib/_internal/utils/__init__.py,sha256=p5vsIFyu-zYqBgdSMfwW9NC_jk7rXvvCbV4Bzd3As7c,630
|
26
|
-
biolib/_runtime/runtime.py,sha256=
|
26
|
+
biolib/_runtime/runtime.py,sha256=daYxzIpRoW4k-HJFu2BMXeylYSlCXn3-SqdSriCFnKw,2770
|
27
27
|
biolib/api/__init__.py,sha256=mQ4u8FijqyLzjYMezMUUbbBGNB3iFmkNdjXnWPZ7Jlw,138
|
28
28
|
biolib/api/client.py,sha256=9MD1qI52BnRC_QSydFGjyFquwFw0R9dkDfUrjUouuHQ,3490
|
29
29
|
biolib/app/__init__.py,sha256=cdPtcfb_U-bxb9iSL4fCEq2rpD9OjkyY4W-Zw60B0LI,37
|
@@ -116,8 +116,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
|
|
116
116
|
biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
|
117
117
|
biolib/utils/seq_util.py,sha256=WieuQ2RvV4QSJFUAMRVyvKXFs3YanFAmjh-CFIaQmQk,5184
|
118
118
|
biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
|
119
|
-
pybiolib-1.1.
|
120
|
-
pybiolib-1.1.
|
121
|
-
pybiolib-1.1.
|
122
|
-
pybiolib-1.1.
|
123
|
-
pybiolib-1.1.
|
119
|
+
pybiolib-1.1.2180.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
120
|
+
pybiolib-1.1.2180.dist-info/METADATA,sha256=icX35ySYzpvqGrHM6Sy4NJ9tGCVWpP6U1qga8I3jgtc,1508
|
121
|
+
pybiolib-1.1.2180.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
122
|
+
pybiolib-1.1.2180.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
123
|
+
pybiolib-1.1.2180.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|