frozendict.pyi 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 __future__ import annotations
  16. from typing import Any, Hashable, Iterable, Iterator, Mapping, Tuple, TypeVar, overload
  17. _KT = TypeVar("_KT", bound=Hashable) # Key type.
  18. _VT = TypeVar("_VT") # Value type.
  19. class frozendict(Mapping[_KT, _VT]):
  20. @overload
  21. def __init__(self, **kwargs: _VT) -> None: ...
  22. @overload
  23. def __init__(self, __map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
  24. @overload
  25. def __init__(
  26. self, __iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT
  27. ) -> None: ...
  28. def __getitem__(self, key: _KT) -> _VT: ...
  29. def __contains__(self, key: Any) -> bool: ...
  30. def copy(self, **add_or_replace: Any) -> frozendict: ...
  31. def __iter__(self) -> Iterator[_KT]: ...
  32. def __len__(self) -> int: ...
  33. def __repr__(self) -> str: ...
  34. def __hash__(self) -> int: ...