From 402ae81335492e7bf5d8620d86ec3f49b8c1becf Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 26 Jun 2020 13:17:44 +0000 Subject: [PATCH] Fix type hints --- PFERD/download_summary.py | 19 ++++++++++--------- PFERD/pferd.py | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/PFERD/download_summary.py b/PFERD/download_summary.py index b7aac4d..6b0b6e8 100644 --- a/PFERD/download_summary.py +++ b/PFERD/download_summary.py @@ -1,33 +1,34 @@ +from typing import List import logging +from pathlib import Path from .logging import PrettyLogger -from .utils import PathLike class DownloadSummary: - def __init__(self): - self._new_files = [] - self._changed_files = [] - self._deleted_files = [] + def __init__(self) -> None: + self._new_files: List[Path] = [] + self._changed_files: List[Path] = [] + self._deleted_files: List[Path] = [] def merge(self, summary: 'DownloadSummary') -> None: self._new_files += summary._new_files self._changed_files += summary._changed_files self._deleted_files += summary._deleted_files - def add_deleted_file(self, path: PathLike) -> None: + def add_deleted_file(self, path: Path) -> None: self._deleted_files.append(path) - def add_changed_file(self, path: PathLike) -> None: + def add_changed_file(self, path: Path) -> None: self._changed_files.append(path) - def add_new_file(self, path: PathLike) -> None: + def add_new_file(self, path: Path) -> None: self._new_files.append(path) def _has_no_updates(self) -> bool: return len(self._new_files) == 0 and len(self._changed_files) == 0 and len(self._deleted_files) == 0 - def print(self, logger: logging, pretty: PrettyLogger) -> None: + def print(self, logger: logging.Logger, pretty: PrettyLogger) -> None: logger.info("") logger.info("Summary: ") if self._has_no_updates(): diff --git a/PFERD/pferd.py b/PFERD/pferd.py index d678118..3384e4d 100644 --- a/PFERD/pferd.py +++ b/PFERD/pferd.py @@ -158,7 +158,7 @@ class Pferd(Location): return organizer - def print_summary(self): + def print_summary(self) -> None: self._download_summary.print(LOGGER, PRETTY) @swallow_and_print_errors