From 6bc3933121d04e4d4ae3484625cebebfe9de7fd5 Mon Sep 17 00:00:00 2001 From: Ivan Carvalho <8753214+IvanIsCoding@users.noreply.github.com> Date: Mon, 16 Dec 2024 19:54:09 -0500 Subject: [PATCH] Fix find_node_by_weight type annotations (#1324) --- .../fix-find-node-by-weight-stub-94e971291e1e6c96.yaml | 7 +++++++ rustworkx/rustworkx.pyi | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/fix-find-node-by-weight-stub-94e971291e1e6c96.yaml diff --git a/releasenotes/notes/fix-find-node-by-weight-stub-94e971291e1e6c96.yaml b/releasenotes/notes/fix-find-node-by-weight-stub-94e971291e1e6c96.yaml new file mode 100644 index 0000000000..cc99652c38 --- /dev/null +++ b/releasenotes/notes/fix-find-node-by-weight-stub-94e971291e1e6c96.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fixed a bug in the type hints for :meth:`~rustworkx.PyGraph.find_node_by_weight` + and :meth:`~rustworkx.PyDiGraph.find_node_by_weight`. + Refer to `issue 1243 `__ for + more information. diff --git a/rustworkx/rustworkx.pyi b/rustworkx/rustworkx.pyi index 4a18edd614..5d42197064 100644 --- a/rustworkx/rustworkx.pyi +++ b/rustworkx/rustworkx.pyi @@ -1224,7 +1224,7 @@ class PyGraph(Generic[_S, _T]): def filter_nodes(self, filter_function: Callable[[_S], bool]) -> NodeIndices: ... def find_node_by_weight( self, - obj: Callable[[_S], bool], + obj: _S, /, ) -> int | None: ... @staticmethod @@ -1378,7 +1378,7 @@ class PyDiGraph(Generic[_S, _T]): def find_adjacent_node_by_edge(self, node: int, predicate: Callable[[_T], bool], /) -> _S: ... def find_node_by_weight( self, - obj: Callable[[_S], bool], + obj: _S, /, ) -> int | None: ... def find_predecessors_by_edge(