From 402b9c683bdb14238b7743ae29d75d224b8459c4 Mon Sep 17 00:00:00 2001 From: Ivan Carvalho Date: Tue, 19 Nov 2024 22:03:08 -0500 Subject: [PATCH] Fix find_node_by_weight type annotations --- .../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 000000000..cc99652c3 --- /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 beebd5041..a8780802b 100644 --- a/rustworkx/rustworkx.pyi +++ b/rustworkx/rustworkx.pyi @@ -1219,7 +1219,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 @@ -1373,7 +1373,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(