mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Add type hints to DownloadSummary
This commit is contained in:
parent
739522a151
commit
52f31e2783
@ -1,3 +1,8 @@
|
|||||||
|
import logging
|
||||||
|
from .logging import PrettyLogger
|
||||||
|
from .utils import PathLike
|
||||||
|
|
||||||
|
|
||||||
class DownloadSummary:
|
class DownloadSummary:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -10,19 +15,19 @@ class DownloadSummary:
|
|||||||
self._changed_files += summary._changed_files
|
self._changed_files += summary._changed_files
|
||||||
self._deleted_files += summary._deleted_files
|
self._deleted_files += summary._deleted_files
|
||||||
|
|
||||||
def add_deleted_file(self, path) -> None:
|
def add_deleted_file(self, path: PathLike) -> None:
|
||||||
self._deleted_files.append(path)
|
self._deleted_files.append(path)
|
||||||
|
|
||||||
def add_changed_file(self, path) -> None:
|
def add_changed_file(self, path: PathLike) -> None:
|
||||||
self._changed_files.append(path)
|
self._changed_files.append(path)
|
||||||
|
|
||||||
def add_new_file(self, path) -> None:
|
def add_new_file(self, path: PathLike) -> None:
|
||||||
self._new_files.append(path)
|
self._new_files.append(path)
|
||||||
|
|
||||||
def _has_no_updates(self) -> bool:
|
def _has_no_updates(self) -> bool:
|
||||||
return len(self._new_files) == 0 and len(self._changed_files) == 0 and len(self._deleted_files) == 0
|
return len(self._new_files) == 0 and len(self._changed_files) == 0 and len(self._deleted_files) == 0
|
||||||
|
|
||||||
def print(self, logger, pretty) -> None:
|
def print(self, logger: logging, pretty: PrettyLogger) -> None:
|
||||||
logger.info("")
|
logger.info("")
|
||||||
logger.info("Summary: ")
|
logger.info("Summary: ")
|
||||||
if self._has_no_updates():
|
if self._has_no_updates():
|
||||||
@ -46,5 +51,3 @@ class DownloadSummary:
|
|||||||
logger.info("Deleted Files:")
|
logger.info("Deleted Files:")
|
||||||
for file in self._deleted_files:
|
for file in self._deleted_files:
|
||||||
pretty.deleted_file(file)
|
pretty.deleted_file(file)
|
||||||
|
|
||||||
logger.info("")
|
|
Loading…
Reference in New Issue
Block a user