Fix type hints

This commit is contained in:
Joscha 2020-06-26 13:17:44 +00:00
parent 52f31e2783
commit 402ae81335
2 changed files with 11 additions and 10 deletions

View File

@ -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():

View File

@ -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