r"""Receive a class when the mapper is first constructed, before instrumentation is applied to the mapped class. This event is the earliest phase of mapper construction. Most attributes of the mapper are not yet initialized. To receive an event within initial mappe
(self, mapper: Mapper[_O], class_: Type[_O])
| 888 | _MapperEventsHold._clear() |
| 889 | |
| 890 | def instrument_class(self, mapper: Mapper[_O], class_: Type[_O]) -> None: |
| 891 | r"""Receive a class when the mapper is first constructed, |
| 892 | before instrumentation is applied to the mapped class. |
| 893 | |
| 894 | This event is the earliest phase of mapper construction. |
| 895 | Most attributes of the mapper are not yet initialized. To |
| 896 | receive an event within initial mapper construction where basic |
| 897 | state is available such as the :attr:`_orm.Mapper.attrs` collection, |
| 898 | the :meth:`_orm.MapperEvents.after_mapper_constructed` event may |
| 899 | be a better choice. |
| 900 | |
| 901 | This listener can either be applied to the :class:`_orm.Mapper` |
| 902 | class overall, or to any un-mapped class which serves as a base |
| 903 | for classes that will be mapped (using the ``propagate=True`` flag):: |
| 904 | |
| 905 | Base = declarative_base() |
| 906 | |
| 907 | |
| 908 | @event.listens_for(Base, "instrument_class", propagate=True) |
| 909 | def on_new_class(mapper, cls_): |
| 910 | "..." |
| 911 | |
| 912 | :param mapper: the :class:`_orm.Mapper` which is the target |
| 913 | of this event. |
| 914 | :param class\_: the mapped class. |
| 915 | |
| 916 | .. seealso:: |
| 917 | |
| 918 | :meth:`_orm.MapperEvents.after_mapper_constructed` |
| 919 | |
| 920 | """ |
| 921 | |
| 922 | def after_mapper_constructed( |
| 923 | self, mapper: Mapper[_O], class_: Type[_O] |
no outgoing calls
no test coverage detected