sortedset.pyi 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. # stub for SortedSet. This is a lightly edited copy of
  2. # https://github.com/grantjenks/python-sortedcontainers/blob/d0a225d7fd0fb4c54532b8798af3cbeebf97e2d5/sortedcontainers/sortedset.pyi
  3. # (from https://github.com/grantjenks/python-sortedcontainers/pull/107)
  4. from __future__ import annotations
  5. from typing import (
  6. Any,
  7. Callable,
  8. Hashable,
  9. Iterable,
  10. Iterator,
  11. List,
  12. MutableSet,
  13. Optional,
  14. Sequence,
  15. Set,
  16. Tuple,
  17. Type,
  18. TypeVar,
  19. Union,
  20. overload,
  21. )
  22. # --- Global
  23. _T = TypeVar("_T", bound=Hashable)
  24. _S = TypeVar("_S", bound=Hashable)
  25. _SS = TypeVar("_SS", bound=SortedSet)
  26. _Key = Callable[[_T], Any]
  27. class SortedSet(MutableSet[_T], Sequence[_T]):
  28. def __init__(
  29. self,
  30. iterable: Optional[Iterable[_T]] = ...,
  31. key: Optional[_Key[_T]] = ...,
  32. ) -> None: ...
  33. @classmethod
  34. def _fromset(
  35. cls, values: Set[_T], key: Optional[_Key[_T]] = ...
  36. ) -> SortedSet[_T]: ...
  37. @property
  38. def key(self) -> Optional[_Key[_T]]: ...
  39. def __contains__(self, value: Any) -> bool: ...
  40. @overload
  41. def __getitem__(self, index: int) -> _T: ...
  42. @overload
  43. def __getitem__(self, index: slice) -> List[_T]: ...
  44. def __delitem__(self, index: Union[int, slice]) -> None: ...
  45. def __eq__(self, other: Any) -> bool: ...
  46. def __ne__(self, other: Any) -> bool: ...
  47. def __lt__(self, other: Iterable[_T]) -> bool: ...
  48. def __gt__(self, other: Iterable[_T]) -> bool: ...
  49. def __le__(self, other: Iterable[_T]) -> bool: ...
  50. def __ge__(self, other: Iterable[_T]) -> bool: ...
  51. def __len__(self) -> int: ...
  52. def __iter__(self) -> Iterator[_T]: ...
  53. def __reversed__(self) -> Iterator[_T]: ...
  54. def add(self, value: _T) -> None: ...
  55. def _add(self, value: _T) -> None: ...
  56. def clear(self) -> None: ...
  57. def copy(self: _SS) -> _SS: ...
  58. def __copy__(self: _SS) -> _SS: ...
  59. def count(self, value: _T) -> int: ...
  60. def discard(self, value: _T) -> None: ...
  61. def _discard(self, value: _T) -> None: ...
  62. def pop(self, index: int = ...) -> _T: ...
  63. def remove(self, value: _T) -> None: ...
  64. def difference(self, *iterables: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  65. def __sub__(self, *iterables: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  66. def difference_update(
  67. self, *iterables: Iterable[_S]
  68. ) -> SortedSet[Union[_T, _S]]: ...
  69. def __isub__(self, *iterables: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  70. def intersection(self, *iterables: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  71. def __and__(self, *iterables: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  72. def __rand__(self, *iterables: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  73. def intersection_update(
  74. self, *iterables: Iterable[_S]
  75. ) -> SortedSet[Union[_T, _S]]: ...
  76. def __iand__(self, *iterables: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  77. def symmetric_difference(self, other: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  78. def __xor__(self, other: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  79. def __rxor__(self, other: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  80. def symmetric_difference_update(
  81. self, other: Iterable[_S]
  82. ) -> SortedSet[Union[_T, _S]]: ...
  83. def __ixor__(self, other: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  84. def union(self, *iterables: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  85. def __or__(self, *iterables: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  86. def __ror__(self, *iterables: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  87. def update(self, *iterables: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  88. def __ior__(self, *iterables: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  89. def _update(self, *iterables: Iterable[_S]) -> SortedSet[Union[_T, _S]]: ...
  90. def __reduce__(
  91. self,
  92. ) -> Tuple[Type[SortedSet[_T]], Set[_T], Callable[[_T], Any]]: ...
  93. def __repr__(self) -> str: ...
  94. def _check(self) -> None: ...
  95. def bisect_left(self, value: _T) -> int: ...
  96. def bisect_right(self, value: _T) -> int: ...
  97. def islice(
  98. self,
  99. start: Optional[int] = ...,
  100. stop: Optional[int] = ...,
  101. reverse: bool = ...,
  102. ) -> Iterator[_T]: ...
  103. def irange(
  104. self,
  105. minimum: Optional[_T] = ...,
  106. maximum: Optional[_T] = ...,
  107. inclusive: Tuple[bool, bool] = ...,
  108. reverse: bool = ...,
  109. ) -> Iterator[_T]: ...
  110. def index(
  111. self, value: _T, start: Optional[int] = ..., stop: Optional[int] = ...
  112. ) -> int: ...
  113. def _reset(self, load: int) -> None: ...