Skip to content

Commit

Permalink
Fix doctest.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gamenot committed Jan 29, 2024
1 parent c83683d commit 4b98358
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions smarts/core/sumo_road_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
def pairwise(iterable):
"""Generates pairs of neighboring elements.
>>> list(pairwise('ABCDEFG'))
[(AB), (BC), (CD), (DE), (EF), (FG)]
[('A','B'), ('B','C'), ('C','D'), ('D','E'), ('E','F'), ('F','G')]
"""
a, b = itertools.tee(iterable)
next(b, None)
Expand Down Expand Up @@ -135,7 +135,7 @@ def nearest_roads(self, point: Point, radius: float):
edges: List[sumolib.net.edge.Edge] = self._graph.getEdges()
if self._rtree_roads is None:
self._rtree_roads = self._init_rtree(edges)
near_roads: List[SumoRoadNetwork.Road] = []
near_roads: List[RoadMap.Road] = []
for i in self._rtree_roads.intersection((x - r, y - r, x + r, y + r)):
near_roads.append(self.road_by_id(edges[i].getID()))
return near_roads
Expand Down Expand Up @@ -458,12 +458,12 @@ def get_distance(self, point: Point, radius: float) -> float:
@overload
def get_distance(
self, point: Point, radius: float, get_offset: bool
) -> Tuple[float, float]:
) -> Tuple[float, Optional[float]]:
...

def get_distance(
self, point: Point, radius: float, get_offset=...
) -> Union[float, Tuple[float, float]]:
) -> Union[float, Tuple[float, Optional[float]]]:
"""Get the distance on the lane from the given point within the given radius.
Specifying to get the offset returns the offset value.
"""
Expand Down Expand Up @@ -969,7 +969,7 @@ def shape(
bline = buffered_shape(line, 0.0)
return line if bline.is_empty else bline

def road_by_id(self, road_id: str) -> RoadMap.Road:
def road_by_id(self, road_id: str) -> SumoRoadNetwork.Road:
road = self._roads.get(road_id)
if road:
return road
Expand Down

0 comments on commit 4b98358

Please sign in to comment.