[networkx] Fix a few annotations in AtlasView and Graph (#13656)

This commit is contained in:
Abdrakhman
2025-03-18 16:35:50 +05:00
committed by GitHub
parent ec5246b359
commit bb244d35ea
2 changed files with 7 additions and 4 deletions
@@ -7,11 +7,13 @@ _U = TypeVar("_U")
_V = TypeVar("_V")
class AtlasView(Mapping[_T, dict[_U, _V]]):
def __getstate__(self) -> dict[str, Mapping[_T, dict[_U, _V]]]: ...
def __setstate__(self, state: dict[str, Mapping[_T, dict[_U, _V]]]) -> None: ...
def __init__(self, d: Mapping[_T, dict[_U, _V]]) -> None: ...
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __getitem__(self, key: _T) -> dict[_U, _V]: ...
def copy(self) -> Self: ...
def copy(self) -> dict[_T, dict[_U, _V]]: ...
class AdjacencyView(AtlasView[_T, _U, _V]): ...
class MultiAdjacencyView(AdjacencyView[_T, _U, _V]): ...
+4 -3
View File
@@ -45,11 +45,11 @@ class Graph(Collection[_Node]):
def name(self) -> str: ...
@name.setter
def name(self, s: str) -> None: ...
def __getitem__(self, n: _Node) -> AtlasView[_Node, _Node, dict[str, Incomplete]]: ...
def __getitem__(self, n: _Node) -> AtlasView[_Node, str, Any]: ...
def __iter__(self) -> Iterator[_Node]: ...
def __contains__(self, n: object) -> bool: ...
def __len__(self) -> int: ...
def add_node(self, node_for_adding: _Node, **attr) -> None: ...
def add_node(self, node_for_adding: _Node, **attr: Any) -> None: ... # attr: Set or change node attributes using key=value
def add_nodes_from(self, nodes_for_adding: Iterable[_NodePlus[_Node]], **attr) -> None: ...
def remove_node(self, n: _Node) -> None: ...
def remove_nodes_from(self, nodes: Iterable[_Node]) -> None: ...
@@ -58,7 +58,8 @@ class Graph(Collection[_Node]):
def number_of_nodes(self) -> int: ...
def order(self) -> int: ...
def has_node(self, n: _Node) -> bool: ...
def add_edge(self, u_of_edge: _Node, v_of_edge: _Node, **attr) -> None: ...
# attr: Edge data (or labels or objects) can be assigned using keyword arguments
def add_edge(self, u_of_edge: _Node, v_of_edge: _Node, **attr: Any) -> None: ...
def add_edges_from(self, ebunch_to_add: Iterable[_EdgePlus[_Node]], **attr) -> None: ...
def add_weighted_edges_from(
self, ebunch_to_add: Iterable[tuple[_Node, _Node, Incomplete]], weight: str = "weight", **attr