MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / populate

Method populate

lib/sqlalchemy/orm/events.py:685–708  ·  view source on GitHub ↗
(
        cls,
        class_: Union[DeclarativeAttributeIntercept, DeclarativeMeta, type],
        subject: Union[ClassManager[_O], Mapper[_O]],
    )

Source from the content-addressed store, hash-verified

683
684 @classmethod
685 def populate(
686 cls,
687 class_: Union[DeclarativeAttributeIntercept, DeclarativeMeta, type],
688 subject: Union[ClassManager[_O], Mapper[_O]],
689 ) -> None:
690 for subclass in class_.__mro__:
691 if subclass in cls.all_holds:
692 collection = cls.all_holds[subclass]
693 for (
694 event_key,
695 raw,
696 propagate,
697 retval,
698 kw,
699 ) in collection.values():
700 if propagate or subclass is class_:
701 # since we can't be sure in what order different
702 # classes in a hierarchy are triggered with
703 # populate(), we rely upon _EventsHold for all event
704 # assignment, instead of using the generic propagate
705 # flag.
706 event_key.with_dispatch_target(subject).listen(
707 raw=raw, propagate=False, retval=retval, **kw
708 )
709
710
711class _InstanceEventsHold(_EventsHold[_ET]):

Callers 2

_new_mapper_instanceMethod · 0.45

Calls 3

with_dispatch_targetMethod · 0.80
valuesMethod · 0.45
listenMethod · 0.45

Tested by

no test coverage detected