eotdl 2023.6.14.post8__py3-none-any.whl → 2023.6.14.post10__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.
- eotdl/auth/__init__.py +1 -1
- eotdl/auth/main.py +10 -3
- eotdl/commands/datasets.py +3 -6
- eotdl/datasets/__init__.py +1 -1
- eotdl/datasets/download.py +4 -2
- eotdl/datasets/ingest.py +15 -14
- eotdl/datasets/retrieve.py +5 -2
- eotdl/datasets/update.py +4 -2
- eotdl/src/repos/APIRepo.py +3 -1
- eotdl/src/repos/AuthRepo.py +18 -13
- eotdl/src/usecases/auth/__init__.py +3 -0
- eotdl/src/usecases/datasets/DownloadDataset.py +1 -1
- eotdl/src/usecases/datasets/IngestDataset.py +1 -1
- eotdl/src/usecases/datasets/IngestLargeDataset.py +1 -1
- eotdl/src/usecases/datasets/UpdateDataset.py +1 -1
- eotdl/src/usecases/datasets/__init__.py +6 -0
- {eotdl-2023.6.14.post8.dist-info → eotdl-2023.6.14.post10.dist-info}/METADATA +1 -1
- {eotdl-2023.6.14.post8.dist-info → eotdl-2023.6.14.post10.dist-info}/RECORD +20 -20
- {eotdl-2023.6.14.post8.dist-info → eotdl-2023.6.14.post10.dist-info}/WHEEL +0 -0
- {eotdl-2023.6.14.post8.dist-info → eotdl-2023.6.14.post10.dist-info}/entry_points.txt +0 -0
eotdl/auth/__init__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
from .main import is_logged, auth, generate_logout_url
|
1
|
+
from .main import is_logged, auth, generate_logout_url, with_auth
|
eotdl/auth/main.py
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
from ..src.repos import AuthRepo, APIRepo
|
2
|
-
from ..src.usecases.auth
|
3
|
-
from ..src.usecases.auth.Auth import Auth
|
4
|
-
from ..src.usecases.auth.Logout import Logout
|
2
|
+
from ..src.usecases.auth import IsLogged, Auth, Logout
|
5
3
|
|
6
4
|
|
7
5
|
def is_logged():
|
@@ -31,3 +29,12 @@ def generate_logout_url():
|
|
31
29
|
inputs = _logout.Inputs()
|
32
30
|
outputs = _logout(inputs)
|
33
31
|
return outputs.logout_url
|
32
|
+
|
33
|
+
|
34
|
+
# auth decorator
|
35
|
+
def with_auth(func):
|
36
|
+
def wrapper(*args, **kwargs):
|
37
|
+
user = auth()
|
38
|
+
return func(*args, **kwargs, user=user)
|
39
|
+
|
40
|
+
return wrapper
|
eotdl/commands/datasets.py
CHANGED
@@ -29,8 +29,7 @@ def get(name: str, path: str = None):
|
|
29
29
|
path: Path to download the dataset to
|
30
30
|
"""
|
31
31
|
try:
|
32
|
-
|
33
|
-
dst_path = download_dataset(name, path, user, typer.echo)
|
32
|
+
dst_path = download_dataset(name, path, typer.echo)
|
34
33
|
typer.echo(f"Dataset {name} downloaded to {dst_path}")
|
35
34
|
except Exception as e:
|
36
35
|
typer.echo(e)
|
@@ -49,10 +48,9 @@ def ingest(
|
|
49
48
|
n: Name of the dataset
|
50
49
|
"""
|
51
50
|
try:
|
52
|
-
user = auth()
|
53
51
|
# if p:
|
54
52
|
# ingest_large_dataset_parallel(name, path, user, p, typer.echo)
|
55
|
-
ingest_large_dataset(name, path,
|
53
|
+
ingest_large_dataset(name, path, typer.echo)
|
56
54
|
typer.echo(f"Dataset {name} ingested")
|
57
55
|
except Exception as e:
|
58
56
|
typer.echo(e)
|
@@ -70,8 +68,7 @@ def update(
|
|
70
68
|
path: Path to dataset to ingest
|
71
69
|
"""
|
72
70
|
try:
|
73
|
-
|
74
|
-
update_dataset(name, path, user, typer.echo)
|
71
|
+
update_dataset(name, path, typer.echo)
|
75
72
|
typer.echo(f"Dataset {name} updated")
|
76
73
|
except Exception as e:
|
77
74
|
typer.echo(e)
|
eotdl/datasets/__init__.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
from .ingest import ingest_dataset, ingest_large_dataset, ingest_q0, ingest_q1
|
2
2
|
from .download import download_dataset
|
3
|
-
from .retrieve import retrieve_datasets, retrieve_dataset
|
3
|
+
from .retrieve import retrieve_datasets, retrieve_dataset, list_datasets
|
4
4
|
from .update import update_dataset
|
eotdl/datasets/download.py
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
from ..src.repos import APIRepo
|
2
|
-
from ..src.usecases.datasets
|
2
|
+
from ..src.usecases.datasets import DownloadDataset
|
3
3
|
from .retrieve import retrieve_dataset
|
4
|
+
from ..auth import with_auth
|
4
5
|
|
5
6
|
|
6
|
-
|
7
|
+
@with_auth
|
8
|
+
def download_dataset(name, path=None, logger=None, user=None):
|
7
9
|
dataset = retrieve_dataset(name)
|
8
10
|
dataset_id = dataset["id"]
|
9
11
|
checksum = dataset["checksum"]
|
eotdl/datasets/ingest.py
CHANGED
@@ -1,19 +1,10 @@
|
|
1
1
|
from ..src.repos import APIRepo
|
2
|
-
from ..src.usecases.datasets
|
3
|
-
from ..
|
2
|
+
from ..src.usecases.datasets import IngestDataset, IngestLargeDataset
|
3
|
+
from ..auth import with_auth
|
4
4
|
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
return
|
9
|
-
|
10
|
-
|
11
|
-
def ingest_q1(dataset, stac_catalog):
|
12
|
-
print("hola")
|
13
|
-
return
|
14
|
-
|
15
|
-
|
16
|
-
def ingest_dataset(name, description, path, user, logger):
|
6
|
+
@with_auth
|
7
|
+
def ingest_dataset(name, description, path, logger=None, user=None):
|
17
8
|
api_repo = APIRepo()
|
18
9
|
ingest = IngestDataset(
|
19
10
|
api_repo,
|
@@ -23,9 +14,19 @@ def ingest_dataset(name, description, path, user, logger):
|
|
23
14
|
return outputs.dataset
|
24
15
|
|
25
16
|
|
26
|
-
|
17
|
+
@with_auth
|
18
|
+
def ingest_large_dataset(name, path, logger=None, user=None):
|
27
19
|
api_repo = APIRepo()
|
28
20
|
ingest = IngestLargeDataset(api_repo, logger)
|
29
21
|
inputs = ingest.Inputs(name=name, path=path, user=user)
|
30
22
|
outputs = ingest(inputs)
|
31
23
|
return outputs.dataset
|
24
|
+
|
25
|
+
|
26
|
+
def ingest_q0(dataset, path):
|
27
|
+
return ingest_large_dataset(dataset, path)
|
28
|
+
|
29
|
+
|
30
|
+
def ingest_q1(dataset, stac_catalog):
|
31
|
+
print("holas")
|
32
|
+
return
|
eotdl/datasets/retrieve.py
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
from ..src.repos import APIRepo
|
2
|
-
from ..src.usecases.datasets
|
3
|
-
|
2
|
+
from ..src.usecases.datasets import RetrieveDatasets, RetrieveDataset
|
3
|
+
|
4
|
+
|
5
|
+
def list_datasets():
|
6
|
+
return retrieve_datasets()
|
4
7
|
|
5
8
|
|
6
9
|
def retrieve_datasets():
|
eotdl/datasets/update.py
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
from ..src.repos import APIRepo
|
2
|
-
from ..src.usecases.datasets
|
2
|
+
from ..src.usecases.datasets import UpdateDataset
|
3
|
+
from ..auth import with_auth
|
3
4
|
|
4
5
|
|
5
|
-
|
6
|
+
@with_auth
|
7
|
+
def update_dataset(name, path, logger=None, user=None):
|
6
8
|
api_repo = APIRepo()
|
7
9
|
ingest = UpdateDataset(api_repo, logger)
|
8
10
|
inputs = ingest.Inputs(name=name, path=path, user=user)
|
eotdl/src/repos/APIRepo.py
CHANGED
@@ -35,7 +35,7 @@ class APIRepo:
|
|
35
35
|
url = self.url + "datasets/" + dataset_id + "/download"
|
36
36
|
headers = {"Authorization": "Bearer " + id_token}
|
37
37
|
if path is None:
|
38
|
-
path = str(Path.home()) + "/.
|
38
|
+
path = str(Path.home()) + "/.eotdl/datasets"
|
39
39
|
os.makedirs(path, exist_ok=True)
|
40
40
|
with requests.get(url, headers=headers, stream=True) as r:
|
41
41
|
r.raise_for_status()
|
@@ -46,6 +46,8 @@ class APIRepo:
|
|
46
46
|
)
|
47
47
|
filename = r.headers.get("content-disposition").split("filename=")[1][1:-1]
|
48
48
|
path = f"{path}/{filename}"
|
49
|
+
if os.path.exists(path):
|
50
|
+
raise Exception("File already exists")
|
49
51
|
with open(path, "wb") as f:
|
50
52
|
for chunk in r.iter_content(block_size):
|
51
53
|
progress_bar.update(len(chunk))
|
eotdl/src/repos/AuthRepo.py
CHANGED
@@ -1,31 +1,36 @@
|
|
1
1
|
from pathlib import Path
|
2
|
-
import os
|
3
|
-
import json
|
2
|
+
import os
|
3
|
+
import json
|
4
4
|
import jwt
|
5
5
|
|
6
|
-
|
6
|
+
|
7
|
+
class AuthRepo:
|
7
8
|
def __init__(self):
|
8
|
-
self.algorithms = [
|
9
|
+
self.algorithms = ["RS256"]
|
9
10
|
self.home = str(Path.home())
|
10
|
-
self.creds_path = self.home +
|
11
|
+
self.creds_path = self.home + "/.eotdl/creds.json"
|
11
12
|
|
12
13
|
def save_creds(self, data):
|
13
|
-
os.makedirs(self.home +
|
14
|
-
with open(self.creds_path,
|
14
|
+
os.makedirs(self.home + "/.eotdl", exist_ok=True)
|
15
|
+
with open(self.creds_path, "w") as f:
|
15
16
|
json.dump(data, f)
|
16
17
|
return self.creds_path
|
17
|
-
|
18
|
+
|
18
19
|
def load_creds(self):
|
19
20
|
if os.path.exists(self.creds_path):
|
20
|
-
with open(self.creds_path,
|
21
|
+
with open(self.creds_path, "r") as f:
|
21
22
|
creds = json.load(f)
|
22
23
|
user = self.decode_token(creds)
|
23
|
-
user[
|
24
|
+
user["id_token"] = creds["id_token"]
|
24
25
|
return user
|
25
26
|
return None
|
26
|
-
|
27
|
+
|
27
28
|
def decode_token(self, token_data):
|
28
|
-
return jwt.decode(
|
29
|
-
|
29
|
+
return jwt.decode(
|
30
|
+
token_data["id_token"],
|
31
|
+
algorithms=self.algorithms,
|
32
|
+
options={"verify_signature": False},
|
33
|
+
)
|
34
|
+
|
30
35
|
def logout(self):
|
31
36
|
os.remove(self.creds_path)
|
@@ -0,0 +1,6 @@
|
|
1
|
+
from .DownloadDataset import DownloadDataset
|
2
|
+
from .IngestDataset import IngestDataset
|
3
|
+
from .IngestLargeDataset import IngestLargeDataset
|
4
|
+
from .RetrieveDataset import RetrieveDataset
|
5
|
+
from .RetrieveDatasets import RetrieveDatasets
|
6
|
+
from .UpdateDataset import UpdateDataset
|
@@ -4,12 +4,12 @@ eotdl/access/parameters.py,sha256=g24CVwJR-KuHBgNyXj_Y6W2OoGSkKFN7IkidYDvPLws,36
|
|
4
4
|
eotdl/access/sentinelhub/__init__.py,sha256=v3P2WjEQuA9bmh8RHE3zuADSL_CEukTRyzR66J3kQVg,252
|
5
5
|
eotdl/access/sentinelhub/client.py,sha256=skL3EfVuBLSoOc8gbbsWuAe9UTDYSI1IdpqU8HsdNW4,7605
|
6
6
|
eotdl/access/sentinelhub/utils.py,sha256=4xzAOoxA4A3EmBD1HX7IAbiXl9cMTfYabq0wGkFrx8A,6595
|
7
|
-
eotdl/auth/__init__.py,sha256=
|
8
|
-
eotdl/auth/main.py,sha256=
|
7
|
+
eotdl/auth/__init__.py,sha256=gN4x9suYveP1eZr5_7IisdTVy13B-Xnm_t6N_nwoI1o,66
|
8
|
+
eotdl/auth/main.py,sha256=q3-JcDbLJMEBSXa4Y7fofso4iK-b4QjL8QV0Ok7eqG8,857
|
9
9
|
eotdl/cli.py,sha256=MQt1XWTrqPC-onQcAeo5Oq_pIgBQh7KdYkFPoZiJQi0,193
|
10
10
|
eotdl/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
eotdl/commands/auth.py,sha256=_Kgud59Wp8Jc1Y-o8XZRXrtd_3QfRJ4d7H8HsCg0smg,937
|
12
|
-
eotdl/commands/datasets.py,sha256=
|
12
|
+
eotdl/commands/datasets.py,sha256=EVHJUJ0j3P4H6tF7sngNFgLwcG47upVHtunakrPkhbE,1485
|
13
13
|
eotdl/curation/__init__.py,sha256=wdcnj-u8fwObyjF8LNebwYyUULEfp3m41X1TSjURO6w,270
|
14
14
|
eotdl/curation/formatters.py,sha256=UllCEsWspqzoBOBy4iAz5oSh4AAMva88orFFmE5binA,2929
|
15
15
|
eotdl/curation/metadata.py,sha256=m6mcCr7UI3Mgij3FbhQAHWetXyADJIQoL2JTUas8GoU,1552
|
@@ -19,37 +19,37 @@ eotdl/curation/stac/extensions.py,sha256=I8SRMn9lyw_0sNZ-FiJ7HYPEGozylgf58gVWBSA
|
|
19
19
|
eotdl/curation/stac/parsers.py,sha256=KumL2ieBt0ATGgKoGyc-AJ99zSMeLD4-tI5MF9ruYPw,1380
|
20
20
|
eotdl/curation/stac/stac.py,sha256=COFpXQAvVBpgNf7qVv3DfIalBzdnvyVuDiEDEGgnYsA,17796
|
21
21
|
eotdl/curation/stac/utils.py,sha256=WxC1uRY3BJJh0GFgrU3IAV4-_vwMaUyeRYwUcySfj9k,1855
|
22
|
-
eotdl/datasets/__init__.py,sha256=
|
23
|
-
eotdl/datasets/download.py,sha256=
|
24
|
-
eotdl/datasets/ingest.py,sha256=
|
25
|
-
eotdl/datasets/retrieve.py,sha256=
|
26
|
-
eotdl/datasets/update.py,sha256=
|
22
|
+
eotdl/datasets/__init__.py,sha256=e_FZ1j6Qly-hLlCN4UrSdSfHjEID6YVHsDn20BUPps4,226
|
23
|
+
eotdl/datasets/download.py,sha256=b0vbA517fI95h1jA1pFGe-lBvesbpRRPHXhR6wQrPiI,568
|
24
|
+
eotdl/datasets/ingest.py,sha256=8656jxl-lMWYsEaI584iUAD451l-Jg8okN3X_7NU_Iw,846
|
25
|
+
eotdl/datasets/retrieve.py,sha256=sXQq5FEAAx48lf6GkaGg8zyMl4KnTRp8dU6JTUjF_RQ,534
|
26
|
+
eotdl/datasets/update.py,sha256=oePVcFnlVLEjMKy9Yls1so1lkRCbQBEmoIE6JRJ2gAA,366
|
27
27
|
eotdl/hello.py,sha256=bkYLbDXy00l9-wcHDRZT9GUhsgJOHLp3N8yfYaGg6mY,74
|
28
28
|
eotdl/src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
29
|
eotdl/src/errors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
30
30
|
eotdl/src/errors/auth.py,sha256=PpnFU2DvnRo8xrM77wgskKi0tfEJ1Rhle4xv2RD1qpk,306
|
31
|
-
eotdl/src/repos/APIRepo.py,sha256=
|
32
|
-
eotdl/src/repos/AuthRepo.py,sha256=
|
31
|
+
eotdl/src/repos/APIRepo.py,sha256=1cDUf-_4g87OXNksYtABWLhbuUrRSiU75m-eBjuRSgM,9935
|
32
|
+
eotdl/src/repos/AuthRepo.py,sha256=5Gwj7D4MgZWdvGFgoWPQeI_OM7Gv4XWc9lkD2wMy1k4,987
|
33
33
|
eotdl/src/repos/__init__.py,sha256=kJTtURg8RZ4GSwhFFyul-SX240r25wvLuwxIhyz9kmI,59
|
34
34
|
eotdl/src/usecases/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
35
|
eotdl/src/usecases/auth/Auth.py,sha256=e36UNqjXSxrkM30lBmEtPd8FZr49Xt_uyTj9yieX7es,1587
|
36
36
|
eotdl/src/usecases/auth/IsLogged.py,sha256=CTHKct0V1kCx54eQGElkzeDZoWN6CIppfDEFas6ToNI,332
|
37
37
|
eotdl/src/usecases/auth/Logout.py,sha256=ZlCMnaSerqBr6XOCcV858qq8IMTAizx6dta-UB5qoVE,420
|
38
|
-
eotdl/src/usecases/auth/__init__.py,sha256=
|
39
|
-
eotdl/src/usecases/datasets/DownloadDataset.py,sha256=
|
40
|
-
eotdl/src/usecases/datasets/IngestDataset.py,sha256=
|
41
|
-
eotdl/src/usecases/datasets/IngestLargeDataset.py,sha256=
|
38
|
+
eotdl/src/usecases/auth/__init__.py,sha256=w9zv66rZDKgwuzETCkvYefs2gcA1VEzvtQXfBt-KOSk,81
|
39
|
+
eotdl/src/usecases/datasets/DownloadDataset.py,sha256=tZ0jamae0HBU3T9jnum3Qh9jruvfRBSToW07-GjNj2A,788
|
40
|
+
eotdl/src/usecases/datasets/IngestDataset.py,sha256=d2H5nPXsEj-LhZpWGwNDSPs9uYNXRO2V07xsTFygQDc,953
|
41
|
+
eotdl/src/usecases/datasets/IngestLargeDataset.py,sha256=Q4sR2wyRyUsCwgFucKoNPc2SpbmX74IDXROmSwwyT4Q,1428
|
42
42
|
eotdl/src/usecases/datasets/IngestLargeDatasetParallel.py,sha256=egcl54K_Oi0BUSJeIdoQSl8BczBQXY1kCf3SWiLuc6s,1595
|
43
43
|
eotdl/src/usecases/datasets/RetrieveDataset.py,sha256=rmoSLllsPx3PCnIxLhR8yiibbk6xS1Pz9yvZ0RxhsHg,421
|
44
44
|
eotdl/src/usecases/datasets/RetrieveDatasets.py,sha256=NMtmVA4Ma6TxJwGbyW2KPgAEN4RV8SWRzKVivqbt0Lo,427
|
45
|
-
eotdl/src/usecases/datasets/UpdateDataset.py,sha256=
|
46
|
-
eotdl/src/usecases/datasets/__init__.py,sha256=
|
45
|
+
eotdl/src/usecases/datasets/UpdateDataset.py,sha256=BD3qMOzh_bk5QAh_JB_cEA92bTilm5EN6f2sWf0QXx0,965
|
46
|
+
eotdl/src/usecases/datasets/__init__.py,sha256=bcUQ867J4YeQcT6nMod7yqyZ6fTYHcUBioXmMcspE80,270
|
47
47
|
eotdl/src/utils.py,sha256=I_s5wKnyDmjzsKWlDSsnFVYnJn6YyJwlqf0rxHKe-Ac,479
|
48
48
|
eotdl/tools/__init__.py,sha256=pyWj9kl-0p-KSUSZ7BV8BoSYxj7j-OfGKt9NE3qw_3Q,277
|
49
49
|
eotdl/tools/sen12floods/__init__.py,sha256=J3McIaLi_Bp5-EIVfFWHwm0qYx7PtWydCrWwju8xFW0,215
|
50
50
|
eotdl/tools/sen12floods/tools.py,sha256=rPOkwZw_CdecfREUPMrjYCu1jI2OBhk_8PHL2MNTdV8,8124
|
51
51
|
eotdl/tools/stac.py,sha256=s-Js3wkqFIQwbWlr4hNTtkUgX_3Suf4A2eUUQEaE-30,636
|
52
|
-
eotdl-2023.6.14.
|
53
|
-
eotdl-2023.6.14.
|
54
|
-
eotdl-2023.6.14.
|
55
|
-
eotdl-2023.6.14.
|
52
|
+
eotdl-2023.6.14.post10.dist-info/entry_points.txt,sha256=s6sfxUfRrSX2IP2UbrzTFTvRCtLgw3_OKcHlOKf_5F8,39
|
53
|
+
eotdl-2023.6.14.post10.dist-info/WHEEL,sha256=gSF7fibx4crkLz_A-IKR6kcuq0jJ64KNCkG8_bcaEao,88
|
54
|
+
eotdl-2023.6.14.post10.dist-info/METADATA,sha256=UJKGSc9SppEVrHJaEQEhDjlHVG2R2Lkin8nHgknkHrI,746
|
55
|
+
eotdl-2023.6.14.post10.dist-info/RECORD,,
|
File without changes
|
File without changes
|