Skip to content

Commit d019a53

Browse files
authored
networkx: Add all_simple_path target typing in simple_paths.pyi (#14656)
Adds typing for the target argument of all_simple_paths and all_simple_edge_paths, which per the documentation take either a single node or an iterable of nodes.
1 parent c0fed91 commit d019a53

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

stubs/networkx/networkx/algorithms/simple_paths.pyi

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from _typeshed import Incomplete, SupportsGetItem
2-
from collections.abc import Callable, Collection, Generator
2+
from collections.abc import Callable, Collection, Generator, Iterable
33
from typing import Any
44

55
from networkx.classes.graph import Graph, _Node
@@ -10,10 +10,12 @@ __all__ = ["all_simple_paths", "is_simple_path", "shortest_simple_paths", "all_s
1010
@_dispatchable
1111
def is_simple_path(G: Graph[_Node], nodes: Collection[Incomplete]) -> bool: ...
1212
@_dispatchable
13-
def all_simple_paths(G: Graph[_Node], source: _Node, target, cutoff: int | None = None) -> Generator[list[_Node], None, None]: ...
13+
def all_simple_paths(
14+
G: Graph[_Node], source: _Node, target: _Node | Iterable[_Node], cutoff: int | None = None
15+
) -> Generator[list[_Node]]: ...
1416
@_dispatchable
1517
def all_simple_edge_paths(
16-
G: Graph[_Node], source: _Node, target, cutoff: int | None = None
18+
G: Graph[_Node], source: _Node, target: _Node | Iterable[_Node], cutoff: int | None = None
1719
) -> Generator[list[_Node] | list[tuple[_Node, _Node]], None, list[_Node] | None]: ...
1820
@_dispatchable
1921
def shortest_simple_paths(

0 commit comments

Comments
 (0)