11from _typeshed import Incomplete , SupportsItems , SupportsKeysAndGetItem , Unused
2- from collections .abc import Callable , Collection , Generator , Hashable , Iterable , Iterator
2+ from collections .abc import Callable , Collection , Generator , Iterable , Iterator
33from typing import Literal , TypeVar , overload
44
55from networkx import _dispatchable
@@ -63,11 +63,11 @@ def density(G: Graph[_Node]): ...
6363def degree_histogram (G : Graph [_Node ]) -> list [int ]: ...
6464
6565@overload
66- def is_directed (G : PlanarEmbedding [Hashable ]) -> Literal [False ]: ... # type: ignore[misc] # Incompatible return types
66+ def is_directed (G : PlanarEmbedding [_Node ]) -> Literal [False ]: ... # type: ignore[misc] # Incompatible return types
6767@overload
68- def is_directed (G : DiGraph [Hashable ]) -> Literal [True ]: ... # type: ignore[misc] # Incompatible return types
68+ def is_directed (G : DiGraph [_Node ]) -> Literal [True ]: ... # type: ignore[misc] # Incompatible return types
6969@overload
70- def is_directed (G : Graph [Hashable ]) -> Literal [False ]: ...
70+ def is_directed (G : Graph [_Node ]) -> Literal [False ]: ...
7171
7272def freeze (G : Graph [_Node ]): ...
7373def is_frozen (G : Graph [Incomplete ]) -> bool : ...
@@ -85,7 +85,7 @@ def create_empty_copy(G: Graph[_Node], with_data: bool = True): ...
8585# incomplete: Can "Any scalar value" be enforced?
8686@overload
8787def set_node_attributes (
88- G : Graph [Hashable ],
88+ G : Graph [_Node ],
8989 values : SupportsItems [_Node , Unused ],
9090 name : str ,
9191 * ,
@@ -126,9 +126,7 @@ def set_edge_attributes(
126126 ** backend_kwargs ,
127127) -> None : ...
128128@overload
129- def set_edge_attributes (
130- G : Graph [Hashable ], values , name : None = None , * , backend : str | None = None , ** backend_kwargs
131- ) -> None : ...
129+ def set_edge_attributes (G : Graph [_Node ], values , name : None = None , * , backend : str | None = None , ** backend_kwargs ) -> None : ...
132130
133131@_dispatchable
134132def get_edge_attributes (G : Graph [_Node ], name : str , default = None ) -> dict [tuple [_Node , _Node ], Incomplete ]: ...
@@ -143,7 +141,7 @@ def is_weighted(G: Graph[_Node], edge: tuple[_Node, _Node] | None = None, weight
143141@_dispatchable
144142def is_negatively_weighted (G : Graph [_Node ], edge : tuple [_Node , _Node ] | None = None , weight : str = "weight" ) -> bool : ...
145143@_dispatchable
146- def is_empty (G : Graph [Hashable ]) -> bool : ...
144+ def is_empty (G : Graph [_Node ]) -> bool : ...
147145def nodes_with_selfloops (G : Graph [_Node ]) -> Generator [_Node ]: ...
148146
149147@overload
@@ -176,7 +174,7 @@ def selfloop_edges(
176174) -> Generator [tuple [_Node , _Node , int , _U ]]: ...
177175
178176@_dispatchable
179- def number_of_selfloops (G : Graph [Hashable ]) -> int : ...
177+ def number_of_selfloops (G : Graph [_Node ]) -> int : ...
180178def is_path (G : Graph [_Node ], path : Iterable [Incomplete ]) -> bool : ...
181179def path_weight (G : Graph [_Node ], path : Collection [Incomplete ], weight : str ) -> int : ...
182180def describe (G : Graph [_Node ], describe_hook : Callable [[Graph [_Node ]], dict [str , Incomplete ]] | None = None ) -> None : ...
0 commit comments