|
6 | 6 |
|
7 | 7 | from __future__ import annotations |
8 | 8 |
|
9 | | -from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence |
| 9 | +from collections.abc import Callable, Hashable, Iterable, Iterator, Mapping, Sequence |
10 | 10 | from datetime import datetime |
11 | 11 | from io import RawIOBase |
12 | 12 | from pathlib import Path |
13 | | -from typing import Any, ClassVar, Protocol, Self, TextIO, TypeVar, overload |
| 13 | +from typing import AbstractSet, Any, ClassVar, Protocol, Self, TextIO, TypeVar, overload |
14 | 14 |
|
15 | 15 | from pants.engine.fs import ( |
16 | 16 | CreateDigest, |
@@ -81,6 +81,34 @@ class FrozenDict(Mapping[K, V]): |
81 | 81 | def __hash__(self) -> int: ... |
82 | 82 | def __repr__(self) -> str: ... |
83 | 83 |
|
| 84 | +T_co = TypeVar("T_co", covariant=True) |
| 85 | + |
| 86 | +class FrozenOrderedSet(AbstractSet[T_co], Hashable): |
| 87 | + """A frozen (i.e. immutable) ordered set backed by Rust. |
| 88 | +
|
| 89 | + This is safe to use with the V2 engine. |
| 90 | + """ |
| 91 | + |
| 92 | + def __new__(cls, iterable: Iterable[T_co] | None = None) -> Self: ... |
| 93 | + def __len__(self) -> int: ... |
| 94 | + def __contains__(self, key: Any) -> bool: ... |
| 95 | + def __iter__(self) -> Iterator[T_co]: ... |
| 96 | + def __reversed__(self) -> Iterator[T_co]: ... |
| 97 | + def __hash__(self) -> int: ... |
| 98 | + def __eq__(self, other: Any) -> bool: ... |
| 99 | + def __or__(self, other: Iterable[T_co]) -> FrozenOrderedSet[T_co]: ... # type: ignore[override] # widens from AbstractSet |
| 100 | + def __and__(self, other: Iterable[T_co]) -> FrozenOrderedSet[T_co]: ... |
| 101 | + def __sub__(self, other: Iterable[T_co]) -> FrozenOrderedSet[T_co]: ... |
| 102 | + def __xor__(self, other: Iterable[T_co]) -> FrozenOrderedSet[T_co]: ... # type: ignore[override] # widens from AbstractSet |
| 103 | + def __bool__(self) -> bool: ... |
| 104 | + def __repr__(self) -> str: ... |
| 105 | + def union(self, *others: Iterable[T_co]) -> FrozenOrderedSet[T_co]: ... |
| 106 | + def intersection(self, *others: Iterable[T_co]) -> FrozenOrderedSet[T_co]: ... |
| 107 | + def difference(self, *others: Iterable[T_co]) -> FrozenOrderedSet[T_co]: ... |
| 108 | + def symmetric_difference(self, other: Iterable[T_co]) -> FrozenOrderedSet[T_co]: ... |
| 109 | + def issubset(self, other: Iterable[T_co]) -> bool: ... |
| 110 | + def issuperset(self, other: Iterable[T_co]) -> bool: ... |
| 111 | + |
84 | 112 | # ------------------------------------------------------------------------------ |
85 | 113 | # Address |
86 | 114 | # ------------------------------------------------------------------------------ |
|
0 commit comments