ahorn-loader 0.1.0__py3-none-any.whl → 0.1.1__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.

Potentially problematic release.


This version of ahorn-loader might be problematic. Click here for more details.

ahorn_loader/api.py CHANGED
@@ -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
- folder.mkdir(parents=True, exist_ok=True)
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:
ahorn_loader/cli.py CHANGED
@@ -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[
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ahorn-loader
3
- Version: 0.1.0
4
- Summary: Add your description here
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,11 +1,11 @@
1
1
  ahorn_loader/__init__.py,sha256=9040e157ab98e4fee2d9c7850d23e2ec2091f467a446ccefec4cef631e110c4c,83
2
- ahorn_loader/api.py,sha256=9bda372b6aa013192be0561280d05ea5b6a65185448e0554a23dc7525567c11a,3621
3
- ahorn_loader/cli.py,sha256=104c3c033404a9f4ed5be86cdd835c56fd8998711f40adb9a3790007334eb8eb,2366
2
+ ahorn_loader/api.py,sha256=cc79aa4a691fb2e8d751fab2705794e952689814da4496259f7709cf677688ea,3726
3
+ ahorn_loader/cli.py,sha256=d8b7bedffd43ce1cecff26b994652621343d60d4f2269d0cca6ed3cf1edef01e,2271
4
4
  ahorn_loader/py.typed,sha256=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855,0
5
5
  ahorn_loader/validator/__init__.py,sha256=b7219ba8c333ce418f237a446fdb81009a0d30651db3f59d53fe79ef9bc604cf,84
6
6
  ahorn_loader/validator/rules.py,sha256=7638968b8fd8f94942d978703c6ad9cb0cabe7a0283df01c3693a734c67ac3c2,3155
7
7
  ahorn_loader/validator/validator.py,sha256=a9fa284cf7e367689eaab689dc2a9da800df0c594e0c79be394fcb44f2b48263,1437
8
- ahorn_loader-0.1.0.dist-info/WHEEL,sha256=2b400f346628f0064eb5bbf656b39df8dfcb092437ab08244409d295749b81a3,78
9
- ahorn_loader-0.1.0.dist-info/entry_points.txt,sha256=a3240003f939af4b000ff9412a040b3e1a71aa4d3e5136a00c996c53dec0278b,55
10
- ahorn_loader-0.1.0.dist-info/METADATA,sha256=789ebb28797faf80f8eedf81c4861430bd70b6236e6ec5efd17d285ce2e122da,1467
11
- ahorn_loader-0.1.0.dist-info/RECORD,,
8
+ ahorn_loader-0.1.1.dist-info/WHEEL,sha256=0f7d664a881437bddec71c703c3c2f01fd13581519f95130abcc96e296ef0426,79
9
+ ahorn_loader-0.1.1.dist-info/entry_points.txt,sha256=a3240003f939af4b000ff9412a040b3e1a71aa4d3e5136a00c996c53dec0278b,55
10
+ ahorn_loader-0.1.1.dist-info/METADATA,sha256=b48c03747dadce166fd95f3c948ba621a4a7fdad109968bf032b96cc44d73f6b,1555
11
+ ahorn_loader-0.1.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: uv 0.8.9
2
+ Generator: uv 0.8.11
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any