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

Method coerce

lib/sqlalchemy/ext/mutable.py:973–982  ·  view source on GitHub ↗

Convert plain list to instance of this class.

(
        cls, key: str, value: MutableList[_T] | _T
    )

Source from the content-addressed store, hash-verified

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
985class MutableSet(Mutable, Set[_T]):

Callers

nothing calls this directly

Calls 1

coerceMethod · 0.45

Tested by

no test coverage detected