Skip to content

Commit 4149125

Browse files
committed
networkx: fix subgraph and degree
1 parent dfee232 commit 4149125

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

stubs/networkx/networkx/classes/graph.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Graph(Collection[_Node]):
9090
def copy(self, as_view: bool = False) -> Self: ...
9191
def to_directed(self, as_view: bool = False) -> DiGraph[_Node]: ...
9292
def to_undirected(self, as_view: bool = False) -> Graph[_Node]: ...
93-
def subgraph(self, nodes: Iterable[_Node]) -> Graph[_Node]: ...
93+
def subgraph(self, nodes: _NBunch[_Node]) -> Graph[_Node]: ...
9494
def edge_subgraph(self, edges: Iterable[_Edge[_Node]]) -> Graph[_Node]: ...
9595
@overload
9696
def size(self, weight: None = None) -> int: ...

stubs/networkx/networkx/classes/reportviews.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ class NodeDataView(AbstractSet[_Node]):
5555

5656
class DiDegreeView(Generic[_Node]):
5757
def __init__(self, G: Graph[_Node], nbunch: _NBunch[_Node] = None, weight: None | bool | str = None) -> None: ...
58-
def __call__(self, nbunch: _NBunch[_Node] = None, weight: None | bool | str = None) -> int | DiDegreeView[_Node]: ...
58+
@overload
59+
def __call__(self, nbunch: _Node, weight: None | bool | str = None) -> int: ...
60+
@overload
61+
def __call__(self, nbunch: Iterable[_Node] | None = None, weight: None | bool | str = None) -> DiDegreeView[_Node]: ...
5962
def __getitem__(self, n: _Node) -> float: ...
6063
def __iter__(self) -> Iterator[tuple[_Node, float]]: ...
6164
def __len__(self) -> int: ...

0 commit comments

Comments
 (0)