Wrapper around an object implementing the mapping interface to make it immutable. If you really want to modify the mapping, the mutable version is saved under the `mapping` attribute.
| 492 | |
| 493 | |
| 494 | class Frozen(Mapping[K, V]): |
| 495 | """Wrapper around an object implementing the mapping interface to make it |
| 496 | immutable. If you really want to modify the mapping, the mutable version is |
| 497 | saved under the `mapping` attribute. |
| 498 | """ |
| 499 | |
| 500 | __slots__ = ("mapping",) |
| 501 | |
| 502 | def __init__(self, mapping: Mapping[K, V]): |
| 503 | self.mapping = mapping |
| 504 | |
| 505 | def __getitem__(self, key: K) -> V: |
| 506 | return self.mapping[key] |
| 507 | |
| 508 | def __iter__(self) -> Iterator[K]: |
| 509 | return iter(self.mapping) |
| 510 | |
| 511 | def __len__(self) -> int: |
| 512 | return len(self.mapping) |
| 513 | |
| 514 | def __contains__(self, key: object) -> bool: |
| 515 | return key in self.mapping |
| 516 | |
| 517 | def __repr__(self) -> str: |
| 518 | return f"{type(self).__name__}({self.mapping!r})" |
| 519 | |
| 520 | |
| 521 | def FrozenDict(*args, **kwargs) -> Frozen: |
no outgoing calls
no test coverage detected
searching dependent graphs…