MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / set

Method set

lib/sqlalchemy/orm/attributes.py:1271–1291  ·  view source on GitHub ↗
(
        self,
        state: InstanceState[Any],
        dict_: Dict[str, Any],
        value: Any,
        initiator: Optional[AttributeEventToken] = None,
        passive: PassiveFlag = PASSIVE_OFF,
        check_old: Optional[object] = None,
        pop: bool = False,
    )

Source from the content-addressed store, hash-verified

1269 return History.from_scalar_attribute(self, state, current)
1270
1271 def set(
1272 self,
1273 state: InstanceState[Any],
1274 dict_: Dict[str, Any],
1275 value: Any,
1276 initiator: Optional[AttributeEventToken] = None,
1277 passive: PassiveFlag = PASSIVE_OFF,
1278 check_old: Optional[object] = None,
1279 pop: bool = False,
1280 ) -> None:
1281 if self.dispatch._active_history:
1282 old = self.get(state, dict_, PASSIVE_RETURN_NO_VALUE)
1283 else:
1284 old = dict_.get(self.key, NO_VALUE)
1285
1286 if self.dispatch.set:
1287 value = self.fire_replace_event(
1288 state, dict_, value, old, initiator
1289 )
1290 state._modified_event(dict_, self, old)
1291 dict_[self.key] = value
1292
1293 def fire_replace_event(
1294 self,

Callers

nothing calls this directly

Calls 3

fire_replace_eventMethod · 0.95
getMethod · 0.45
_modified_eventMethod · 0.45

Tested by

no test coverage detected