diff --git a/stubs/networkx/networkx/classes/function.pyi b/stubs/networkx/networkx/classes/function.pyi index 17d152c96157..8ac27209e6a0 100644 --- a/stubs/networkx/networkx/classes/function.pyi +++ b/stubs/networkx/networkx/classes/function.pyi @@ -1,5 +1,5 @@ from _typeshed import Incomplete, SupportsItems, SupportsKeysAndGetItem, Unused -from collections.abc import Callable, Collection, Generator, Hashable, Iterable, Iterator +from collections.abc import Callable, Collection, Generator, Iterable, Iterator from typing import Literal, TypeVar, overload from networkx import _dispatchable @@ -63,11 +63,11 @@ def density(G: Graph[_Node]): ... def degree_histogram(G: Graph[_Node]) -> list[int]: ... @overload -def is_directed(G: PlanarEmbedding[Hashable]) -> Literal[False]: ... # type: ignore[misc] # Incompatible return types +def is_directed(G: PlanarEmbedding[_Node]) -> Literal[False]: ... # type: ignore[misc] # Incompatible return types @overload -def is_directed(G: DiGraph[Hashable]) -> Literal[True]: ... # type: ignore[misc] # Incompatible return types +def is_directed(G: DiGraph[_Node]) -> Literal[True]: ... # type: ignore[misc] # Incompatible return types @overload -def is_directed(G: Graph[Hashable]) -> Literal[False]: ... +def is_directed(G: Graph[_Node]) -> Literal[False]: ... def freeze(G: Graph[_Node]): ... def is_frozen(G: Graph[Incomplete]) -> bool: ... @@ -85,7 +85,7 @@ def create_empty_copy(G: Graph[_Node], with_data: bool = True): ... # incomplete: Can "Any scalar value" be enforced? @overload def set_node_attributes( - G: Graph[Hashable], + G: Graph[_Node], values: SupportsItems[_Node, Unused], name: str, *, @@ -126,9 +126,7 @@ def set_edge_attributes( **backend_kwargs, ) -> None: ... @overload -def set_edge_attributes( - G: Graph[Hashable], values, name: None = None, *, backend: str | None = None, **backend_kwargs -) -> None: ... +def set_edge_attributes(G: Graph[_Node], values, name: None = None, *, backend: str | None = None, **backend_kwargs) -> None: ... @_dispatchable def 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 @_dispatchable def is_negatively_weighted(G: Graph[_Node], edge: tuple[_Node, _Node] | None = None, weight: str = "weight") -> bool: ... @_dispatchable -def is_empty(G: Graph[Hashable]) -> bool: ... +def is_empty(G: Graph[_Node]) -> bool: ... def nodes_with_selfloops(G: Graph[_Node]) -> Generator[_Node]: ... @overload @@ -176,7 +174,7 @@ def selfloop_edges( ) -> Generator[tuple[_Node, _Node, int, _U]]: ... @_dispatchable -def number_of_selfloops(G: Graph[Hashable]) -> int: ... +def number_of_selfloops(G: Graph[_Node]) -> int: ... def is_path(G: Graph[_Node], path: Iterable[Incomplete]) -> bool: ... def path_weight(G: Graph[_Node], path: Collection[Incomplete], weight: str) -> int: ... def describe(G: Graph[_Node], describe_hook: Callable[[Graph[_Node]], dict[str, Incomplete]] | None = None) -> None: ...