From 08a4050d26321be99159cd76dd03498aafaf06bc Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 20 May 2024 16:20:42 -0400 Subject: [PATCH] Code review: minor typing etc recommendations Co-authored-by: John T. Wodder II --- dandi/download.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dandi/download.py b/dandi/download.py index fc9c71b6e..d1627af08 100644 --- a/dandi/download.py +++ b/dandi/download.py @@ -482,7 +482,7 @@ def agg_done(self, done_sizes: Iterator[int]) -> list[str]: def _skip_file(msg: Any, **kwargs: Any) -> dict: - return dict(**kwargs, status="skipped", message=str(msg)) + return {"status": "skipped", "message": str(msg), **kwargs} def _populate_dandiset_yaml( @@ -995,7 +995,7 @@ class DownloadProgress: @dataclass class ProgressCombiner: zarr_size: int - file_qty: int = -1 # set to specific known value whenever full sweep is complete + file_qty: int | None = None # set to specific known value whenever full sweep is complete files: dict[str, DownloadProgress] = field(default_factory=dict) #: Total size of all files that were not skipped and did not error out #: during download @@ -1045,7 +1045,7 @@ def set_status(self, statusdict: dict) -> None: state_qtys = Counter(s.state for s in self.files.values()) total = len(self.files) if ( - self.file_qty >= 0 # if already known + self.file_qty is not None # if already known and total == self.file_qty and state_qtys[DLState.STARTING] == state_qtys[DLState.DOWNLOADING] == 0 ):