rasa_sdk/forms.py
async def _activate_if_required(
        self,
        dispatcher: "CollectingDispatcher",
        tracker: "Tracker",
        domain: "DomainDict",
    ) -> List[EventType]:
        """Activate form if the form is called for the first time.

        If activating, validate any required slots that were filled before
        form activation and return `Form` event with the name of the form, as well
        as any `SlotSet` events from validation of pre-filled slots.
        """

        if tracker.active_loop.get("name") is not None:
            logger.debug(f"The form '{tracker.active_loop}' is active")
        else:
            logger.debug("There is no active form")

        if tracker.active_loop.get("name") == self.name():
            return []
        else:
            logger.debug(f"Activated the form '{self.name()}'")
            events = [ActiveLoop(self.name())]

            # collect values of required slots filled before activation
            prefilled_slots = {}

            for slot_name in self.required_slots(tracker):
                if not self._should_request_slot(tracker, slot_name):
                    prefilled_slots[slot_name] = tracker.get_slot(slot_name)

            if prefilled_slots:
                logger.debug(f"Validating pre-filled required slots: {prefilled_slots}")
                events.extend(
                    await self.validate_slots(
                        prefilled_slots, dispatcher, tracker, domain
                    )
                )
            else:
                logger.debug("No pre-filled required slots to validate.")

            return events
Activate form if the form is called for the first time.

        If activating, validate any required slots that were filled before
        form activation and return `Form` event with the name of the form, as well
        as any `SlotSet` events from validation of pre-filled slots.
        
Activate form if the form is called for the first time.
If activating, validate any required slots that were filled before
form activation and return `Form` event with the name of the form, as well
as any `SlotSet` events from validation of pre-filled slots.
Activate form if the form is called for the first time . If activating validate any required slots that were filled before form activation and return ` Form ` event with the name of the form as well as any ` SlotSet ` events from validation of pre - filled slots .
async def _activate_if_required(
        self,
        dispatcher: "CollectingDispatcher",
        tracker: "Tracker",
        domain: "DomainDict",
    ) -> List[EventType]:
        if tracker.active_loop.get("name") is not None:
            logger.debug(f"The form '{tracker.active_loop}' is active")
        else:
            logger.debug("There is no active form")
        if tracker.active_loop.get("name") == self.name():
            return []
        else:
            logger.debug(f"Activated the form '{self.name()}'")
            events = [ActiveLoop(self.name())]
            prefilled_slots = {}
            for slot_name in self.required_slots(tracker):
                if not self._should_request_slot(tracker, slot_name):
                    prefilled_slots[slot_name] = tracker.get_slot(slot_name)
            if prefilled_slots:
                logger.debug(f"Validating pre-filled required slots: {prefilled_slots}")
                events.extend(
                    await self.validate_slots(
                        prefilled_slots, dispatcher, tracker, domain
                    )
                )
            else:
                logger.debug("No pre-filled required slots to validate.")
            return events
async def _activate_if_required ( self , dispatcher : "CollectingDispatcher" , tracker : "Tracker" , domain : "DomainDict" , ) -> List [ EventType ] : if tracker . active_loop . get ( "name" ) is not None : logger . debug ( f"The form '{tracker.active_loop}' is active" ) else : logger . debug ( "There is no active form" ) if tracker . active_loop . get ( "name" ) == self . name ( ) : return [ ] else : logger . debug ( f"Activated the form '{self.name()}'" ) events = [ ActiveLoop ( self . name ( ) ) ] prefilled_slots = { } for slot_name in self . required_slots ( tracker ) : if not self . _should_request_slot ( tracker , slot_name ) : prefilled_slots [ slot_name ] = tracker . get_slot ( slot_name ) if prefilled_slots : logger . debug ( f"Validating pre-filled required slots: {prefilled_slots}" ) events . extend ( await self . validate_slots ( prefilled_slots , dispatcher , tracker , domain ) ) else : logger . debug ( "No pre-filled required slots to validate." ) return events
Activate form if the form is called for the first time.
Activate form if the form is called for the first time .
"""Activate form if the form is called for the first time.

        If activating, validate any required slots that were filled before
        form activation and return `Form` event with the name of the form, as well
        as any `SlotSet` events from validation of pre-filled slots.
        """ # collect values of required slots filled before activation
self
dispatcher
"CollectingDispatcher"
tracker
"Tracker"
domain
"DomainDict"