1
0

frozendict.pyi 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # Copyright 2020 The Matrix.org Foundation C.I.C.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # Stub for frozendict.
  15. from typing import Any, Hashable, Iterable, Iterator, Mapping, Tuple, TypeVar, overload
  16. _KT = TypeVar("_KT", bound=Hashable) # Key type.
  17. _VT = TypeVar("_VT") # Value type.
  18. class frozendict(Mapping[_KT, _VT]):
  19. @overload
  20. def __init__(self, **kwargs: _VT) -> None: ...
  21. @overload
  22. def __init__(self, __map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
  23. @overload
  24. def __init__(
  25. self, __iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT
  26. ) -> None: ...
  27. def __getitem__(self, key: _KT) -> _VT: ...
  28. def __contains__(self, key: Any) -> bool: ...
  29. def copy(self, **add_or_replace: Any) -> frozendict: ...
  30. def __iter__(self) -> Iterator[_KT]: ...
  31. def __len__(self) -> int: ...
  32. def __repr__(self) -> str: ...
  33. def __hash__(self) -> int: ...