pybiolib 1.1.2112__py3-none-any.whl → 1.1.2119__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.
@@ -0,0 +1 @@
1
+ from .resources import * # noqa: F403
@@ -0,0 +1,14 @@
1
+ from .typing import Optional, TypedDict
2
+
3
+
4
+ class ExperimentDict(TypedDict):
5
+ job_count: int
6
+ job_running_count: int
7
+
8
+
9
+ class ResourceDict(TypedDict):
10
+ created_at: str
11
+ experiment: Optional[ExperimentDict]
12
+ name: str
13
+ uri: str
14
+ uuid: str
@@ -0,0 +1,7 @@
1
+ import sys
2
+
3
+ # import and expose everything from the typing module
4
+ from typing import * # noqa:F403 pylint: disable=wildcard-import, unused-wildcard-import
5
+
6
+ if sys.version_info < (3, 8): # noqa: UP036
7
+ from typing_extensions import Literal, TypedDict # pylint: disable=unused-import
@@ -1,6 +1,7 @@
1
1
  import time
2
2
  from collections import OrderedDict
3
3
 
4
+ import biolib._internal.types as _types
4
5
  from biolib import api
5
6
  from biolib._internal.http_client import HttpError
6
7
  from biolib.biolib_errors import BioLibError, NotFound
@@ -23,8 +24,11 @@ class Experiment:
23
24
  }
24
25
  )
25
26
 
26
- def __init__(self, uri: str):
27
- self._experiment_dict: ExperimentDict = self._get_or_create_by_uri(uri)
27
+ def __init__(self, uri: str, _experiment_dict: Optional[ExperimentDict] = None):
28
+ if not _experiment_dict:
29
+ self._experiment_dict: ExperimentDict = self._get_or_create_by_uri(uri)
30
+ else:
31
+ self._experiment_dict = _experiment_dict
28
32
 
29
33
  def __enter__(self):
30
34
  Experiment._BIOLIB_EXPERIMENTS.append(self)
@@ -62,6 +66,21 @@ class Experiment:
62
66
  title='Experiments',
63
67
  ).print_table()
64
68
 
69
+ @staticmethod
70
+ def get_by_uri(uri: str) -> 'Experiment':
71
+ resource_dict: _types.ResourceDict = api.client.get('/resources/', params={'uri': uri}).json()
72
+ if not resource_dict['experiment']:
73
+ raise ValueError('Resource from URI is not an experiment')
74
+
75
+ legacy_experiment_dict = ExperimentDict(
76
+ created_at=resource_dict['created_at'],
77
+ job_count=resource_dict['experiment']['job_count'],
78
+ job_running_count=resource_dict['experiment']['job_running_count'],
79
+ name=resource_dict['name'],
80
+ uuid=resource_dict['uuid'],
81
+ )
82
+ return Experiment(uri=resource_dict['uri'], _experiment_dict=legacy_experiment_dict)
83
+
65
84
  def wait(self) -> None:
66
85
  self._refetch_experiment_dict()
67
86
  while self._experiment_dict['job_running_count'] > 0:
biolib/typing_utils.py CHANGED
@@ -1,7 +1,2 @@
1
- import sys
2
-
3
- # import and expose everything from the typing module
4
- from typing import * # pylint: disable=wildcard-import, unused-wildcard-import
5
-
6
- if sys.version_info < (3, 8):
7
- from typing_extensions import TypedDict, Literal # pylint: disable=unused-import
1
+ # TODO: Deprecate and later remove this file
2
+ from biolib._internal.types.typing import * # pylint: disable=wildcard-import, unused-wildcard-import
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybiolib
3
- Version: 1.1.2112
3
+ Version: 1.1.2119
4
4
  Summary: BioLib Python Client
5
5
  Home-page: https://github.com/biolib
6
6
  License: MIT
@@ -16,6 +16,9 @@ biolib/_internal/libs/__init__.py,sha256=Jdf4tNPqe_oIIf6zYml6TiqhL_02Vyqwge6IELr
16
16
  biolib/_internal/libs/fusepy/__init__.py,sha256=AWDzNFS-XV_5yKb0Qx7kggIhPzq1nj_BZS5y2Nso08k,41944
17
17
  biolib/_internal/push_application.py,sha256=8P7eXvySn7CRp5XBDkO3xjTGixS8g7-jD-_iwzM_XDI,10020
18
18
  biolib/_internal/runtime.py,sha256=9pZ3s3L7LGxdqOgnHh1KK3Jjyn_9MjhQmKHI-6hMT3U,448
