MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / __call__

Method __call__

lib/sqlalchemy/orm/mapped_collection.py:73–88  ·  view source on GitHub ↗
(self, value: _KT)

Source from the content-addressed store, hash-verified

71 return self.cols
72
73 def __call__(self, value: _KT) -> MissingOr[Union[_KT, Tuple[_KT, ...]]]:
74 state = base.instance_state(value)
75 m = base._state_mapper(state)
76
77 key: List[_KT] = [
78 m._get_state_attr_by_column(state, state.dict, col)
79 for col in self._cols(m)
80 ]
81 if self.composite:
82 return tuple(key)
83 else:
84 obj = key[0]
85 if obj is None:
86 return Missing
87 else:
88 return obj
89
90
91class _SerializableColumnGetterV2(_PlainColumnGetter[_KT]):

Callers

nothing calls this directly

Calls 2

_colsMethod · 0.95

Tested by

no test coverage detected