Receive a collection append event. The append event is invoked for each element as it is appended to the collection. This occurs for single-item appends as well as for a "bulk replace" operation. :param target: the object instance receiving the event. If
(
self,
target: _O,
value: _T,
initiator: Event,
*,
key: EventConstants = NO_KEY,
)
| 2544 | mgr[target.key].dispatch._active_history = True |
| 2545 | |
| 2546 | def append( |
| 2547 | self, |
| 2548 | target: _O, |
| 2549 | value: _T, |
| 2550 | initiator: Event, |
| 2551 | *, |
| 2552 | key: EventConstants = NO_KEY, |
| 2553 | ) -> Optional[_T]: |
| 2554 | """Receive a collection append event. |
| 2555 | |
| 2556 | The append event is invoked for each element as it is appended |
| 2557 | to the collection. This occurs for single-item appends as well |
| 2558 | as for a "bulk replace" operation. |
| 2559 | |
| 2560 | :param target: the object instance receiving the event. |
| 2561 | If the listener is registered with ``raw=True``, this will |
| 2562 | be the :class:`.InstanceState` object. |
| 2563 | :param value: the value being appended. If this listener |
| 2564 | is registered with ``retval=True``, the listener |
| 2565 | function must return this value, or a new value which |
| 2566 | replaces it. |
| 2567 | :param initiator: An instance of :class:`.attributes.Event` |
| 2568 | representing the initiation of the event. May be modified |
| 2569 | from its original value by backref handlers in order to control |
| 2570 | chained event propagation, as well as be inspected for information |
| 2571 | about the source of the event. |
| 2572 | :param key: When the event is established using the |
| 2573 | :paramref:`.AttributeEvents.include_key` parameter set to |
| 2574 | True, this will be the key used in the operation, such as |
| 2575 | ``collection[some_key_or_index] = value``. |
| 2576 | The parameter is not passed |
| 2577 | to the event at all if the the |
| 2578 | :paramref:`.AttributeEvents.include_key` |
| 2579 | was not used to set up the event; this is to allow backwards |
| 2580 | compatibility with existing event handlers that don't include the |
| 2581 | ``key`` parameter. |
| 2582 | |
| 2583 | .. versionadded:: 2.0 |
| 2584 | |
| 2585 | :return: if the event was registered with ``retval=True``, |
| 2586 | the given value, or a new effective value, should be returned. |
| 2587 | |
| 2588 | .. seealso:: |
| 2589 | |
| 2590 | :class:`.AttributeEvents` - background on listener options such |
| 2591 | as propagation to subclasses. |
| 2592 | |
| 2593 | :meth:`.AttributeEvents.bulk_replace` |
| 2594 | |
| 2595 | """ |
| 2596 | |
| 2597 | def append_wo_mutation( |
| 2598 | self, |
no outgoing calls
no test coverage detected