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