Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions stubs/networkx/networkx/classes/function.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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: ...
Expand All @@ -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,
*,
Expand Down Expand Up @@ -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]: ...
Expand All @@ -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
Expand Down Expand Up @@ -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: ...
Loading