Convert plain dictionary to instance of this class.
(cls, key: str, value: Any)
| 870 | |
| 871 | @classmethod |
| 872 | def coerce(cls, key: str, value: Any) -> MutableDict[_KT, _VT] | None: |
| 873 | """Convert plain dictionary to instance of this class.""" |
| 874 | if not isinstance(value, cls): |
| 875 | if isinstance(value, dict): |
| 876 | return cls(value) |
| 877 | return Mutable.coerce(key, value) |
| 878 | else: |
| 879 | return value |
| 880 | |
| 881 | def __getstate__(self) -> Dict[_KT, _VT]: |
| 882 | return dict(self) |