Skip to content

Commit 580386e

Browse files
committed
Allow os.PathLike type to read functions
1 parent abda2fa commit 580386e

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

vrplib/read/read_instance.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
import os
2+
from typing import Any, Dict, Union
3+
14
from vrplib.parse import parse_solomon, parse_vrplib
25

36

4-
def read_instance(path, instance_format="vrplib", compute_edge_weights=True):
7+
def read_instance(
8+
path: Union[str, os.PathLike],
9+
instance_format: str = "vrplib",
10+
compute_edge_weights: bool = True,
11+
) -> Dict[str, Any]:
512
"""
613
Reads the instance from the passed-in file path.
714

vrplib/read/read_solution.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
import os
2+
from typing import Any, Dict, Union
3+
14
from vrplib.parse import parse_solution
25

36

4-
def read_solution(path: str):
7+
def read_solution(path: Union[str, os.PathLike]) -> Dict[str, Union[str, Any]]:
58
"""
69
Reads the solution from the passed-in file path.
710

0 commit comments

Comments
 (0)