MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / coerce

Method coerce

lib/sqlalchemy/ext/mutable.py:872–879  ·  view source on GitHub ↗

Convert plain dictionary to instance of this class.

(cls, key: str, value: Any)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 1

coerceMethod · 0.45

Tested by

no test coverage detected