From 4e369df232f527dc9640e1a55373453d70f0feb6 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 14 Sep 2024 02:47:52 +0200 Subject: [PATCH] mypy/fs --- rwx/fs/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rwx/fs/__init__.py b/rwx/fs/__init__.py index 0685c44..ee1925d 100644 --- a/rwx/fs/__init__.py +++ b/rwx/fs/__init__.py @@ -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)