MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / set

Method set

lib/sqlalchemy/orm/attributes.py:1289–1312  ·  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

1287 return History.from_scalar_attribute(self, state, current)
1288
1289 def set(
1290 self,
1291 state: InstanceState[Any],
1292 dict_: Dict[str, Any],
1293 value: Any,
1294 initiator: Optional[AttributeEventToken] = None,
1295 passive: PassiveFlag = PASSIVE_OFF,
1296 check_old: Optional[object] = None,
1297 pop: bool = False,
1298 ) -> None:
1299 if value is DONT_SET:
1300 return
1301
1302 if self.dispatch._active_history:
1303 old = self.get(state, dict_, PASSIVE_RETURN_NO_VALUE)
1304 else:
1305 old = dict_.get(self.key, NO_VALUE)
1306
1307 if self.dispatch.set:
1308 value = self.fire_replace_event(
1309 state, dict_, value, old, initiator
1310 )
1311 state._modified_event(dict_, self, old)
1312 dict_[self.key] = value
1313
1314 def fire_replace_event(
1315 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