From a4cc79fbecac8d981152950dfad5cf625e0ac5ec Mon Sep 17 00:00:00 2001 From: Rebecca Chen Date: Mon, 11 Mar 2024 19:42:55 -0700 Subject: [PATCH] networkx: add another overload to OutEdgeView.__call__(). (#11578) It's common to call the 'edges' property of a DiGraph with an 'nbunch' argument and no other arguments (see the Examples section of https://networkx.org/documentation/stable/reference/classes/generated/networkx.DiGraph.out_edges.html). None of the existing overloads allow this. --- stubs/networkx/networkx/classes/reportviews.pyi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stubs/networkx/networkx/classes/reportviews.pyi b/stubs/networkx/networkx/classes/reportviews.pyi index 35e5d9f16..ae2f2a6fe 100644 --- a/stubs/networkx/networkx/classes/reportviews.pyi +++ b/stubs/networkx/networkx/classes/reportviews.pyi @@ -1,5 +1,5 @@ from _typeshed import Incomplete, Unused -from collections.abc import Iterator, Mapping, Set as AbstractSet +from collections.abc import Iterable, Iterator, Mapping, Set as AbstractSet from typing import Any, Generic, Literal, TypeVar, overload from typing_extensions import Self @@ -70,6 +70,10 @@ class OutEdgeView(AbstractSet[Incomplete], Mapping[Incomplete, Incomplete], Gene @overload def __call__(self, nbunch: None = None, data: Literal[False] = False, *, default: Unused = None) -> Self: ... @overload + def __call__( + self, nbunch: _Node | Iterable[_Node], data: Literal[False] = False, *, default: None = None + ) -> OutEdgeDataView[_Node, tuple[_Node, _Node]]: ... + @overload def __call__( self, nbunch: _NBunch[_Node], data: Literal[True], *, default: None = None ) -> OutEdgeDataView[_Node, tuple[_Node, _Node, dict[str, Incomplete]]]: ...