actually fix route type hinting
This commit is contained in:
parent
29c8b01e33
commit
098c272ba2
2 changed files with 5 additions and 16 deletions
|
@ -29,8 +29,8 @@ def describe_location(location, locations):
|
|||
@dataclass
|
||||
class Route:
|
||||
router: "Router"
|
||||
origin: "RouterLocation"
|
||||
destination: "RouterLocation"
|
||||
origin: "RouterPoint"
|
||||
destination: "RouterPoint"
|
||||
path_nodes: Sequence[int]
|
||||
options: RouteOptions
|
||||
origin_addition: Optional["RouterNodeAndEdge"]
|
||||
|
@ -39,20 +39,6 @@ class Route:
|
|||
destination_xyz: np.ndarray | None
|
||||
visible_locations: Mapping[int, Location]
|
||||
|
||||
def __init__(self, router, origin, destination, path_nodes, options,
|
||||
origin_addition, destination_addition, origin_xyz, destination_xyz,
|
||||
visible_locations):
|
||||
self.router = router
|
||||
self.origin = origin
|
||||
self.destination = destination
|
||||
self.path_nodes = path_nodes
|
||||
self.options = options
|
||||
self.origin_addition = origin_addition
|
||||
self.destination_addition = destination_addition
|
||||
self.origin_xyz = origin_xyz
|
||||
self.destination_xyz = destination_xyz
|
||||
self.visible_locations = visible_locations
|
||||
|
||||
def serialize(self): # todo: move this into schema
|
||||
nodes = [[node, None] for node in self.path_nodes]
|
||||
if self.origin_addition and any(self.origin_addition):
|
||||
|
|
|
@ -552,6 +552,9 @@ class Router:
|
|||
origin = origins.get_location_for_node(origin_node)
|
||||
destination = destinations.get_location_for_node(destination_node)
|
||||
|
||||
if origin is None or destination is None:
|
||||
raise ValueError
|
||||
|
||||
# recreate path
|
||||
path_nodes = deque((destination_node, ))
|
||||
last_node = destination_node
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue