Changeset View
Changeset View
Standalone View
Standalone View
swh/graph/naive_client.py
Show First 20 Lines • Show All 167 Lines • ▼ Show 20 Lines | ) -> Iterator[str]: | ||||
return_types, self.graph.get_subgraph(src, edges, direction) | return_types, self.graph.get_subgraph(src, edges, direction) | ||||
) | ) | ||||
@check_arguments | @check_arguments | ||||
def visit_edges( | def visit_edges( | ||||
self, src: str, edges: str = "*", direction: str = "forward", max_edges: int = 0 | self, src: str, edges: str = "*", direction: str = "forward", max_edges: int = 0 | ||||
) -> Iterator[Tuple[str, str]]: | ) -> Iterator[Tuple[str, str]]: | ||||
if max_edges == 0: | if max_edges == 0: | ||||
max_edges = None # type: ignore | max_edges = None # type: ignore | ||||
else: | |||||
max_edges -= 1 | |||||
yield from list(self.graph.iter_edges_dfs(direction, edges, src))[:max_edges] | yield from list(self.graph.iter_edges_dfs(direction, edges, src))[:max_edges] | ||||
vlorentz: Remove these two lines | |||||
@check_arguments | @check_arguments | ||||
def visit_paths( | def visit_paths( | ||||
self, src: str, edges: str = "*", direction: str = "forward", max_edges: int = 0 | self, src: str, edges: str = "*", direction: str = "forward", max_edges: int = 0 | ||||
) -> Iterator[List[str]]: | ) -> Iterator[List[str]]: | ||||
# TODO: max_edges | # TODO: max_edges | ||||
for path in self.graph.iter_paths_dfs(direction, edges, src): | for path in self.graph.iter_paths_dfs(direction, edges, src): | ||||
if path[-1] in self.leaves(src, edges, direction): | if path[-1] in self.leaves(src, edges, direction): | ||||
▲ Show 20 Lines • Show All 182 Lines • Show Last 20 Lines |
Remove these two lines