geoseeq 0.4.0__py3-none-any.whl → 0.5.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- geoseeq/cli/main.py +2 -2
- geoseeq/cli/shared_params/common_state.py +1 -1
- geoseeq/cli/shared_params/opts_and_args.py +1 -1
- geoseeq/constants.py +9 -1
- geoseeq/id_constructors/from_blobs.py +10 -0
- geoseeq/id_constructors/from_ids.py +10 -0
- geoseeq/id_constructors/from_names.py +10 -0
- geoseeq/id_constructors/from_uuids.py +12 -1
- geoseeq/id_constructors/resolvers.py +4 -0
- geoseeq/knex.py +35 -2
- geoseeq/project.py +1 -1
- geoseeq/utils.py +36 -0
- {geoseeq-0.4.0.dist-info → geoseeq-0.5.0.dist-info}/METADATA +1 -1
- {geoseeq-0.4.0.dist-info → geoseeq-0.5.0.dist-info}/RECORD +18 -18
- {geoseeq-0.4.0.dist-info → geoseeq-0.5.0.dist-info}/LICENSE +0 -0
- {geoseeq-0.4.0.dist-info → geoseeq-0.5.0.dist-info}/WHEEL +0 -0
- {geoseeq-0.4.0.dist-info → geoseeq-0.5.0.dist-info}/entry_points.txt +0 -0
- {geoseeq-0.4.0.dist-info → geoseeq-0.5.0.dist-info}/top_level.txt +0 -0
geoseeq/cli/main.py
CHANGED
@@ -13,7 +13,7 @@ from .view import cli_view
|
|
13
13
|
from .search import cli_search
|
14
14
|
from geoseeq.vc.cli import cli_vc
|
15
15
|
from geoseeq.knex import DEFAULT_ENDPOINT
|
16
|
-
from .
|
16
|
+
from geoseeq.utils import set_profile
|
17
17
|
from .shared_params.opts_and_args import overwrite_option
|
18
18
|
from .detail import cli_detail
|
19
19
|
from .run import cli_app
|
@@ -53,7 +53,7 @@ def version():
|
|
53
53
|
Use of this tool implies acceptance of the GeoSeeq End User License Agreement.
|
54
54
|
Run `geoseeq eula show` to view the EULA.
|
55
55
|
"""
|
56
|
-
click.echo('0.
|
56
|
+
click.echo('0.5.0') # remember to update setup
|
57
57
|
|
58
58
|
|
59
59
|
@main.group('advanced')
|
@@ -24,4 +24,4 @@ org_id_arg = click.argument('org_id', nargs=1)
|
|
24
24
|
project_id_arg = click.argument('project_id', nargs=1)
|
25
25
|
pipeline_id_arg = click.argument('pipeline_id', nargs=1)
|
26
26
|
sample_ids_arg = click.argument('sample_ids', nargs=-1)
|
27
|
-
folder_id_arg = click.argument('folder_id', nargs=1)
|
27
|
+
folder_id_arg = click.argument('folder_id', nargs=1)
|
geoseeq/constants.py
CHANGED
@@ -1,2 +1,10 @@
|
|
1
|
+
from os import environ
|
2
|
+
from os.path import join
|
3
|
+
|
1
4
|
FIVE_MB = 5 * (1024 ** 2)
|
2
|
-
FASTQ_MODULE_NAMES = ['short_read::paired_end', 'short_read::single_end', 'long_read::nanopore']
|
5
|
+
FASTQ_MODULE_NAMES = ['short_read::paired_end', 'short_read::single_end', 'long_read::nanopore']
|
6
|
+
DEFAULT_ENDPOINT = "https://backend.geoseeq.com"
|
7
|
+
|
8
|
+
CONFIG_FOLDER = environ.get("XDG_CONFIG_HOME", join(environ["HOME"], ".config"))
|
9
|
+
CONFIG_DIR = environ.get("GEOSEEQ_CONFIG_DIR", join(CONFIG_FOLDER, "geoseeq"))
|
10
|
+
PROFILES_PATH = join(CONFIG_DIR, "profiles.json")
|
@@ -1,6 +1,8 @@
|
|
1
1
|
from geoseeq import GeoseeqNotFoundError
|
2
|
+
from geoseeq.knex import with_knex
|
2
3
|
|
3
4
|
|
5
|
+
@with_knex
|
4
6
|
def org_from_blob(knex, blob, already_fetched=True, modified=False):
|
5
7
|
"""Return an Organization object from a blob."""
|
6
8
|
from geoseeq.organization import Organization # import here to avoid circular import
|
@@ -11,6 +13,7 @@ def org_from_blob(knex, blob, already_fetched=True, modified=False):
|
|
11
13
|
return org
|
12
14
|
|
13
15
|
|
16
|
+
@with_knex
|
14
17
|
def project_from_blob(knex, blob, already_fetched=True, modified=False):
|
15
18
|
"""Return a Project object from a blob."""
|
16
19
|
org = org_from_blob(
|
@@ -27,6 +30,7 @@ def project_from_blob(knex, blob, already_fetched=True, modified=False):
|
|
27
30
|
sample_group_from_blob = project_from_blob # Alias
|
28
31
|
|
29
32
|
|
33
|
+
@with_knex
|
30
34
|
def sample_from_blob(knex, blob, already_fetched=True, modified=False):
|
31
35
|
"""Return a Sample object from a blob."""
|
32
36
|
lib = sample_group_from_blob(
|
@@ -40,6 +44,7 @@ def sample_from_blob(knex, blob, already_fetched=True, modified=False):
|
|
40
44
|
return sample
|
41
45
|
|
42
46
|
|
47
|
+
@with_knex
|
43
48
|
def project_result_folder_from_blob(knex, blob, already_fetched=True, modified=False):
|
44
49
|
"""Return a ProjectResultFolder object from a blob."""
|
45
50
|
group = project_from_blob(
|
@@ -58,6 +63,7 @@ def project_result_folder_from_blob(knex, blob, already_fetched=True, modified=F
|
|
58
63
|
sample_group_ar_from_blob = project_result_folder_from_blob # Alias
|
59
64
|
|
60
65
|
|
66
|
+
@with_knex
|
61
67
|
def sample_result_folder_from_blob(knex, blob, already_fetched=True, modified=False):
|
62
68
|
"""Return a SampleResultFolder object from a blob."""
|
63
69
|
sample = sample_from_blob(
|
@@ -76,6 +82,7 @@ def sample_result_folder_from_blob(knex, blob, already_fetched=True, modified=Fa
|
|
76
82
|
sample_ar_from_blob = sample_result_folder_from_blob # Alias
|
77
83
|
|
78
84
|
|
85
|
+
@with_knex
|
79
86
|
def sample_result_file_from_blob(knex, blob, already_fetched=True, modified=False):
|
80
87
|
"""Return a SampleResultFile object from a blob."""
|
81
88
|
ar = sample_result_folder_from_blob(
|
@@ -92,6 +99,7 @@ def sample_result_file_from_blob(knex, blob, already_fetched=True, modified=Fals
|
|
92
99
|
sample_ar_field_from_blob = sample_result_file_from_blob # Alias
|
93
100
|
|
94
101
|
|
102
|
+
@with_knex
|
95
103
|
def project_result_file_from_blob(knex, blob, already_fetched=True, modified=False):
|
96
104
|
"""Return a ProjectResultFile object from a blob."""
|
97
105
|
ar = project_result_folder_from_blob(
|
@@ -108,6 +116,7 @@ def project_result_file_from_blob(knex, blob, already_fetched=True, modified=Fal
|
|
108
116
|
sample_group_ar_field_from_blob = project_result_file_from_blob # Alias
|
109
117
|
|
110
118
|
|
119
|
+
@with_knex
|
111
120
|
def pipeline_from_blob(knex, blob, already_fetched=True, modified=False):
|
112
121
|
"""Return a Pipeline object from a blob."""
|
113
122
|
from geoseeq.pipeline import Pipeline # import here to avoid circular import
|
@@ -120,6 +129,7 @@ def pipeline_from_blob(knex, blob, already_fetched=True, modified=False):
|
|
120
129
|
app_from_blob = pipeline_from_blob # Alias
|
121
130
|
|
122
131
|
|
132
|
+
@with_knex
|
123
133
|
def pipeline_run_from_blob(knex, blob, already_fetched=True, modified=False):
|
124
134
|
"""Return a Pipeline run object from a blob."""
|
125
135
|
from geoseeq.pipeline import PipelineRun # import here to avoid circular import
|
@@ -22,6 +22,7 @@ from .from_names import (
|
|
22
22
|
result_file_from_name,
|
23
23
|
)
|
24
24
|
from .utils import is_grn_or_uuid, is_name
|
25
|
+
from geoseeq.knex import with_knex
|
25
26
|
|
26
27
|
|
27
28
|
def _generic_from_id(knex, id, from_uuid_func, from_name_func):
|
@@ -33,31 +34,37 @@ def _generic_from_id(knex, id, from_uuid_func, from_name_func):
|
|
33
34
|
raise ValueError(f'"{id}" is not a GRN, UUID, or name')
|
34
35
|
|
35
36
|
|
37
|
+
@with_knex
|
36
38
|
def org_from_id(knex, id):
|
37
39
|
"""Return the organization object which the id points to."""
|
38
40
|
return _generic_from_id(knex, id, org_from_uuid, org_from_name)
|
39
41
|
|
40
42
|
|
43
|
+
@with_knex
|
41
44
|
def project_from_id(knex, id):
|
42
45
|
"""Return the project object which the id points to."""
|
43
46
|
return _generic_from_id(knex, id, project_from_uuid, project_from_name)
|
44
47
|
|
45
48
|
|
49
|
+
@with_knex
|
46
50
|
def sample_from_id(knex, id):
|
47
51
|
"""Return the sample object which the id points to."""
|
48
52
|
return _generic_from_id(knex, id, sample_from_uuid, sample_from_name)
|
49
53
|
|
50
54
|
|
55
|
+
@with_knex
|
51
56
|
def sample_result_folder_from_id(knex, id):
|
52
57
|
"""Return the sample result folder object which the id points to."""
|
53
58
|
return _generic_from_id(knex, id, sample_result_folder_from_uuid, sample_result_folder_from_name)
|
54
59
|
|
55
60
|
|
61
|
+
@with_knex
|
56
62
|
def project_result_folder_from_id(knex, id):
|
57
63
|
"""Return the project result folder object which the id points to."""
|
58
64
|
return _generic_from_id(knex, id, project_result_folder_from_uuid, project_result_folder_from_name)
|
59
65
|
|
60
66
|
|
67
|
+
@with_knex
|
61
68
|
def result_folder_from_id(knex, id):
|
62
69
|
"""Return a result folder object which the id points to.
|
63
70
|
|
@@ -66,16 +73,19 @@ def result_folder_from_id(knex, id):
|
|
66
73
|
return _generic_from_id(knex, id, result_folder_from_uuid, result_folder_from_name)
|
67
74
|
|
68
75
|
|
76
|
+
@with_knex
|
69
77
|
def sample_result_file_from_id(knex, id):
|
70
78
|
"""Return the sample result file object which the id points to."""
|
71
79
|
return _generic_from_id(knex, id, sample_result_file_from_uuid, sample_result_file_from_name)
|
72
80
|
|
73
81
|
|
82
|
+
@with_knex
|
74
83
|
def project_result_file_from_id(knex, id):
|
75
84
|
"""Return the project result file object which the id points to."""
|
76
85
|
return _generic_from_id(knex, id, project_result_file_from_uuid, project_result_file_from_name)
|
77
86
|
|
78
87
|
|
88
|
+
@with_knex
|
79
89
|
def result_file_from_id(knex, id):
|
80
90
|
"""Return a result file object which the id points to.
|
81
91
|
|
@@ -14,8 +14,10 @@ This makes them more human-readable, but not reliable for permanent references.
|
|
14
14
|
"""
|
15
15
|
from geoseeq.organization import Organization
|
16
16
|
from geoseeq import GeoseeqNotFoundError
|
17
|
+
from geoseeq.knex import with_knex
|
17
18
|
|
18
19
|
|
20
|
+
@with_knex
|
19
21
|
def org_from_name(knex, name):
|
20
22
|
"""Return the organization object which the name points to.
|
21
23
|
|
@@ -28,6 +30,7 @@ def org_from_name(knex, name):
|
|
28
30
|
return org
|
29
31
|
|
30
32
|
|
33
|
+
@with_knex
|
31
34
|
def project_from_name(knex, name):
|
32
35
|
"""Return the project object which the name points to.
|
33
36
|
|
@@ -41,6 +44,7 @@ def project_from_name(knex, name):
|
|
41
44
|
return proj
|
42
45
|
|
43
46
|
|
47
|
+
@with_knex
|
44
48
|
def sample_from_name(knex, name):
|
45
49
|
"""Return the sample object which the name points to.
|
46
50
|
|
@@ -54,6 +58,7 @@ def sample_from_name(knex, name):
|
|
54
58
|
return sample
|
55
59
|
|
56
60
|
|
61
|
+
@with_knex
|
57
62
|
def sample_result_folder_from_name(knex, name):
|
58
63
|
"""Return the sample result folder object which the name points to.
|
59
64
|
|
@@ -67,6 +72,7 @@ def sample_result_folder_from_name(knex, name):
|
|
67
72
|
return ar
|
68
73
|
|
69
74
|
|
75
|
+
@with_knex
|
70
76
|
def project_result_folder_from_name(knex, name):
|
71
77
|
"""Return the project result folder object which the name points to.
|
72
78
|
|
@@ -80,6 +86,7 @@ def project_result_folder_from_name(knex, name):
|
|
80
86
|
return rf
|
81
87
|
|
82
88
|
|
89
|
+
@with_knex
|
83
90
|
def result_folder_from_name(knex, name):
|
84
91
|
"""Return a result folder object which the name points to.
|
85
92
|
|
@@ -95,6 +102,7 @@ def result_folder_from_name(knex, name):
|
|
95
102
|
return project_result_folder_from_name(knex, name)
|
96
103
|
|
97
104
|
|
105
|
+
@with_knex
|
98
106
|
def sample_result_file_from_name(knex, name):
|
99
107
|
"""Return the sample result file object which the name points to.
|
100
108
|
|
@@ -108,6 +116,7 @@ def sample_result_file_from_name(knex, name):
|
|
108
116
|
return r_file
|
109
117
|
|
110
118
|
|
119
|
+
@with_knex
|
111
120
|
def project_result_file_from_name(knex, name):
|
112
121
|
"""Return the project result file object which the name points to.
|
113
122
|
|
@@ -121,6 +130,7 @@ def project_result_file_from_name(knex, name):
|
|
121
130
|
return r_file
|
122
131
|
|
123
132
|
|
133
|
+
@with_knex
|
124
134
|
def result_file_from_name(knex, name):
|
125
135
|
"""Return a result file object which the name points to.
|
126
136
|
|
@@ -1,8 +1,9 @@
|
|
1
1
|
from geoseeq import GeoseeqNotFoundError
|
2
|
-
|
2
|
+
from geoseeq.knex import with_knex
|
3
3
|
from .from_blobs import *
|
4
4
|
|
5
5
|
|
6
|
+
@with_knex
|
6
7
|
def org_from_uuid(knex, uuid):
|
7
8
|
"""Return the organization object which the uuid points to."""
|
8
9
|
blob = knex.get(f"organizations/{uuid}")
|
@@ -10,6 +11,7 @@ def org_from_uuid(knex, uuid):
|
|
10
11
|
return org
|
11
12
|
|
12
13
|
|
14
|
+
@with_knex
|
13
15
|
def project_from_uuid(knex, uuid):
|
14
16
|
"""Return the project object which the uuid points to."""
|
15
17
|
blob = knex.get(f"sample_groups/{uuid}")
|
@@ -20,6 +22,7 @@ def project_from_uuid(knex, uuid):
|
|
20
22
|
sample_group_from_uuid = project_from_uuid # Alias
|
21
23
|
|
22
24
|
|
25
|
+
@with_knex
|
23
26
|
def sample_from_uuid(knex, uuid):
|
24
27
|
"""Return the sample object which the uuid points to."""
|
25
28
|
blob = knex.get(f"samples/{uuid}")
|
@@ -27,6 +30,7 @@ def sample_from_uuid(knex, uuid):
|
|
27
30
|
return sample
|
28
31
|
|
29
32
|
|
33
|
+
@with_knex
|
30
34
|
def sample_result_folder_from_uuid(knex, uuid):
|
31
35
|
"""Return the sample result folder object which the uuid points to."""
|
32
36
|
blob = knex.get(f"sample_ars/{uuid}")
|
@@ -37,6 +41,7 @@ def sample_result_folder_from_uuid(knex, uuid):
|
|
37
41
|
sample_ar_from_uuid = sample_result_folder_from_uuid # Alias
|
38
42
|
|
39
43
|
|
44
|
+
@with_knex
|
40
45
|
def project_result_folder_from_uuid(knex, uuid):
|
41
46
|
"""Return the project result folder object which the uuid points to."""
|
42
47
|
blob = knex.get(f"sample_group_ars/{uuid}")
|
@@ -47,6 +52,7 @@ def project_result_folder_from_uuid(knex, uuid):
|
|
47
52
|
sample_group_ar_from_uuid = project_result_folder_from_uuid # Alias
|
48
53
|
|
49
54
|
|
55
|
+
@with_knex
|
50
56
|
def result_folder_from_uuid(knex, uuid):
|
51
57
|
"""Return a result folder object which the uuid points to.
|
52
58
|
|
@@ -58,6 +64,7 @@ def result_folder_from_uuid(knex, uuid):
|
|
58
64
|
return project_result_folder_from_uuid(knex, uuid)
|
59
65
|
|
60
66
|
|
67
|
+
@with_knex
|
61
68
|
def sample_result_file_from_uuid(knex, uuid):
|
62
69
|
"""Return the sample result file object which the uuid points to."""
|
63
70
|
blob = knex.get(f"sample_ar_fields/{uuid}")
|
@@ -68,6 +75,7 @@ def sample_result_file_from_uuid(knex, uuid):
|
|
68
75
|
sample_ar_field_from_uuid = sample_result_file_from_uuid # Alias
|
69
76
|
|
70
77
|
|
78
|
+
@with_knex
|
71
79
|
def project_result_file_from_uuid(knex, uuid):
|
72
80
|
"""Return the project result file object which the uuid points to."""
|
73
81
|
blob = knex.get(f"sample_group_ar_fields/{uuid}")
|
@@ -78,6 +86,7 @@ def project_result_file_from_uuid(knex, uuid):
|
|
78
86
|
sample_group_ar_field_from_uuid = project_result_file_from_uuid # Alias
|
79
87
|
|
80
88
|
|
89
|
+
@with_knex
|
81
90
|
def result_file_from_uuid(knex, uuid):
|
82
91
|
"""Return a result file object which the uuid points to.
|
83
92
|
|
@@ -89,6 +98,7 @@ def result_file_from_uuid(knex, uuid):
|
|
89
98
|
return project_result_file_from_uuid(knex, uuid)
|
90
99
|
|
91
100
|
|
101
|
+
@with_knex
|
92
102
|
def pipeline_from_uuid(knex, uuid):
|
93
103
|
"""Return the pipeline object which the uuid points to."""
|
94
104
|
blob = knex.get(f"pipelines/{uuid}")
|
@@ -99,6 +109,7 @@ def pipeline_from_uuid(knex, uuid):
|
|
99
109
|
app_from_uuid = pipeline_from_uuid # Alias
|
100
110
|
|
101
111
|
|
112
|
+
@with_knex
|
102
113
|
def pipeline_run_from_uuid(knex, uuid):
|
103
114
|
"""Return a pipeline run object which the uuid points to."""
|
104
115
|
blob = knex.get(f"app_runs/{uuid}")
|
@@ -22,8 +22,10 @@ from .from_names import (
|
|
22
22
|
result_file_from_name,
|
23
23
|
)
|
24
24
|
from .utils import is_name, is_grn
|
25
|
+
from geoseeq.knex import with_knex
|
25
26
|
|
26
27
|
|
28
|
+
@with_knex
|
27
29
|
def resolve_id(knex, id):
|
28
30
|
"""Return the object which the id points to."""
|
29
31
|
if is_grn(id):
|
@@ -33,6 +35,7 @@ def resolve_id(knex, id):
|
|
33
35
|
raise ValueError(f'"{id}" is not a GRN, or name. UUIDs cannot be resolved without a type')
|
34
36
|
|
35
37
|
|
38
|
+
@with_knex
|
36
39
|
def resolve_name(knex, name):
|
37
40
|
"""Return the object which the name points to."""
|
38
41
|
assert is_name(name), f'"{name}" is not a name'
|
@@ -56,6 +59,7 @@ def resolve_name(knex, name):
|
|
56
59
|
raise GeoseeqNotFoundError(f'Name "{name}" not found')
|
57
60
|
|
58
61
|
|
62
|
+
@with_knex
|
59
63
|
def resolve_grn(knex, grn):
|
60
64
|
"""Return the object which the grn points to."""
|
61
65
|
assert is_grn(grn), f'"{grn}" is not a GRN'
|
geoseeq/knex.py
CHANGED
@@ -2,8 +2,8 @@ import logging
|
|
2
2
|
import requests
|
3
3
|
from os import environ
|
4
4
|
from .file_system_cache import FileSystemCache
|
5
|
-
|
6
|
-
|
5
|
+
from geoseeq.utils import load_auth_profile
|
6
|
+
from geoseeq.constants import DEFAULT_ENDPOINT
|
7
7
|
|
8
8
|
|
9
9
|
logger = logging.getLogger("geoseeq_api") # Same name as calling module
|
@@ -205,3 +205,36 @@ class Knex:
|
|
205
205
|
response = self.sess.delete(f"{self.endpoint_url}/{url}", json=json)
|
206
206
|
logger.debug(f"DELETE request response:\n{response}")
|
207
207
|
return self._handle_response(response, json_response=False, **kwargs)
|
208
|
+
|
209
|
+
@classmethod
|
210
|
+
def load_profile(cls, profile=""):
|
211
|
+
"""Return a knex authenticated with a profile."""
|
212
|
+
endpoint, token = load_auth_profile(profile)
|
213
|
+
knex = cls(endpoint)
|
214
|
+
knex.add_api_token(token)
|
215
|
+
return knex
|
216
|
+
|
217
|
+
|
218
|
+
def with_knex(func):
|
219
|
+
def wrapper(*args, **kwargs):
|
220
|
+
# check if any of the arguments are a knex instance
|
221
|
+
any_knex = any([isinstance(arg, Knex) for arg in args])
|
222
|
+
if any_knex:
|
223
|
+
return func(*args, **kwargs)
|
224
|
+
else:
|
225
|
+
varnames = [
|
226
|
+
varname for varname in func.__code__.co_varnames
|
227
|
+
if varname != "knex"
|
228
|
+
]
|
229
|
+
kwargs.update(zip(varnames, args))
|
230
|
+
if "knex" not in kwargs:
|
231
|
+
profile = kwargs.pop("profile", "")
|
232
|
+
kwargs['knex'] = Knex.load_profile(profile=profile)
|
233
|
+
# reorder kwargs to match the function signature
|
234
|
+
reordered = {
|
235
|
+
key: kwargs[key] for key in func.__code__.co_varnames
|
236
|
+
if key in kwargs
|
237
|
+
}
|
238
|
+
return func(**reordered)
|
239
|
+
return wrapper
|
240
|
+
|
geoseeq/project.py
CHANGED
@@ -260,7 +260,7 @@ class Project(RemoteObject):
|
|
260
260
|
@property
|
261
261
|
def n_samples(self):
|
262
262
|
"""Return the number of samples in this project."""
|
263
|
-
if
|
263
|
+
if hasattr(self, 'samples_count') and self.samples_count is not None:
|
264
264
|
return self.samples_count
|
265
265
|
return len(list(self.get_sample_uuids()))
|
266
266
|
|
geoseeq/utils.py
CHANGED
@@ -4,11 +4,47 @@ import logging
|
|
4
4
|
from ftplib import FTP
|
5
5
|
from threading import Timer
|
6
6
|
from .file_system_cache import FileSystemCache
|
7
|
+
from os.path import join, exists
|
8
|
+
import json
|
9
|
+
from os import environ, makedirs
|
10
|
+
from .constants import CONFIG_DIR, PROFILES_PATH, DEFAULT_ENDPOINT
|
7
11
|
|
8
12
|
logger = logging.getLogger('geoseeq_api') # Same name as calling module
|
9
13
|
logger.addHandler(logging.NullHandler()) # No output unless configured by calling program
|
10
14
|
|
11
15
|
|
16
|
+
def load_auth_profile(profile=""):
|
17
|
+
"""Return an endpoit and a token"""
|
18
|
+
profile = profile or "__default__"
|
19
|
+
with open(PROFILES_PATH, "r") as f:
|
20
|
+
profiles = json.load(f)
|
21
|
+
if profile in profiles:
|
22
|
+
return profiles[profile]["endpoint"], profiles[profile]["token"]
|
23
|
+
raise KeyError(f"Profile {profile} not found.")
|
24
|
+
|
25
|
+
|
26
|
+
def set_profile(token, endpoint=DEFAULT_ENDPOINT, profile="", overwrite=False):
|
27
|
+
"""Write a profile to a config file.
|
28
|
+
|
29
|
+
Raises KeyError if profile already exists.
|
30
|
+
"""
|
31
|
+
if not exists(PROFILES_PATH):
|
32
|
+
makedirs(CONFIG_DIR)
|
33
|
+
with open(PROFILES_PATH, "w") as f:
|
34
|
+
json.dump({}, f)
|
35
|
+
with open(PROFILES_PATH, "r") as f:
|
36
|
+
profiles = json.load(f)
|
37
|
+
profile = profile or "__default__"
|
38
|
+
if profile in profiles and not overwrite:
|
39
|
+
raise KeyError(f"Profile {profile} already exists.")
|
40
|
+
profiles[profile] = {
|
41
|
+
"token": token,
|
42
|
+
"endpoint": endpoint,
|
43
|
+
}
|
44
|
+
with open(PROFILES_PATH, "w") as f:
|
45
|
+
json.dump(profiles, f, indent=4)
|
46
|
+
|
47
|
+
|
12
48
|
def paginated_iterator(knex, initial_url, error_handler=None):
|
13
49
|
cache = FileSystemCache()
|
14
50
|
result = cache.get_cached_blob(initial_url)
|
@@ -2,17 +2,17 @@ geoseeq/__init__.py,sha256=FxA5ioZVxUR3XAjllE5F2mtcUk8NDSBD-VYmMp6U254,864
|
|
2
2
|
geoseeq/app.py,sha256=Y6d1UzxFLfE3RNccATbFCVi6kH3eFmzwoUbeR2Ry09A,2387
|
3
3
|
geoseeq/blob_constructors.py,sha256=AkWpDQY0EdGMxF1p6eRspyHKubcUdiW4it-_Q7S2QWk,188
|
4
4
|
geoseeq/bulk_creators.py,sha256=pdn-Dv7yv5SFv-PfDuQbuOnw2W4-BfIfRJVRAhM8U6s,2115
|
5
|
-
geoseeq/constants.py,sha256=
|
5
|
+
geoseeq/constants.py,sha256=h9RURz4xs2bZyDrSGocej7ANJvRLr_H1H7JRxpNUXJM,431
|
6
6
|
geoseeq/file_system_cache.py,sha256=7pdM-1VncOvjkYv2pOocPHOXnEWz0jKhH6sm1LaXtoU,3405
|
7
|
-
geoseeq/knex.py,sha256=
|
7
|
+
geoseeq/knex.py,sha256=6fPO8F8yxgBgBXZiliMJvYYjgf_16chfJPyWLe-kpPk,7898
|
8
8
|
geoseeq/organization.py,sha256=a9xmGDE0tQsjPJfyFkYnWagxZ8xpdeckkwvkhH6LNIk,2462
|
9
9
|
geoseeq/pipeline.py,sha256=89mhWaecsKnm6tyRkdkaVp4dmZh62_v42Ze0oXf8OTY,9873
|
10
|
-
geoseeq/project.py,sha256=
|
10
|
+
geoseeq/project.py,sha256=NylHnDY8yWP2cyj4eUuLDnu-65UfjD5ehABQFww7W9g,13660
|
11
11
|
geoseeq/remote_object.py,sha256=6owZTIubA2wwbA4AiL0HdfWDMpZjOhUgqv_KxNG2XZg,6613
|
12
12
|
geoseeq/sample.py,sha256=TRz3zqTX8cK4xIicbqLGS4hAmMfsnNhDBCcHqquKdLg,7069
|
13
13
|
geoseeq/search.py,sha256=gawad6Cx5FxJBPlYkXWb-UKAO-UC0_yhvyU9Ca1kaNI,3388
|
14
14
|
geoseeq/user.py,sha256=tol8i1UGLRrbMw5jeJDnna1ikRgrCDd50Jxz0a1lSgg,690
|
15
|
-
geoseeq/utils.py,sha256=
|
15
|
+
geoseeq/utils.py,sha256=PDRiEQIZYTcfEV9AYvloQVvfqs5JaebcFZodAa2SUW8,3577
|
16
16
|
geoseeq/work_orders.py,sha256=5uLVVfdKE8qh4gGaHkdBpXJGRTujuSg59knWCqEET4A,8071
|
17
17
|
geoseeq/cli/__init__.py,sha256=4WnK87K5seRK3SGJAxNWnQTqyg5uBhdhrOrzB1D4b3M,24
|
18
18
|
geoseeq/cli/constants.py,sha256=Do5AUf9lMO9_P8KpFJ3XwwFBAWsxSjZ6sx9_QEGyC_c,176
|
@@ -21,7 +21,7 @@ geoseeq/cli/detail.py,sha256=q8Suu-j2k18knfSVFG-SWWGNsKM-n8y9RMA3LcIIi9Y,4132
|
|
21
21
|
geoseeq/cli/download.py,sha256=tOEy6zRWN_m8UBgkD2REFt7jqINSyA-o-w8eKACetdM,16212
|
22
22
|
geoseeq/cli/fastq_utils.py,sha256=-bmeQLaiMBm57zWOF0R5OlWTU0_3sh1JBC1RYw2BOFM,3083
|
23
23
|
geoseeq/cli/get_eula.py,sha256=79mbUwyiF7O1r0g6UTxG9kJGQEqKuH805E6eLkPC6Y4,997
|
24
|
-
geoseeq/cli/main.py,sha256=
|
24
|
+
geoseeq/cli/main.py,sha256=ZIitwb0FmonOAizsRum9NxB0vj7zq13v4qzaKR4_hzo,2908
|
25
25
|
geoseeq/cli/manage.py,sha256=wGXAcVaXqE5JQEU8Jh6OlHr02nB396bpS_SFcOZdrEo,5929
|
26
26
|
geoseeq/cli/progress_bar.py,sha256=p1Xl01nkYxSBZCB30ue2verIIi22W93m3ZAMAxipD0g,738
|
27
27
|
geoseeq/cli/run.py,sha256=bx2AV6VIqOSTlxUda78xl0XxcZ8TXlQx02-e7iLQPwI,3838
|
@@ -30,11 +30,11 @@ geoseeq/cli/user.py,sha256=fARv_5vx-QYT765Hsjgwr6J5ddA_viCPQdv9iUoVX6w,925
|
|
30
30
|
geoseeq/cli/utils.py,sha256=f0wX5-19uDrYZ8d-aBLplqfbGOkr5BH8x3AMSAyPCes,2873
|
31
31
|
geoseeq/cli/view.py,sha256=P-o2YKBkTrPzSI-JOv7xROc63HLSUygZNZsjp9TGvSw,6783
|
32
32
|
geoseeq/cli/shared_params/__init__.py,sha256=dfnfWjYIHyKkeewhCl4SzKA31bCQQNp31TOdAHwn4YY,255
|
33
|
-
geoseeq/cli/shared_params/common_state.py,sha256=
|
33
|
+
geoseeq/cli/shared_params/common_state.py,sha256=pZVaoJ4M4DFKF6Yfhqmj3TCjiezlKLsC8T-v58_rxNI,3540
|
34
34
|
geoseeq/cli/shared_params/config.py,sha256=06KrZhC3zljveo_21YvaZPcKIzyDBGHT_Yr79prr3eE,1412
|
35
35
|
geoseeq/cli/shared_params/id_handlers.py,sha256=rG6Wq2nYc0Pdu9MDNzV7PxiYj0lGHMRjSOyJKifpbGw,7195
|
36
36
|
geoseeq/cli/shared_params/obj_getters.py,sha256=ZSkt6LnDkVFlNVYKgLrjzg60-6BthZMr3eeD3HNqzac,2741
|
37
|
-
geoseeq/cli/shared_params/opts_and_args.py,sha256=
|
37
|
+
geoseeq/cli/shared_params/opts_and_args.py,sha256=6nytDMCcNqbIKZNiA4LfSPAKz7yImRc_w2qZkoPpIt8,1581
|
38
38
|
geoseeq/cli/upload/__init__.py,sha256=Wf30XGLllFFnnfeOnpYsO3SXyaq8yclHcYxGUNdSh6o,562
|
39
39
|
geoseeq/cli/upload/upload.py,sha256=Ikly-vfLzDXpaMpyFTim1CfgqNjtrnRQHgOMi_7JubU,6367
|
40
40
|
geoseeq/cli/upload/upload_advanced.py,sha256=Jq5eGe-wOdrzxGWVwaFPg0BAJcW0YSx_eHEmYjJeKuA,3434
|
@@ -46,11 +46,11 @@ geoseeq/contrib/ncbi/bioproject.py,sha256=_oThTd_iLDOC8cLOlJKAatSr362OBYZCEV3Yrq
|
|
46
46
|
geoseeq/contrib/ncbi/cli.py,sha256=j9zEcaZPTryK3a4xluRxigcJKDhRpRxbp3KZSx-Bfhk,2400
|
47
47
|
geoseeq/contrib/ncbi/setup_logging.py,sha256=Tp1bY1U0f-o739aHpvVYriG2qdd1lFvCYBXZeXQgt-w,175
|
48
48
|
geoseeq/id_constructors/__init__.py,sha256=w5E0PNQ9UuAxBeZbDI7KBnUoERd85gGz3nScz45bd2o,126
|
49
|
-
geoseeq/id_constructors/from_blobs.py,sha256=
|
50
|
-
geoseeq/id_constructors/from_ids.py,sha256=
|
51
|
-
geoseeq/id_constructors/from_names.py,sha256=
|
52
|
-
geoseeq/id_constructors/from_uuids.py,sha256=
|
53
|
-
geoseeq/id_constructors/resolvers.py,sha256=
|
49
|
+
geoseeq/id_constructors/from_blobs.py,sha256=uuFSG99_5R2JrN2rNj_vKWOT-I7h80y_w8ANSjawiSc,5177
|
50
|
+
geoseeq/id_constructors/from_ids.py,sha256=zBAKTzv1ZY9kCKl1QBTWsKg610nCVQgJ0IA9c1umd40,3050
|
51
|
+
geoseeq/id_constructors/from_names.py,sha256=RqgFjDsAwQcidMkZwX7oB00OvBAKTiilHYetTPogJ40,4174
|
52
|
+
geoseeq/id_constructors/from_uuids.py,sha256=5NrQoRBNBfiB48SIB6QFZvO0lxNrxAHbu1MDkNRSu_4,3305
|
53
|
+
geoseeq/id_constructors/resolvers.py,sha256=8hp5xJSCoZrAXtMT54Hp4okt63l909XqJU3IQx-VCgc,2676
|
54
54
|
geoseeq/id_constructors/utils.py,sha256=CKlZHGMiqi1b6r1KtgD3czSAomH99Gdfx5ziqaahz-0,723
|
55
55
|
geoseeq/plotting/__init__.py,sha256=RkGoXxgu7jEfK0B7NmdalPS2AbU7I7dZwDbi4rn9CKM,154
|
56
56
|
geoseeq/plotting/constants.py,sha256=CGUlm8WAFG3YRKdicc9Rcy5hFxUdUm2RgK0iXZWLuX8,285
|
@@ -79,9 +79,9 @@ geoseeq/vc/vc_stub.py,sha256=IQr8dI0zsWKVAeY_5ybDD6n49_3othcgfHS3P0O9tuY,3110
|
|
79
79
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
80
80
|
tests/test_api_client.py,sha256=TS5njc5pcPP_Ycy-ljcfPVT1hQRBsFVdQ0lCqBmoesU,12810
|
81
81
|
tests/test_plotting.py,sha256=TcTu-2ARr8sxZJ7wPQxmbs3-gHw7uRvsgrhhhg0qKik,784
|
82
|
-
geoseeq-0.
|
83
|
-
geoseeq-0.
|
84
|
-
geoseeq-0.
|
85
|
-
geoseeq-0.
|
86
|
-
geoseeq-0.
|
87
|
-
geoseeq-0.
|
82
|
+
geoseeq-0.5.0.dist-info/LICENSE,sha256=IuhIl1XCxXLPLJT_coN1CNqQU4Khlq7x4IdW7ioOJD8,1067
|
83
|
+
geoseeq-0.5.0.dist-info/METADATA,sha256=Ys96LvjvqsNyOfAgaHy4Y-RnN0qdc8UQ_VS0h89Icaw,454
|
84
|
+
geoseeq-0.5.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
85
|
+
geoseeq-0.5.0.dist-info/entry_points.txt,sha256=yF-6KDM8zXib4Al0qn49TX-qM7PUkWUIcYtsgt36rjM,45
|
86
|
+
geoseeq-0.5.0.dist-info/top_level.txt,sha256=zZk7mmeaqAYqFJG8nq2DTgSQPbflRjJwkDIhNURPDEU,14
|
87
|
+
geoseeq-0.5.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|