Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type hint for search functions #1132

Merged
merged 3 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions releasenotes/notes/fix-type-search-6abecbc064e1dbf0.yaml
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/Qiskit/rustworkx/issues/1130>`__ for
more information.
8 changes: 4 additions & 4 deletions rustworkx/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: ...
Expand Down
12 changes: 6 additions & 6 deletions rustworkx/rustworkx.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down