figshare_client 0.0.2__tar.gz → 0.0.3__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.
- {figshare_client-0.0.2 → figshare_client-0.0.3}/PKG-INFO +1 -1
- {figshare_client-0.0.2 → figshare_client-0.0.3}/pyproject.toml +2 -2
- figshare_client-0.0.3/src/figshare_client/.DS_Store +0 -0
- {figshare_client-0.0.2 → figshare_client-0.0.3}/src/figshare_client/api.py +14 -3
- {figshare_client-0.0.2 → figshare_client-0.0.3}/src/figshare_client/version.py +1 -1
- {figshare_client-0.0.2 → figshare_client-0.0.3}/LICENSE +0 -0
- {figshare_client-0.0.2 → figshare_client-0.0.3}/README.md +0 -0
- {figshare_client-0.0.2 → figshare_client-0.0.3}/src/figshare_client/__init__.py +0 -0
- {figshare_client-0.0.2 → figshare_client-0.0.3}/src/figshare_client/__main__.py +0 -0
- {figshare_client-0.0.2 → figshare_client-0.0.3}/src/figshare_client/cli.py +0 -0
- {figshare_client-0.0.2 → figshare_client-0.0.3}/src/figshare_client/py.typed +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "uv_build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "figshare_client"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.3"
|
|
8
8
|
description = "A client to Figshare"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
|
@@ -220,7 +220,7 @@ known-first-party = [
|
|
|
220
220
|
docstring-code-format = true
|
|
221
221
|
|
|
222
222
|
[tool.bumpversion]
|
|
223
|
-
current_version = "0.0.
|
|
223
|
+
current_version = "0.0.3"
|
|
224
224
|
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)(?:-(?P<release>[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+(?P<build>[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?"
|
|
225
225
|
serialize = [
|
|
226
226
|
"{major}.{minor}.{patch}-{release}+{build}",
|
|
Binary file
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Interact with the Figshare API."""
|
|
2
2
|
|
|
3
3
|
from pathlib import Path
|
|
4
|
+
from typing import Any
|
|
4
5
|
|
|
5
6
|
import pystow
|
|
6
7
|
import requests
|
|
@@ -39,7 +40,9 @@ def get_files(record_id: int) -> list[File]:
|
|
|
39
40
|
return [File.model_validate(f) for f in res.json()]
|
|
40
41
|
|
|
41
42
|
|
|
42
|
-
def ensure_files(
|
|
43
|
+
def ensure_files(
|
|
44
|
+
record_id: int, *, concurrent: bool = True, tqdm_kwargs: dict[str, Any] | None = None
|
|
45
|
+
) -> dict[Path, File]:
|
|
43
46
|
"""Ensure all files for a record."""
|
|
44
47
|
files = get_files(record_id)
|
|
45
48
|
submodule = MODULE.module(str(record_id))
|
|
@@ -47,7 +50,15 @@ def ensure_files(record_id: int, *, concurrent: bool = True) -> dict[Path, File]
|
|
|
47
50
|
def _func(file: File) -> tuple[Path, File]:
|
|
48
51
|
return submodule.ensure(url=str(file.download_url), name=file.name), file
|
|
49
52
|
|
|
53
|
+
_tqdm_kwargs = {
|
|
54
|
+
"desc": f"downloading figshare:{record_id}",
|
|
55
|
+
"unit": "file",
|
|
56
|
+
"leave": False,
|
|
57
|
+
}
|
|
58
|
+
if tqdm_kwargs:
|
|
59
|
+
_tqdm_kwargs.update(tqdm_kwargs)
|
|
60
|
+
|
|
50
61
|
if concurrent:
|
|
51
|
-
return dict(thread_map(_func, files))
|
|
62
|
+
return dict(thread_map(_func, files, **_tqdm_kwargs))
|
|
52
63
|
else:
|
|
53
|
-
return dict(tmap(_func, files))
|
|
64
|
+
return dict(tmap(_func, files, **_tqdm_kwargs))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|