Skip to content

Commit 9f8f621

Browse files
authored
[networkx] Enhance annotation for Networkx.Graph.add_weighted_edges_from (#15528)
1 parent 8193aa1 commit 9f8f621

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

stubs/networkx/networkx/algorithms/planarity.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from _typeshed import Incomplete, Unused
22
from collections.abc import Generator, Iterable, Mapping, MutableSet, Reversible
3+
from decimal import Decimal
34
from typing import NoReturn
45

56
from networkx.classes.digraph import DiGraph
@@ -109,5 +110,5 @@ class PlanarEmbedding(DiGraph[_Node]):
109110
def add_edge(self, u_of_edge: _Node, v_of_edge: _Node, **attr: Unused) -> NoReturn: ...
110111
def add_edges_from(self, ebunch_to_add: Iterable[_EdgePlus[_Node]], **attr: Unused) -> NoReturn: ...
111112
def add_weighted_edges_from(
112-
self, ebunch_to_add: Iterable[tuple[_Node, _Node, float]], weight: str = "weight", **attr: Unused
113+
self, ebunch_to_add: Iterable[tuple[_Node, _Node, float | Decimal | None]], weight: str = "weight", **attr: Unused
113114
) -> NoReturn: ...

stubs/networkx/networkx/classes/graph.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from collections.abc import Callable, Collection, Hashable, Iterable, Iterator, MutableMapping
2+
from decimal import Decimal
23
from functools import cached_property
34
from typing import Any, ClassVar, TypeVar, overload
45
from typing_extensions import Self, TypeAlias
@@ -71,7 +72,7 @@ class Graph(Collection[_Node]):
7172
def add_edges_from(self, ebunch_to_add: Iterable[_EdgePlus[_Node]], **attr: Any) -> None: ...
7273
# attr: Edge data (or labels or objects) can be assigned using keyword arguments
7374
def add_weighted_edges_from(
74-
self, ebunch_to_add: Iterable[tuple[_Node, _Node, float]], weight: str = "weight", **attr: Any
75+
self, ebunch_to_add: Iterable[tuple[_Node, _Node, float | Decimal | None]], weight: str = "weight", **attr: Any
7576
) -> None: ...
7677
# attr: Edge attributes to add/update for all edges.
7778
def remove_edge(self, u: _Node, v: _Node) -> None: ...

0 commit comments

Comments
 (0)