From d019a53a3b0fe628753d0a1f13f6c85b37acf740 Mon Sep 17 00:00:00 2001 From: GiGaGon <107241144+MeGaGiGaGon@users.noreply.github.com> Date: Thu, 28 Aug 2025 11:09:28 -0700 Subject: [PATCH] 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. --- stubs/networkx/networkx/algorithms/simple_paths.pyi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/stubs/networkx/networkx/algorithms/simple_paths.pyi b/stubs/networkx/networkx/algorithms/simple_paths.pyi index 2aa418a8a..405c00aea 100644 --- a/stubs/networkx/networkx/algorithms/simple_paths.pyi +++ b/stubs/networkx/networkx/algorithms/simple_paths.pyi @@ -1,5 +1,5 @@ from _typeshed import Incomplete, SupportsGetItem -from collections.abc import Callable, Collection, Generator +from collections.abc import Callable, Collection, Generator, Iterable from typing import Any from networkx.classes.graph import Graph, _Node @@ -10,10 +10,12 @@ __all__ = ["all_simple_paths", "is_simple_path", "shortest_simple_paths", "all_s @_dispatchable def is_simple_path(G: Graph[_Node], nodes: Collection[Incomplete]) -> bool: ... @_dispatchable -def all_simple_paths(G: Graph[_Node], source: _Node, target, cutoff: int | None = None) -> Generator[list[_Node], None, None]: ... +def all_simple_paths( + G: Graph[_Node], source: _Node, target: _Node | Iterable[_Node], cutoff: int | None = None +) -> Generator[list[_Node]]: ... @_dispatchable def all_simple_edge_paths( - G: Graph[_Node], source: _Node, target, cutoff: int | None = None + G: Graph[_Node], source: _Node, target: _Node | Iterable[_Node], cutoff: int | None = None ) -> Generator[list[_Node] | list[tuple[_Node, _Node]], None, list[_Node] | None]: ... @_dispatchable def shortest_simple_paths(