Skip to content

Commit

Permalink
Fix type hint for search functions (#1132) (#1133)
Browse files Browse the repository at this point in the history
* Fix type hint for search functions

* Revert import order

---------

Co-authored-by: Ivan Carvalho <8753214+IvanIsCoding@users.noreply.github.com>
(cherry picked from commit de6684f)

Co-authored-by: Julio Quintero <julioquintetro@gmail.com>
  • Loading branch information
mergify[bot] and JPena-code committed Mar 4, 2024
1 parent 4770a56 commit d28e5d4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
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 @@ -550,17 +550,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 @@ -884,33 +884,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

0 comments on commit d28e5d4

Please sign in to comment.