19
+ biolib/_internal/types/__init__.py,sha256=h2I2aupN01HbhBelL-qQa8FLuXiH1tB3kKl8dPdhmnc,39
20
+ biolib/_internal/types/resources.py,sha256=LlxuiesDDv3TvfEmz_BCCxH0V650bNHtS_LpBMA25T4,256
21
+ biolib/_internal/types/typing.py,sha256=D4EKKEe7kDx0K6lJi-H_XLtk-8w6nu2fdqn9bvzI-Xo,288
19
22
  biolib/_internal/utils/__init__.py,sha256=p5vsIFyu-zYqBgdSMfwW9NC_jk7rXvvCbV4Bzd3As7c,630
20
23
  biolib/_runtime/runtime.py,sha256=zy9HrE4X5hBqm8doUHkckyflquSBDSXV3REhT2MQGas,2767
21
24
  biolib/api/__init__.py,sha256=mQ4u8FijqyLzjYMezMUUbbBGNB3iFmkNdjXnWPZ7Jlw,138
@@ -91,7 +94,7 @@ biolib/compute_node/webserver/webserver_types.py,sha256=2t8EaFKESnves3BA_NBdnS2y
91
94
  biolib/compute_node/webserver/webserver_utils.py,sha256=XWvwYPbWNR3qS0FYbLLp-MDDfVk0QdaAmg3xPrT0H2s,4234
92
95
  biolib/compute_node/webserver/worker_thread.py,sha256=26tG73TADnOcXsAr7Iyf6smrLlCqB4x-vvmpUb8WqnA,11569
93
96
  biolib/experiments/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
94
- biolib/experiments/experiment.py,sha256=IMjnokTc9ZEKUjpsM_JnFolh9HsLbjXus_xKBb2ypJ8,7219
97
+ biolib/experiments/experiment.py,sha256=o2gXMJVwK2SFljZ9RdTYFRH3jGKJmg3P39oERhEnZMQ,8126
95
98
  biolib/experiments/types.py,sha256=n9GxdFA7cLMfHvLLqLmZzX31ELeSSkMXFoEEdFsdWGY,171
96
99
  biolib/jobs/__init__.py,sha256=aIb2H2DHjQbM2Bs-dysFijhwFcL58Blp0Co0gimED3w,32
97
100
  biolib/jobs/job.py,sha256=aJck0zl6QTE-70pkHY9tKDctchdJyA-YaCIozrlqGkA,19065
@@ -102,7 +105,7 @@ biolib/sdk/__init__.py,sha256=qJ_V_Edxolzi4VBQCrvem5lYIkJ0FVH3VZepSDuXjTc,1895
102
105
  biolib/tables.py,sha256=acH7VjwAbadLo8P84FSnKEZxCTVsF5rEg9VPuxElNs8,872
103
106
  biolib/templates/__init__.py,sha256=Yx62sSyDCDesRQDQgmbDsLpfgEh93fWE8r9u4g2azXk,36
104
107
  biolib/templates/example_app.py,sha256=EB3E3RT4SeO_ii5nVQqJpi5KDGNE_huF1ub-e5ZFveE,715
105
- biolib/typing_utils.py,sha256=krMhxB3SedVQA3HXIrC7DBXWpHKWN5JNmXGcSrrysOc,263
108
+ biolib/typing_utils.py,sha256=ntzrlyTkUaO2OtccLYzCAGztGdca0WT5fikJUmSkT-Y,148
106
109
  biolib/user/__init__.py,sha256=Db5wtxLfFz3ID9TULSSTo77csw9tO6RtxMRvV5cqKEE,39
107
110
  biolib/user/sign_in.py,sha256=q-E2B3wLVwPU5plbITJXP4GDWWUzUcDpYu_y8BShNQ8,2039
108
111
  biolib/utils/__init__.py,sha256=fwjciJyJicvYyZcVTzfDBgD0SKY13DeXqvTeG4qZIy8,5548
@@ -111,8 +114,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
111
114
  biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
112
115
  biolib/utils/seq_util.py,sha256=jC5WhH63FTD7SLFJbxQGA2hOt9NTwq9zHl_BEec1Z0c,4907
113
116
  biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
114
- pybiolib-1.1.2112.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
115
- pybiolib-1.1.2112.dist-info/METADATA,sha256=zFj4CxOhsy98RLU_W0SYBRreB85CsOhtcAg6UZ_Af4I,1508
116
- pybiolib-1.1.2112.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
117
- pybiolib-1.1.2112.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
118
- pybiolib-1.1.2112.dist-info/RECORD,,
117
+ pybiolib-1.1.2119.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
118
+ pybiolib-1.1.2119.dist-info/METADATA,sha256=H_-CG3QcTCBRdKmXtXeAfdOOaCNQMNz7AQO3YdJHAGQ,1508
119
+ pybiolib-1.1.2119.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
120
+ pybiolib-1.1.2119.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
121
+ pybiolib-1.1.2119.dist-info/RECORD,,