rasa/core/trackers.py
def applied_events(self) -> List[Event]:
        """Returns all actions that should be applied - w/o reverted events."""

        def undo_till_previous(event_type, done_events):
            """Removes events from `done_events` until `event_type` is
               found."""
            # list gets modified - hence we need to copy events!
            for e in reversed(done_events[:]):
                del done_events[-1]
                if isinstance(e, event_type):
                    break

        applied_events = []
        for event in self.events:
            if isinstance(event, Restarted):
                applied_events = []
            elif isinstance(event, ActionReverted):
                undo_till_previous(ActionExecuted, applied_events)
            elif isinstance(event, UserUtteranceReverted):
                # Seeing a user uttered event automatically implies there was
                # a listen event right before it, so we'll first rewind the
                # user utterance, then get the action right before it (the
                # listen action).
                undo_till_previous(UserUttered, applied_events)
                undo_till_previous(ActionExecuted, applied_events)
            else:
                applied_events.append(event)
        return applied_events
Returns all actions that should be applied - w/o reverted events.
Returns all actions that should be applied - w/o reverted events.
Returns all actions that should be applied - w / o reverted events .
def applied_events(self) -> List[Event]:
        def undo_till_previous(event_type, done_events):
            for e in reversed(done_events[:]):
                del done_events[-1]
                if isinstance(e, event_type):
                    break
        applied_events = []
        for event in self.events:
            if isinstance(event, Restarted):
                applied_events = []
            elif isinstance(event, ActionReverted):
                undo_till_previous(ActionExecuted, applied_events)
            elif isinstance(event, UserUtteranceReverted):
                undo_till_previous(UserUttered, applied_events)
                undo_till_previous(ActionExecuted, applied_events)
            else:
                applied_events.append(event)
        return applied_events
def applied_events ( self ) -> List [ Event ] : def undo_till_previous ( event_type , done_events ) : """Removes events from `done_events` until `event_type` is
               found.""" for e in reversed ( done_events [ : ] ) : del done_events [ - 1 ] if isinstance ( e , event_type ) : break applied_events = [ ] for event in self . events : if isinstance ( event , Restarted ) : applied_events = [ ] elif isinstance ( event , ActionReverted ) : undo_till_previous ( ActionExecuted , applied_events ) elif isinstance ( event , UserUtteranceReverted ) : undo_till_previous ( UserUttered , applied_events ) undo_till_previous ( ActionExecuted , applied_events ) else : applied_events . append ( event ) return applied_events
Returns all actions that should be applied - w/o reverted events.
Returns all actions that should be applied - w / o reverted events .
"""Returns all actions that should be applied - w/o reverted events.""" """Removes events from `done_events` until `event_type` is
               found.""" # list gets modified - hence we need to copy events! # Seeing a user uttered event automatically implies there was # a listen event right before it, so we'll first rewind the # user utterance, then get the action right before it (the # listen action).
self