code: def __init__(self, trigger, key_vals, dep_index, fn):
      super().__init__(key_vals)
      self.fn = fn
      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.
          """
  
imports: from __future__ import annotations
  import dataclasses
  from functools import partial, wraps
  from typing import TYPE_CHECKING, Any, Callable, Literal, Sequence
  from gradio_client.documentation import document
  from jinja2 import Template
  from gradio.context import Context
  from gradio.utils import get_cancel_function
label_desc: Use image node_id 1 to create a new Dependency object from inherited base classes: dict with example: obj = Dependency(trigger, key_vals, dep_index, fn)