[networkx] add stubs for networkx.utils.union_find.UnionFind (#15126)

This commit is contained in:
Cal Jacobson
2025-12-11 16:51:09 -05:00
committed by GitHub
parent 75e2639052
commit 2712bc5d04
+12 -10
View File
@@ -1,11 +1,13 @@
from _typeshed import Incomplete
from collections.abc import Generator, Iterator
from collections.abc import Generator, Iterable, Iterator, Mapping
from typing import Generic, TypeVar
class UnionFind:
parents: Incomplete
weights: Incomplete
def __init__(self, elements=None) -> None: ...
def __getitem__(self, object): ...
def __iter__(self) -> Iterator[Incomplete]: ...
def to_sets(self) -> Generator[Incomplete, Incomplete, None]: ...
def union(self, *objects): ...
_T = TypeVar("_T")
class UnionFind(Generic[_T]):
parents: Mapping[_T, _T]
weights: Mapping[_T, int]
def __init__(self, elements: Iterable[_T] | None = None) -> None: ...
def __getitem__(self, object: _T) -> _T: ...
def __iter__(self) -> Iterator[_T]: ...
def to_sets(self) -> Generator[set[_T]]: ...
def union(self, *objects: _T) -> None: ...