diff --git a/releasenotes/notes/fix-type-search-6abecbc064e1dbf0.yaml b/releasenotes/notes/fix-type-search-6abecbc064e1dbf0.yaml new file mode 100644 index 000000000..9341bfdb1 --- /dev/null +++ b/releasenotes/notes/fix-type-search-6abecbc064e1dbf0.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fixed the bug type hint for the :func:`~rustworkx.bfs_search`, + :func:`~rustworkx.dfs_search` and :func:`~rustworkx.dijkstra_search`. + Refer to `#1130 `__ for + more information. diff --git a/rustworkx/__init__.pyi b/rustworkx/__init__.pyi index 21da9d6f0..f5bcdeb71 100644 --- a/rustworkx/__init__.pyi +++ b/rustworkx/__init__.pyi @@ -11,7 +11,7 @@ import numpy as np -from typing import Generic, TypeVar, Any, Callable, Iterator, overload +from typing import Generic, TypeVar, Any, Callable, Iterator, overload, Sequence # Re-Exports of rust native functions in rustworkx.rustworkx # To workaround limitations in mypy around re-exporting objects from the inner @@ -551,17 +551,17 @@ def cartesian_product( ) -> tuple[PyDiGraph, ProductNodeMap]: ... def bfs_search( graph: PyGraph | PyDiGraph, - source: int, + source: Sequence[int] | None, visitor: _BFSVisitor, ) -> None: ... def dfs_search( graph: PyGraph | PyDiGraph, - source: int, + source: Sequence[int] | None, visitor: _DFSVisitor, ) -> None: ... def dijkstra_search( graph: PyGraph | PyDiGraph, - source: int, + source: Sequence[int] | None, weight_fn: Callable[[Any], float], visitor: _DijkstraVisitor, ) -> None: ... diff --git a/rustworkx/rustworkx.pyi b/rustworkx/rustworkx.pyi index 6139ff369..765085e90 100644 --- a/rustworkx/rustworkx.pyi +++ b/rustworkx/rustworkx.pyi @@ -894,33 +894,33 @@ _DijkstraVisitor = TypeVar("_DijkstraVisitor", bound=DijkstraVisitor) def digraph_bfs_search( graph: PyDiGraph, - source: int | None = ..., + source: Sequence[int] | None = ..., visitor: _BFSVisitor | None = ..., ) -> None: ... def graph_bfs_search( graph: PyGraph, - source: int | None = ..., + source: Sequence[int] | None = ..., visitor: _BFSVisitor | None = ..., ) -> None: ... def digraph_dfs_search( graph: PyDiGraph, - source: int | None = ..., + source: Sequence[int] | None = ..., visitor: _DFSVisitor | None = ..., ) -> None: ... def graph_dfs_search( graph: PyGraph, - source: int | None = ..., + source: Sequence[int] | None = ..., visitor: _DFSVisitor | None = ..., ) -> None: ... def digraph_dijkstra_search( graph: PyDiGraph, - source: int | None = ..., + source: Sequence[int] | None = ..., weight_fn: Callable[[Any], float] | None = ..., visitor: _DijkstraVisitor | None = ..., ) -> None: ... def graph_dijkstra_search( graph: PyGraph, - source: int | None = ..., + source: Sequence[int] | None = ..., weight_fn: Callable[[Any], float] | None = ..., visitor: _DijkstraVisitor | None = ..., ) -> None: ...