Skip to content

Commit

Permalink
Add missing return type annotations.
Browse files Browse the repository at this point in the history
  • Loading branch information
domdfcoding committed May 4, 2022
1 parent 46004d5 commit 3e6d938
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions handy_archives/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def unpack_archive(
filename: PathLike,
extract_dir: Optional[PathLike] = None,
format: Optional[str] = None, # noqa: A002 # pylint: disable=redefined-builtin
):
) -> None:
"""
Unpack an archive.
Expand Down Expand Up @@ -158,7 +158,7 @@ def write_file(
filename: PathLike,
arcname: Optional[PathLike] = None,
mtime: Optional[datetime.datetime] = None,
):
) -> None:
"""
Add the file ``filename`` to the archive under the name ``arcname``.
Expand Down Expand Up @@ -306,7 +306,7 @@ def write_file(
filename: PathLike,
arcname: Optional[PathLike] = None,
mtime: Optional[datetime.datetime] = None,
):
) -> None:
"""
Put the bytes from ``filename`` into the archive under the name ``arcname``.
Expand Down Expand Up @@ -353,7 +353,7 @@ def __enter__(self: _Self) -> _Self:
return super().__enter__() # type: ignore[misc]


def is_tarfile(name: Union[PathLike, IO[bytes]]):
def is_tarfile(name: Union[PathLike, IO[bytes]]) -> bool:
"""
Return :py:obj:`True` if ``name`` points to a tar archive that :mod:`tarfile` can handle, else return :py:obj:`False`.
Expand All @@ -372,7 +372,7 @@ def is_tarfile(name: Union[PathLike, IO[bytes]]):
return False


def _normalize_nl(text: str, enable: bool):
def _normalize_nl(text: str, enable: bool) -> str:
if enable:
return text.replace("\r\n", '\n').replace('\r', '\n')
else:
Expand Down
4 changes: 2 additions & 2 deletions handy_archives/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ArchiveFileRegressionFixture(AdvancedFileRegressionFixture):
Class for performing regression checks on files in ``tar`` and ``zip`` archives.
"""

def check_archive(self, archive: Union[TarFile, ZipFile], filename: str, **kwargs):
def check_archive(self, archive: Union[TarFile, ZipFile], filename: str, **kwargs) -> None:
r"""
Checks a text file in ``archive`` against a previously recorded version, or generates a new file.
Expand All @@ -63,7 +63,7 @@ def check_archive(self, archive: Union[TarFile, ZipFile], filename: str, **kwarg
kwargs.setdefault("extension", os.path.splitext(filename)[-1] or None)
self.check(archive.read_text(filename), **kwargs)

def check_archive_binary(self, archive: Union[TarFile, ZipFile], filename: str, **kwargs):
def check_archive_binary(self, archive: Union[TarFile, ZipFile], filename: str, **kwargs) -> None:
r"""
Checks a binary file in ``archive`` against a previously recorded version, or generates a new file.
Expand Down

0 comments on commit 3e6d938

Please sign in to comment.