Skip to content

Commit b8b4b69

Browse files
authored
[networkx] Graph/MultiGraph inherited methods return Self (#15453)
1 parent e8638cd commit b8b4b69

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

stubs/networkx/networkx/classes/graph.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ class Graph(Collection[_Node]):
100100
def copy(self, as_view: bool = False) -> Self: ...
101101
def to_directed(self, as_view: bool = False) -> DiGraph[_Node]: ...
102102
def to_undirected(self, as_view: bool = False) -> Graph[_Node]: ...
103-
def subgraph(self, nodes: _NBunch[_Node]) -> Graph[_Node]: ...
104-
def edge_subgraph(self, edges: Iterable[_Edge[_Node]]) -> Graph[_Node]: ...
103+
def subgraph(self, nodes: _NBunch[_Node]) -> Self: ...
104+
def edge_subgraph(self, edges: Iterable[_Edge[_Node]]) -> Self: ...
105105
@overload
106106
def size(self, weight: None = None) -> int: ...
107107
@overload

stubs/networkx/networkx/classes/multigraph.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class MultiGraph(Graph[_Node]):
5252
def get_edge_data(
5353
self, u: _Node, v: _Node, key: None = None, default: _DefaultT | None = None
5454
) -> dict[Hashable, dict[str, Any] | _DefaultT]: ...
55-
def copy(self, as_view: bool = False) -> MultiGraph[_Node]: ...
55+
def copy(self, as_view: bool = False) -> Self: ...
5656
@cached_property
5757
# Including subtypes' possible return types for LSP
5858
def degree(self) -> MultiDegreeView[_Node] | DiMultiDegreeView[_Node]: ...

0 commit comments

Comments
 (0)