Skip to content

Commit

Permalink
Also allow os.PathLike in typing of write_to_path (#606)
Browse files Browse the repository at this point in the history
If have e.g. a pathlib.Path, this allows `blob.write_to_path(path)`
instead of `blob.write_to_path(str(path))`.
  • Loading branch information
bluetech committed Jul 6, 2023
1 parent 4029998 commit 0801d27
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/trustme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ def bytes(self) -> bytes:
"""
return self._data

def write_to_path(self, path: str, append: bool = False) -> None:
def write_to_path(self, path: Union[str, "os.PathLike[str]"], append: bool = False) -> None:
"""Writes the data to the file at the given path.
Args:
path (str): The path to write to.
path (str|os.PathLike[str]): The path to write to.
append (bool): If False (the default), replace any existing file
with the given name. If True, append to any existing file.
Expand Down

0 comments on commit 0801d27

Please sign in to comment.