From d1ac5ab2b787ba0f782fa7cffbce749c14c2ff77 Mon Sep 17 00:00:00 2001 From: Leon Lan Date: Fri, 16 Feb 2024 16:29:24 +0100 Subject: [PATCH] Update repository URL; fix type hints in write_solution --- pyproject.toml | 4 ++-- vrplib/write/write_solution.py | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3498dbc0..df1abba2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,11 @@ [tool.poetry] name = "vrplib" version = "1.3.0" -description = "Python library for working with vehicle routing problem instances." +description = "Python library for reading and writing VRP instances." authors = ["Leon Lan "] license = "MIT" readme = "README.md" -repository = "https://github.com/leonlan/VRPLIB" +repository = "https://github.com/PyVRP/VRPLIB" [tool.poetry.dependencies] python = "^3.8" diff --git a/vrplib/write/write_solution.py b/vrplib/write/write_solution.py index 75ee70b6..a5b79779 100644 --- a/vrplib/write/write_solution.py +++ b/vrplib/write/write_solution.py @@ -1,8 +1,11 @@ -from typing import Any, Dict, List, Optional +import os +from typing import Any, Dict, List, Optional, Union def write_solution( - path: str, routes: List[List[int]], data: Optional[Dict[str, Any]] = None + path: Union[str, os.PathLike], + routes: List[List[int]], + data: Optional[Dict[str, Any]] = None, ): """ Writes a VRP solution to file following the VRPLIB convention. @@ -14,8 +17,8 @@ def write_solution( routes A list of routes, each route denoting the order in which the customers are visited. - **kwargs - Optional keyword arguments. Each key-value pair is written to the + data + Optional data dictionary. Each key-value pair is written to the solution file as "{key}: {value}". """ for route in routes: