Compare commits

..

2 commits

Author SHA1 Message Date
4e369df232
mypy/fs 2024-09-14 02:47:52 +02:00
cc0b131a56
py.typed 2024-09-14 02:39:52 +02:00
2 changed files with 4 additions and 4 deletions

View file

@ -52,18 +52,18 @@ def make_directory(path: Path) -> None:
path.mkdir(exist_ok=True, parents=True)
def read_file_bytes(file_path: str) -> bytes:
def read_file_bytes(file_path: Path) -> bytes:
"""Read whole file bytes."""
with Path(file_path).open("br") as file_object:
with file_path.open("br") as file_object:
return file_object.read()
def read_file_lines(file_path: str, charset: str = CHARSET) -> list[str]:
def read_file_lines(file_path: Path, charset: str = CHARSET) -> list[str]:
"""Read whole file lines."""
return read_file_text(file_path, charset).split(os.linesep)
def read_file_text(file_path: str, charset: str = CHARSET) -> str:
def read_file_text(file_path: Path, charset: str = CHARSET) -> str:
"""Read whole file text."""
return read_file_bytes(file_path).decode(charset)

0
rwx/py.typed Normal file
View file