frozendict.pyi 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # -*- coding: utf-8 -*-
  2. # Copyright 2020 The Matrix.org Foundation C.I.C.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # Stub for frozendict.
  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: ...