diff --git a/hathizip/__main__.py b/hathizip/__main__.py index c4e0c43..0bc240a 100644 --- a/hathizip/__main__.py +++ b/hathizip/__main__.py @@ -5,7 +5,7 @@ from hathizip import cli -def main(): +def main() -> None: """Check if pytest arg is run else run main entry point.""" if len(sys.argv) > 1 and sys.argv[1] == "--pytest": # pylint: disable=import-outside-toplevel diff --git a/hathizip/cli.py b/hathizip/cli.py index 9e84dfb..21c3940 100644 --- a/hathizip/cli.py +++ b/hathizip/cli.py @@ -4,17 +4,19 @@ import os import shutil import sys +from typing import Optional, List from hathizip import process, configure_logging from hathizip.utils import has_subdirs + try: from importlib import metadata except ImportError: import importlib_metadata as metadata # type: ignore -def destination_path(path): +def destination_path(path: str) -> str: """Validate the entry point for the cli args. Args: @@ -85,7 +87,7 @@ def get_parser() -> argparse.ArgumentParser: return parser -def main(argv=None): +def main(argv: Optional[List[str]] = None) -> None: """Run main entry point for the program.""" argv = argv or sys.argv[1:] diff --git a/hathizip/configure_logging.py b/hathizip/configure_logging.py index 0d5d29d..2611e56 100644 --- a/hathizip/configure_logging.py +++ b/hathizip/configure_logging.py @@ -2,9 +2,13 @@ import logging import sys +from typing import Optional -def configure_logger(debug_mode=False, log_file=None) -> logging.Logger: +def configure_logger( + debug_mode: bool = False, + log_file: Optional[str] = None +) -> logging.Logger: """Configure logger. Useful for passing logging information diff --git a/hathizip/process.py b/hathizip/process.py index 12a4981..0dc6e8d 100644 --- a/hathizip/process.py +++ b/hathizip/process.py @@ -12,7 +12,7 @@ # TODO: create get_files testing -def get_files(path) -> typing.Iterator[PackageFile]: +def get_files(path: str) -> typing.Iterator[PackageFile]: """Find files relative to a given path. Args: @@ -33,7 +33,7 @@ def get_files(path) -> typing.Iterator[PackageFile]: ) -def compress_folder(path, dst): +def compress_folder(path: str, dst: str) -> None: """Compress the contents of a path. Args: @@ -66,7 +66,7 @@ def compress_folder(path, dst): logger.info("Generated {}".format(final_zip)) -def compress_folder_inplace(path, dst): +def compress_folder_inplace(path: str, dst: str) -> None: """Compress the contents of a path without using a temp directory. Args: