Skip to content

Commit bdc3ee0

Browse files
authored
Update types (#149)
1 parent 52eef83 commit bdc3ee0

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/pystow/utils/download.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class RequestKwargs(TypedDict):
7474
stream: NotRequired[bool]
7575
cert: NotRequired[str | tuple[str, str]]
7676
params: NotRequired[dict[str, Any]]
77+
headers: NotRequired[Mapping[str, str | bytes | None] | None]
7778

7879

7980
class DownloadKwargs(RequestKwargs):
@@ -83,8 +84,9 @@ class DownloadKwargs(RequestKwargs):
8384
# it is passed through from other signature components
8485

8586
clean_on_failure: NotRequired[bool]
86-
backend: NotRequired[DownloadBackend]
87+
backend: NotRequired[DownloadBackend | None]
8788
hexdigests: NotRequired[Mapping[str, str] | None]
89+
hexdigests_remote: NotRequired[Mapping[str, str] | None]
8890
hexdigests_strict: NotRequired[bool]
8991
progress_bar: NotRequired[bool]
9092
tqdm_kwargs: NotRequired[Mapping[str, Any] | None]
@@ -96,7 +98,7 @@ def download( # noqa:C901
9698
*,
9799
force: bool = True,
98100
clean_on_failure: bool = True,
99-
backend: DownloadBackend = "urllib",
101+
backend: DownloadBackend | None = None,
100102
hexdigests: Mapping[str, str] | None = None,
101103
hexdigests_remote: Mapping[str, str] | None = None,
102104
hexdigests_strict: bool = False,
@@ -148,6 +150,9 @@ def download( # noqa:C901
148150
logger.debug("did not re-download %s from %s", path, url)
149151
return
150152

153+
if backend is None:
154+
backend = "urllib"
155+
151156
desc = f"Downloading {path.name}"
152157
if _version:
153158
desc += f" (v{_version})"

0 commit comments

Comments
 (0)