frozenlist.pyi 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. from typing import (
  2. Generic,
  3. Iterable,
  4. Iterator,
  5. List,
  6. MutableSequence,
  7. Optional,
  8. TypeVar,
  9. Union,
  10. overload,
  11. )
  12. _T = TypeVar("_T")
  13. _Arg = Union[List[_T], Iterable[_T]]
  14. class FrozenList(MutableSequence[_T], Generic[_T]):
  15. def __init__(self, items: Optional[_Arg[_T]] = ...) -> None: ...
  16. @property
  17. def frozen(self) -> bool: ...
  18. def freeze(self) -> None: ...
  19. @overload
  20. def __getitem__(self, i: int) -> _T: ...
  21. @overload
  22. def __getitem__(self, s: slice) -> FrozenList[_T]: ...
  23. @overload
  24. def __setitem__(self, i: int, o: _T) -> None: ...
  25. @overload
  26. def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
  27. @overload
  28. def __delitem__(self, i: int) -> None: ...
  29. @overload
  30. def __delitem__(self, i: slice) -> None: ...
  31. def __len__(self) -> int: ...
  32. def __iter__(self) -> Iterator[_T]: ...
  33. def __reversed__(self) -> Iterator[_T]: ...
  34. def __eq__(self, other: object) -> bool: ...
  35. def __le__(self, other: FrozenList[_T]) -> bool: ...
  36. def __ne__(self, other: object) -> bool: ...
  37. def __lt__(self, other: FrozenList[_T]) -> bool: ...
  38. def __ge__(self, other: FrozenList[_T]) -> bool: ...
  39. def __gt__(self, other: FrozenList[_T]) -> bool: ...
  40. def insert(self, pos: int, item: _T) -> None: ...
  41. def __repr__(self) -> str: ...
  42. # types for C accelerators are the same
  43. CFrozenList = PyFrozenList = FrozenList