esgpull 0.7.1__py3-none-any.whl → 0.7.3__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.
- esgpull/cli/utils.py +18 -24
- esgpull/context.py +6 -1
- esgpull/migrations/versions/0.7.2_update_tables.py +28 -0
- esgpull/migrations/versions/0.7.3_update_tables.py +28 -0
- {esgpull-0.7.1.dist-info → esgpull-0.7.3.dist-info}/METADATA +13 -1
- {esgpull-0.7.1.dist-info → esgpull-0.7.3.dist-info}/RECORD +9 -7
- {esgpull-0.7.1.dist-info → esgpull-0.7.3.dist-info}/WHEEL +0 -0
- {esgpull-0.7.1.dist-info → esgpull-0.7.3.dist-info}/entry_points.txt +0 -0
- {esgpull-0.7.1.dist-info → esgpull-0.7.3.dist-info}/licenses/LICENSE +0 -0
esgpull/cli/utils.py
CHANGED
|
@@ -15,7 +15,7 @@ from rich.text import Text
|
|
|
15
15
|
from esgpull import Esgpull
|
|
16
16
|
from esgpull.graph import Graph
|
|
17
17
|
from esgpull.models import Dataset, File, Option, Options, Query, Selection
|
|
18
|
-
from esgpull.tui import UI, TempUI, Verbosity
|
|
18
|
+
from esgpull.tui import UI, TempUI, Verbosity, logger
|
|
19
19
|
from esgpull.utils import format_size
|
|
20
20
|
|
|
21
21
|
|
|
@@ -121,9 +121,15 @@ def totable(docs: list[OrderedDict[str, Any]]) -> Table:
|
|
|
121
121
|
return table
|
|
122
122
|
|
|
123
123
|
|
|
124
|
+
def safe_value(value: str) -> str:
|
|
125
|
+
if " " in value:
|
|
126
|
+
return f'"{value}"'
|
|
127
|
+
else:
|
|
128
|
+
return value
|
|
129
|
+
|
|
130
|
+
|
|
124
131
|
def parse_facets(facets: list[str]) -> Selection:
|
|
125
132
|
facet_dict: dict[str, list[str]] = {}
|
|
126
|
-
exact_terms: list[str] | None = None
|
|
127
133
|
for facet in facets:
|
|
128
134
|
match facet.split(":"):
|
|
129
135
|
case [value]:
|
|
@@ -132,28 +138,9 @@ def parse_facets(facets: list[str]) -> Selection:
|
|
|
132
138
|
...
|
|
133
139
|
case _:
|
|
134
140
|
raise BadArgumentUsage(f"{facet!r} is not valid syntax.")
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
exact_terms = []
|
|
139
|
-
if exact_terms is not None:
|
|
140
|
-
if name != "query":
|
|
141
|
-
raise BadArgumentUsage(
|
|
142
|
-
"Cannot use facet term inside an exact string."
|
|
143
|
-
)
|
|
144
|
-
exact_terms.append(value)
|
|
145
|
-
if value.endswith("/"):
|
|
146
|
-
final_exact_str = " ".join(exact_terms)
|
|
147
|
-
value = '"' + final_exact_str.strip("/") + '"'
|
|
148
|
-
exact_terms = None
|
|
149
|
-
else:
|
|
150
|
-
continue
|
|
151
|
-
facet_dict.setdefault(name, [])
|
|
152
|
-
facet_dict[name].append(value)
|
|
153
|
-
else:
|
|
154
|
-
values = value.split(",")
|
|
155
|
-
facet_dict.setdefault(name, [])
|
|
156
|
-
facet_dict[name].extend(values)
|
|
141
|
+
values = list(map(safe_value, value.split(",")))
|
|
142
|
+
facet_dict.setdefault(name, [])
|
|
143
|
+
facet_dict[name].extend(values)
|
|
157
144
|
selection = Selection()
|
|
158
145
|
for name, values in facet_dict.items():
|
|
159
146
|
selection[name] = values
|
|
@@ -170,6 +157,13 @@ def parse_query(
|
|
|
170
157
|
replica: str | None,
|
|
171
158
|
retracted: str | None,
|
|
172
159
|
) -> Query:
|
|
160
|
+
logger.info(f"{facets=}")
|
|
161
|
+
logger.info(f"{tags=}")
|
|
162
|
+
logger.info(f"{require=}")
|
|
163
|
+
logger.info(f"{distrib=}")
|
|
164
|
+
logger.info(f"{latest=}")
|
|
165
|
+
logger.info(f"{replica=}")
|
|
166
|
+
logger.info(f"{retracted=}")
|
|
173
167
|
options = Options(
|
|
174
168
|
distrib=distrib or Option.notset,
|
|
175
169
|
latest=latest or Option.notset,
|
esgpull/context.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
|
+
import json
|
|
4
5
|
import sys
|
|
5
6
|
from collections.abc import AsyncIterator, Callable, Coroutine, Sequence
|
|
6
7
|
from dataclasses import dataclass, field
|
|
@@ -441,7 +442,9 @@ class Context:
|
|
|
441
442
|
try:
|
|
442
443
|
resp = await self.client.send(result.request)
|
|
443
444
|
resp.raise_for_status()
|
|
444
|
-
result.json =
|
|
445
|
+
result.json = json.loads(
|
|
446
|
+
resp.content.decode(encoding="latin-1")
|
|
447
|
+
)
|
|
445
448
|
logger.info(f"✓ Fetched in {resp.elapsed}s {resp.url}")
|
|
446
449
|
except HTTPError as exc:
|
|
447
450
|
result.exc = exc
|
|
@@ -464,6 +467,8 @@ class Context:
|
|
|
464
467
|
group = BaseExceptionGroup("fetch", excs)
|
|
465
468
|
if self.noraise:
|
|
466
469
|
logger.exception(group)
|
|
470
|
+
for exc in excs:
|
|
471
|
+
logger.exception(exc)
|
|
467
472
|
else:
|
|
468
473
|
raise group
|
|
469
474
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""update tables
|
|
2
|
+
|
|
3
|
+
Revision ID: 0.7.2
|
|
4
|
+
Revises: 0.7.1
|
|
5
|
+
Create Date: 2024-09-17 15:04:11.203421
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from alembic import op
|
|
9
|
+
import sqlalchemy as sa
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# revision identifiers, used by Alembic.
|
|
13
|
+
revision = '0.7.2'
|
|
14
|
+
down_revision = '0.7.1'
|
|
15
|
+
branch_labels = None
|
|
16
|
+
depends_on = None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def upgrade() -> None:
|
|
20
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
21
|
+
pass
|
|
22
|
+
# ### end Alembic commands ###
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def downgrade() -> None:
|
|
26
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
27
|
+
pass
|
|
28
|
+
# ### end Alembic commands ###
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""update tables
|
|
2
|
+
|
|
3
|
+
Revision ID: 0.7.3
|
|
4
|
+
Revises: 0.7.2
|
|
5
|
+
Create Date: 2024-09-20 12:22:11.989996
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from alembic import op
|
|
9
|
+
import sqlalchemy as sa
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# revision identifiers, used by Alembic.
|
|
13
|
+
revision = '0.7.3'
|
|
14
|
+
down_revision = '0.7.2'
|
|
15
|
+
branch_labels = None
|
|
16
|
+
depends_on = None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def upgrade() -> None:
|
|
20
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
21
|
+
pass
|
|
22
|
+
# ### end Alembic commands ###
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def downgrade() -> None:
|
|
26
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
27
|
+
pass
|
|
28
|
+
# ### end Alembic commands ###
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: esgpull
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.3
|
|
4
4
|
Summary: ESGF data discovery, download, replication tool
|
|
5
5
|
Project-URL: Repository, https://github.com/ESGF/esgf-download
|
|
6
6
|
Project-URL: Documentation, https://esgf.github.io/esgf-download/
|
|
@@ -60,6 +60,18 @@ for dataset in datasets:
|
|
|
60
60
|
- Command-line interface
|
|
61
61
|
- HTTP download (async multi-file)
|
|
62
62
|
|
|
63
|
+
## Installation
|
|
64
|
+
|
|
65
|
+
Install `esgpull` using pip or conda:
|
|
66
|
+
|
|
67
|
+
```shell
|
|
68
|
+
pip install esgpull
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```shell
|
|
72
|
+
conda install -c conda-forge ipsl::esgpull
|
|
73
|
+
```
|
|
74
|
+
|
|
63
75
|
## Usage
|
|
64
76
|
|
|
65
77
|
```console
|
|
@@ -2,7 +2,7 @@ esgpull/__init__.py,sha256=XItFDIMNmFUNNcKtUgXdfmGwUIWt4AAv0a4mZkfj5P8,240
|
|
|
2
2
|
esgpull/auth.py,sha256=QZ-l1ySLMP0fvuwYHRLv9FZYp1gqfju_eGaTMDByUxw,5205
|
|
3
3
|
esgpull/config.py,sha256=3E3jRGem09M_Hm1_uqWHu4dy7gzgShiUecZp-6XC9E4,12149
|
|
4
4
|
esgpull/constants.py,sha256=fQE6vE2EU8V5m2lRNYBeMkL3u1_Em343Zs8u7i6ZRlo,1118
|
|
5
|
-
esgpull/context.py,sha256=
|
|
5
|
+
esgpull/context.py,sha256=ZywqCvIKZrW1pJln04993yxT6dW8yJ7fnx6LJL7Ot0E,23368
|
|
6
6
|
esgpull/database.py,sha256=TDo5xIXWyMEPFpaeygVhLZkeDAwYlkBG9UWhmL6ntfo,6144
|
|
7
7
|
esgpull/download.py,sha256=3YcGLrffzAmuiV49tYsW-7PuVYcSFtbsZnH2Q26khm0,5491
|
|
8
8
|
esgpull/esgpull.py,sha256=R7lnlyOo92FB_Qem5ST4hNA5Iwn9PHYsvCpKxqRX-qM,17717
|
|
@@ -36,7 +36,7 @@ esgpull/cli/show.py,sha256=4O1TvH31x9Fg-SI0a8dtblMZuJHJ30eBXOV9bwEl9Lk,1897
|
|
|
36
36
|
esgpull/cli/status.py,sha256=jgGBbmvcCjw21QTDNXdKAUo664p6junRg5kMwQ7My2I,2470
|
|
37
37
|
esgpull/cli/track.py,sha256=Q9ZvvV5FFGzp6wQZflAd_OFmqhAWgl1JFBad2dCbEF0,3089
|
|
38
38
|
esgpull/cli/update.py,sha256=x_R4x7hdUp5qowcFUibIMozwWTlJybuZMY_EXWhj_kI,7024
|
|
39
|
-
esgpull/cli/utils.py,sha256=
|
|
39
|
+
esgpull/cli/utils.py,sha256=tTmEiti8UgBYf_eWUozGjCGCGIJ-mPPXGwBf0jK8wuQ,6826
|
|
40
40
|
esgpull/migrations/README,sha256=heMzebYwlGhnE8_4CWJ4LS74WoEZjBy-S-mIJRxAEKI,39
|
|
41
41
|
esgpull/migrations/env.py,sha256=am2HhFrlIZNlXCaA5Ye7yKbIJ2MRSO5UFmUwB8l9fyE,2285
|
|
42
42
|
esgpull/migrations/script.py.mako,sha256=HNlf26BI1xvQKjiUojnj15BPrVUfVVr81IOgliJf83c,510
|
|
@@ -64,6 +64,8 @@ esgpull/migrations/versions/0.6.4_update_tables.py,sha256=PFALlSAjCFOqqoQgjq2TF0
|
|
|
64
64
|
esgpull/migrations/versions/0.6.5_update_tables.py,sha256=NYO8vnS4h_g4Co4M1CJibB2WYLqmVAy6ZaApFk-do3c,493
|
|
65
65
|
esgpull/migrations/versions/0.7.0_update_tables.py,sha256=aCmR7q-1V49JIfvFR-1iVskTwR3J8O1iKysgF0oJZ4k,971
|
|
66
66
|
esgpull/migrations/versions/0.7.1_update_tables.py,sha256=f_PakdA0ZKmekcWWDC86u5PlUrF_Kl2xzkNV3Am9sd0,541
|
|
67
|
+
esgpull/migrations/versions/0.7.2_update_tables.py,sha256=cBWEhfYQlhGpE55NOY9eD2psIb3HS7KOa9g-_3y0nQA,541
|
|
68
|
+
esgpull/migrations/versions/0.7.3_update_tables.py,sha256=4pNkM7VaGQqkLuIoLKuM0ftefLjDBVFRaV8Nkq5OL-Y,541
|
|
67
69
|
esgpull/models/__init__.py,sha256=rfa1yGLVDahFrnhq_8TPGzr7_oeBOFKNVD9EF0slUtY,725
|
|
68
70
|
esgpull/models/base.py,sha256=3nbR2lYMHWfovWz4EiAJ2bIvKpMadRvYZDdMRQDvN7M,1237
|
|
69
71
|
esgpull/models/dataset.py,sha256=1fOIVYIWKK5BivqvBpjfxrNpy9VfUHZng9Yc6ipPK1Q,905
|
|
@@ -76,8 +78,8 @@ esgpull/models/sql.py,sha256=Wlw9cGJ_buv51qC0grV8HvprEwoG92e2zagxkQXKosk,7481
|
|
|
76
78
|
esgpull/models/synda_file.py,sha256=6o5unPhzVJGnbpA2MxcS0r-hrBwocHYVnLrqjSGtmuk,2387
|
|
77
79
|
esgpull/models/tag.py,sha256=5CQDB9rAeCqog63ec9LPFN46HOFNkHPy-maY4gkBQ3E,461
|
|
78
80
|
esgpull/models/utils.py,sha256=exwlIlIKYjhhfUE82w1kU_HeSQOSY97PTvpkhW0udMA,1631
|
|
79
|
-
esgpull-0.7.
|
|
80
|
-
esgpull-0.7.
|
|
81
|
-
esgpull-0.7.
|
|
82
|
-
esgpull-0.7.
|
|
83
|
-
esgpull-0.7.
|
|
81
|
+
esgpull-0.7.3.dist-info/METADATA,sha256=3QSuofTjEamQ7oc5Idx8N5qRswwRLxz5IaLvVfZyYU8,3199
|
|
82
|
+
esgpull-0.7.3.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
83
|
+
esgpull-0.7.3.dist-info/entry_points.txt,sha256=vyh7HvFrCp4iyMrTkDoSF3weaYrlNj2OJe0Fq5q4QB4,45
|
|
84
|
+
esgpull-0.7.3.dist-info/licenses/LICENSE,sha256=lUqGPGWDHHxjkUDuYgjLLY2XQXXn_EHU7fnrQWHGugc,1540
|
|
85
|
+
esgpull-0.7.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|