diff --git a/stubs/networkx/networkx/algorithms/tree/coding.pyi b/stubs/networkx/networkx/algorithms/tree/coding.pyi index 619dc44d5142..87fc22938a46 100644 --- a/stubs/networkx/networkx/algorithms/tree/coding.pyi +++ b/stubs/networkx/networkx/algorithms/tree/coding.pyi @@ -1,5 +1,6 @@ from _typeshed import Incomplete from collections.abc import Iterable +from typing_extensions import TypeAlias from networkx.classes.graph import Graph, _Node from networkx.exception import NetworkXException @@ -7,12 +8,14 @@ from networkx.utils.backends import _dispatchable __all__ = ["from_nested_tuple", "from_prufer_sequence", "NotATree", "to_nested_tuple", "to_prufer_sequence"] +_NestedTuple: TypeAlias = tuple[_NestedTuple, ...] + class NotATree(NetworkXException): ... @_dispatchable def to_nested_tuple(T: Graph[_Node], root: _Node, canonical_form: bool = False): ... @_dispatchable -def from_nested_tuple(sequence: tuple[Incomplete, ...], sensible_relabeling: bool = False): ... +def from_nested_tuple(sequence: _NestedTuple, sensible_relabeling: bool = False): ... @_dispatchable def to_prufer_sequence(T: Graph[_Node]): ... @_dispatchable