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

Method _commit_all_states

lib/sqlalchemy/orm/state.py:1012–1033  ·  view source on GitHub ↗

Mass / highly inlined version of commit_all().

(
        self,
        iter_: Iterable[Tuple[InstanceState[Any], _InstanceDict]],
        instance_dict: Optional[IdentityMap] = None,
    )

Source from the content-addressed store, hash-verified

1010
1011 @classmethod
1012 def _commit_all_states(
1013 self,
1014 iter_: Iterable[Tuple[InstanceState[Any], _InstanceDict]],
1015 instance_dict: Optional[IdentityMap] = None,
1016 ) -> None:
1017 """Mass / highly inlined version of commit_all()."""
1018
1019 for state, dict_ in iter_:
1020 state_dict = state.__dict__
1021
1022 state.committed_state.clear()
1023
1024 if "_pending_mutations" in state_dict:
1025 del state_dict["_pending_mutations"]
1026
1027 state.expired_attributes.difference_update(dict_)
1028
1029 if instance_dict and state.modified:
1030 instance_dict._modified.discard(state)
1031
1032 state.modified = state.expired = False
1033 state._strong_obj = None
1034
1035
1036class AttributeState:

Callers 3

_commit_allMethod · 0.95
_register_persistentMethod · 0.80
_flushMethod · 0.80

Calls 3

clearMethod · 0.45
difference_updateMethod · 0.45
discardMethod · 0.45

Tested by

no test coverage detected