[networkx] Graph/MultiGraph inherited methods return Self (#15453)

This commit is contained in:
albinoyoda
2026-03-02 11:37:11 +01:00
committed by GitHub
parent e8638cd0eb
commit b8b4b69253
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -100,8 +100,8 @@ class Graph(Collection[_Node]):
def copy(self, as_view: bool = False) -> Self: ...
def to_directed(self, as_view: bool = False) -> DiGraph[_Node]: ...
def to_undirected(self, as_view: bool = False) -> Graph[_Node]: ...
def subgraph(self, nodes: _NBunch[_Node]) -> Graph[_Node]: ...
def edge_subgraph(self, edges: Iterable[_Edge[_Node]]) -> Graph[_Node]: ...
def subgraph(self, nodes: _NBunch[_Node]) -> Self: ...
def edge_subgraph(self, edges: Iterable[_Edge[_Node]]) -> Self: ...
@overload
def size(self, weight: None = None) -> int: ...
@overload
@@ -52,7 +52,7 @@ class MultiGraph(Graph[_Node]):
def get_edge_data(
self, u: _Node, v: _Node, key: None = None, default: _DefaultT | None = None
) -> dict[Hashable, dict[str, Any] | _DefaultT]: ...
def copy(self, as_view: bool = False) -> MultiGraph[_Node]: ...
def copy(self, as_view: bool = False) -> Self: ...
@cached_property
# Including subtypes' possible return types for LSP
def degree(self) -> MultiDegreeView[_Node] | DiMultiDegreeView[_Node]: ...