This commit is contained in:
Marc Beninca 2024-09-13 17:24:37 +02:00
parent ef45fc9d81
commit de80d7ecff
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -49,7 +49,7 @@ def get_path_uuid(path: str) -> str:
def make_directory(path: str) -> None: def make_directory(path: str) -> None:
"""Make a directory (and its parents) from a path.""" """Make a directory (and its parents) from a path."""
os.makedirs(path, exist_ok=True) Path(path).mkdir(exist_ok=True, parents=True)
def read_file(file_path: str): def read_file(file_path: str):
@ -77,5 +77,5 @@ def wipe(path: str) -> None:
def write(file_path: str, text: str, charset: str = CHARSET) -> None: def write(file_path: str, text: str, charset: str = CHARSET) -> None:
"""Write text into a file.""" """Write text into a file."""
with Path(file_path).open(mode="w", encoding=charset) as file_object: with Path(file_path).open(encoding=charset, mode="w") as file_object:
file_object.write(text) file_object.write(text)