Skip to content

Commit

Permalink
ENH: add Path to allowed load() arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Apr 25, 2024
1 parent 829f0b9 commit c1c5683
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/qrules/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def asdot(
return print_dot(instance)


def load(filename: str) -> object:
def load(filename: str | Path) -> object:
with open(filename) as stream:
file_extension = _get_file_extension(filename)
if file_extension == "json":
Expand Down Expand Up @@ -170,7 +170,7 @@ def write(instance: object, filename: str) -> None:
raise NotImplementedError(msg)


def _get_file_extension(filename: str) -> str:
def _get_file_extension(filename: str | Path) -> str:
path = Path(filename)
extension = path.suffix.lower()
if not extension:
Expand Down

0 comments on commit c1c5683

Please sign in to comment.