ahorn-loader 0.1.0__tar.gz → 0.1.1__tar.gz
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.
Potentially problematic release.
This version of ahorn-loader might be problematic. Click here for more details.
- {ahorn_loader-0.1.0 → ahorn_loader-0.1.1}/PKG-INFO +2 -2
- {ahorn_loader-0.1.0 → ahorn_loader-0.1.1}/pyproject.toml +2 -2
- {ahorn_loader-0.1.0 → ahorn_loader-0.1.1}/src/ahorn_loader/api.py +6 -2
- {ahorn_loader-0.1.0 → ahorn_loader-0.1.1}/src/ahorn_loader/cli.py +2 -4
- {ahorn_loader-0.1.0 → ahorn_loader-0.1.1}/README.md +0 -0
- {ahorn_loader-0.1.0 → ahorn_loader-0.1.1}/src/ahorn_loader/__init__.py +0 -0
- {ahorn_loader-0.1.0 → ahorn_loader-0.1.1}/src/ahorn_loader/py.typed +0 -0
- {ahorn_loader-0.1.0 → ahorn_loader-0.1.1}/src/ahorn_loader/validator/__init__.py +0 -0
- {ahorn_loader-0.1.0 → ahorn_loader-0.1.1}/src/ahorn_loader/validator/rules.py +0 -0
- {ahorn_loader-0.1.0 → ahorn_loader-0.1.1}/src/ahorn_loader/validator/validator.py +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: ahorn-loader
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Library and command-line application to interact with datasets in the Aachen Higher-Order Repository of Networks.
|
|
5
5
|
Author: Florian Frantzen
|
|
6
6
|
Author-email: Florian Frantzen <florian.frantzen@cs.rwth-aachen.de>
|
|
7
7
|
Requires-Dist: requests>=2.32.4
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "ahorn-loader"
|
|
3
|
-
version = "0.1.
|
|
4
|
-
description = "
|
|
3
|
+
version = "0.1.1"
|
|
4
|
+
description = "Library and command-line application to interact with datasets in the Aachen Higher-Order Repository of Networks."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
7
7
|
{ name = "Florian Frantzen", email = "florian.frantzen@cs.rwth-aachen.de" }
|
|
@@ -4,6 +4,7 @@ import json
|
|
|
4
4
|
from datetime import UTC, datetime
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
from typing import Any
|
|
7
|
+
from urllib.parse import ParseResult, urlparse
|
|
7
8
|
|
|
8
9
|
import requests
|
|
9
10
|
|
|
@@ -101,10 +102,13 @@ def download_dataset(
|
|
|
101
102
|
raise KeyError(f"Dataset '{slug}' does not contain required 'attachments/dataset' keys.")
|
|
102
103
|
dataset_attachment = data["attachments"]["dataset"]
|
|
103
104
|
|
|
105
|
+
url: ParseResult = urlparse(dataset_attachment["url"])
|
|
106
|
+
folder.mkdir(parents=True, exist_ok=True)
|
|
107
|
+
filepath = folder / url.path.split("/")[-1]
|
|
108
|
+
|
|
104
109
|
response = requests.get(dataset_attachment["url"], timeout=10, stream=True)
|
|
105
110
|
response.raise_for_status()
|
|
106
|
-
|
|
107
|
-
filepath = folder / dataset_attachment["name"]
|
|
111
|
+
|
|
108
112
|
with filepath.open("wb") as f:
|
|
109
113
|
for chunk in response.iter_content(chunk_size=8192):
|
|
110
114
|
if chunk:
|
|
@@ -51,15 +51,13 @@ def download(
|
|
|
51
51
|
folder : Path
|
|
52
52
|
The folder where the dataset should be saved. Defaults to the current directory.
|
|
53
53
|
"""
|
|
54
|
-
download_dataset(name, folder, cache_lifetime=3600)
|
|
55
|
-
typer.echo(f"Downloaded dataset to {folder}")
|
|
56
|
-
|
|
57
54
|
try:
|
|
58
55
|
download_dataset(name, folder, cache_lifetime=3600)
|
|
59
|
-
typer.echo(f"Downloaded dataset to {folder}")
|
|
56
|
+
typer.echo(f"Downloaded dataset to {folder.absolute()}")
|
|
60
57
|
except Exception as e:
|
|
61
58
|
typer.echo(f"Failed to download dataset: {e}")
|
|
62
59
|
raise typer.Exit(code=1) from e
|
|
60
|
+
|
|
63
61
|
@app.command()
|
|
64
62
|
def validate(
|
|
65
63
|
path: Annotated[
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|