Skip to content

Commit

Permalink
chore: update download_cb type annotation (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsstevenson authored Aug 7, 2024
1 parent f03464a commit 047275b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/wags_tails/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,22 @@

from collections.abc import Callable
from pathlib import Path
from typing import Protocol

from .base_source import DataSource


class _DownloadCallbackType(Protocol):
"""Define type for CustomData ``download_cb`` arg"""

def __call__(self, version: str, outfile: Path) -> None:
"""Implicit description of ``download_cb`` arg. Shouldn't actually be used.
:param version: version to acquire
:param outfile: location and filename for final data file
"""


class CustomData(DataSource):
"""Data acquisition class using custom, user-provided acquisition methods."""

Expand All @@ -24,7 +36,7 @@ def __init__(
src_name: str,
filetype: str,
latest_version_cb: Callable[[], str],
download_cb: Callable[[str, Path], None],
download_cb: _DownloadCallbackType,
data_dir: Path | None = None,
file_name: str | None = None,
versioned: bool = True,
Expand Down

0 comments on commit 047275b

Please sign in to comment.