mypy/fs,sphinx

This commit is contained in:
Marc Beninca 2024-09-13 23:17:09 +02:00
parent 3a8b239b9f
commit e213285987
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
2 changed files with 11 additions and 6 deletions

View file

@ -68,12 +68,12 @@ def read_file_text(file_path: str, charset: str = CHARSET) -> str:
return read_file_bytes(file_path).decode(charset)
def wipe(path: str) -> None:
def wipe(path: Path) -> None:
"""Wipe provided path, whether directory or file."""
try:
shutil.rmtree(path)
except NotADirectoryError:
Path(path).unlink(missing_ok=True)
path.unlink(missing_ok=True)
except FileNotFoundError:
pass