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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: figshare_client
3
- Version: 0.0.2
3
+ Version: 0.0.3
4
4
  Summary: A client to Figshare
5
5
  Keywords: snekpack,cookiecutter,figshare
6
6
  Author: Charles Tapley Hoyt
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "figshare_client"
7
- version = "0.0.2"
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.2"
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}",
@@ -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(record_id: int, *, concurrent: bool = True) -> dict[Path, File]:
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))
@@ -12,7 +12,7 @@ __all__ = [
12
12
  "get_version",
13
13
  ]
14
14
 
15
- VERSION = "0.0.2"
15
+ VERSION = "0.0.3"
16
16
 
17
17
 
18
18
  def get_git_hash() -> str:
File without changes