Skip to content

Commit

Permalink
Allow os.PathLike type to read functions
Browse files Browse the repository at this point in the history
  • Loading branch information
leonlan committed May 15, 2023
1 parent abda2fa commit 580386e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 8 additions & 1 deletion vrplib/read/read_instance.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import os
from typing import Any, Dict, Union

from vrplib.parse import parse_solomon, parse_vrplib


def read_instance(path, instance_format="vrplib", compute_edge_weights=True):
def read_instance(
path: Union[str, os.PathLike],
instance_format: str = "vrplib",
compute_edge_weights: bool = True,
) -> Dict[str, Any]:
"""
Reads the instance from the passed-in file path.
Expand Down
5 changes: 4 additions & 1 deletion vrplib/read/read_solution.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import os
from typing import Any, Dict, Union

from vrplib.parse import parse_solution


def read_solution(path: str):
def read_solution(path: Union[str, os.PathLike]) -> Dict[str, Union[str, Any]]:
"""
Reads the solution from the passed-in file path.
Expand Down

0 comments on commit 580386e

Please sign in to comment.