[networkx] Enhance annotation for Networkx.Graph.add_weighted_edges_from (#15528)

This commit is contained in:
GBognar
2026-03-20 11:12:07 +01:00
committed by GitHub
parent 8193aa109c
commit 9f8f621918
2 changed files with 4 additions and 2 deletions
@@ -1,5 +1,6 @@
from _typeshed import Incomplete, Unused
from collections.abc import Generator, Iterable, Mapping, MutableSet, Reversible
from decimal import Decimal
from typing import NoReturn
from networkx.classes.digraph import DiGraph
@@ -109,5 +110,5 @@ class PlanarEmbedding(DiGraph[_Node]):
def add_edge(self, u_of_edge: _Node, v_of_edge: _Node, **attr: Unused) -> NoReturn: ...
def add_edges_from(self, ebunch_to_add: Iterable[_EdgePlus[_Node]], **attr: Unused) -> NoReturn: ...
def add_weighted_edges_from(
self, ebunch_to_add: Iterable[tuple[_Node, _Node, float]], weight: str = "weight", **attr: Unused
self, ebunch_to_add: Iterable[tuple[_Node, _Node, float | Decimal | None]], weight: str = "weight", **attr: Unused
) -> NoReturn: ...
+2 -1
View File
@@ -1,4 +1,5 @@
from collections.abc import Callable, Collection, Hashable, Iterable, Iterator, MutableMapping
from decimal import Decimal
from functools import cached_property
from typing import Any, ClassVar, TypeVar, overload
from typing_extensions import Self, TypeAlias
@@ -71,7 +72,7 @@ class Graph(Collection[_Node]):
def add_edges_from(self, ebunch_to_add: Iterable[_EdgePlus[_Node]], **attr: Any) -> None: ...
# attr: Edge data (or labels or objects) can be assigned using keyword arguments
def add_weighted_edges_from(
self, ebunch_to_add: Iterable[tuple[_Node, _Node, float]], weight: str = "weight", **attr: Any
self, ebunch_to_add: Iterable[tuple[_Node, _Node, float | Decimal | None]], weight: str = "weight", **attr: Any
) -> None: ...
# attr: Edge attributes to add/update for all edges.
def remove_edge(self, u: _Node, v: _Node) -> None: ...