Convert plain list to instance of this class.
(
cls, key: str, value: MutableList[_T] | _T
)
| 971 | |
| 972 | @classmethod |
| 973 | def coerce( |
| 974 | cls, key: str, value: MutableList[_T] | _T |
| 975 | ) -> Optional[MutableList[_T]]: |
| 976 | """Convert plain list to instance of this class.""" |
| 977 | if not isinstance(value, cls): |
| 978 | if isinstance(value, list): |
| 979 | return cls(value) |
| 980 | return Mutable.coerce(key, value) |
| 981 | else: |
| 982 | return value |
| 983 | |
| 984 | |
| 985 | class MutableSet(Mutable, Set[_T]): |