class_docstr: Context manager for setup/teardown tasks.
  
  :meta private:
docstr: Recursively go through the tasks upstream of the teardown task in the context manager.
  
  If found, updates the _setup_upstream_of_teardown accordingly.
docstr_tok: ["Recursively","go","through","the","tasks","upstream","of","the","teardown","task","in","the","context","manager",".","If","found",",","updates","the","_setup_upstream_of_teardown","accordingly","."]
code: def _update_setup_upstream(
      cls, operator: AbstractOperator | list[AbstractOperator]
  ):
      """
      Recursively go through the tasks upstream of the teardown task in the context manager.
  
      If found, updates the _setup_upstream_of_teardown accordingly.
      """
      operator = operator[0] if isinstance(operator, list) else operator
  
      def _get_setups(tasks):
          setups = [i for i in tasks if i.is_setup]
          if not setups:
              all_lists = [
                  task.downstream_list + task.upstream_list
                  for task in tasks
              ]
              new_list = [
                  x
                  for sublist in all_lists
                  for x in sublist
                  if (isinstance(operator, list) and x in operator)
                  or x != operator
              ]
              if not new_list:
                  return []
              return _get_setups(new_list)
          return setups
  
      setups = _get_setups(operator.upstream_list)
      setup_task = cls._setup_upstream_of_teardown
      if setup_task and setup_task != setups:
          cls._previous_setup_upstream_of_teardown.append(
              cls._setup_upstream_of_teardown
          )
      cls._setup_upstream_of_teardown = setups
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, cast
  from airflow.exceptions import AirflowException
label_desc: Use image node_id 13 for calling the BaseSetupTeardownContext obj's underlying member method code with example usage: obj._update_setup_upstream(cls, operator) and returns: setups, _get_setups, list