| 703 | |
| 704 | @classmethod |
| 705 | def populate( |
| 706 | cls, |
| 707 | class_: Union[DeclarativeAttributeIntercept, DeclarativeMeta, type], |
| 708 | subject: Union[ClassManager[_O], Mapper[_O]], |
| 709 | ) -> None: |
| 710 | for subclass in class_.__mro__: |
| 711 | if subclass in cls.all_holds: |
| 712 | collection = cls.all_holds[subclass] |
| 713 | for ( |
| 714 | event_key, |
| 715 | raw, |
| 716 | propagate, |
| 717 | retval, |
| 718 | kw, |
| 719 | ) in collection.values(): |
| 720 | if propagate or subclass is class_: |
| 721 | # since we can't be sure in what order different |
| 722 | # classes in a hierarchy are triggered with |
| 723 | # populate(), we rely upon _EventsHold for all event |
| 724 | # assignment, instead of using the generic propagate |
| 725 | # flag. |
| 726 | event_key.with_dispatch_target(subject).listen( |
| 727 | raw=raw, propagate=False, retval=retval, **kw |
| 728 | ) |
| 729 | |
| 730 | |
| 731 | class _InstanceEventsHold(_EventsHold[_ET]): |