def __init__(
        self, trigger, key_vals, dep_index, fn, associated_timer: Timer | None = None
    ):
        """
        The Dependency object is usualy not created directly but is returned when an event listener is set up. It contains the configuration
        data for the event listener, and can be used to set up additional event listeners that depend on the completion of the current event
        listener using .then() and .success().

        Demos: chatbot_consecutive, blocks_chained_events
        """

        super().__init__(key_vals)
        self.fn = fn
        self.associated_timer = associated_timer
        self.then = partial(
            EventListener(
                "then",
                trigger_after=dep_index,
                trigger_only_on_success=False,
                has_trigger=False,
            ).listener,
            trigger,
        )
        """
        Triggered after directly preceding event is completed, regardless of success or failure.
        """
        self.success = partial(
            EventListener(
                "success",
                trigger_after=dep_index,
                trigger_only_on_success=True,
                has_trigger=False,
            ).listener,
            trigger,
        )
        """
        Triggered after directly preceding event is completed, if it was successful.
        """

        The Dependency object is usualy not created directly but is returned when an event listener is set up. It contains the configuration
        data for the event listener, and can be used to set up additional event listeners that depend on the completion of the current event
        listener using .then() and .success().

        Demos: chatbot_consecutive, blocks_chained_events
        
gradio/events.py