Skip to content

Commit

Permalink
remove annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathf committed Apr 11, 2024
1 parent 78afd64 commit e8fdeed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/bind/solution/solution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ void init_solution(py::module_ &m) {
return arr;
})
.def("_solution_json",
[](vroom::Solution solution, bool geometry) {
[](vroom::Solution solution) {
py::scoped_ostream_redirect stream(
std::cout, py::module_::import("sys").attr("stdout"));
vroom::io::write_to_json(solution, geometry, "");
}, py::arg("solution"), py::arg("geometry") = false)
vroom::io::write_to_json(solution, true, "");
})
.def_readwrite("code", &vroom::Solution::code)
.def_readwrite("error", &vroom::Solution::error)
.def_readonly("summary", &vroom::Solution::summary)
Expand Down
8 changes: 4 additions & 4 deletions src/vroom/solution/solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ def routes(self) -> pandas.DataFrame:
frame.loc[frame[column] == NA_SUBSTITUTE, column] = pandas.NA
return frame

def to_dict(self, geometry: bool = False) -> Dict[str, Any]:
def to_dict(self) -> Dict[str, Any]:
"""Convert solution into VROOM compatible dictionary."""
stream = io.StringIO()
with redirect_stdout(stream):
self._solution_json(geometry)
self._solution_json()
return json.loads(stream.getvalue())

def to_json(self, filepath: Union[str, Path], geometry: bool = False) -> None:
def to_json(self, filepath: Union[str, Path]) -> None:
"""Store solution into VROOM compatible JSON file."""
with open(filepath, "w") as handler:
with redirect_stdout(handler):
self._solution_json(geometry)
self._solution_json()

0 comments on commit e8fdeed

Please sign in to comment.