class_docstr: TaskGroup context is used to keep the current TaskGroup when TaskGroup is used as ContextManager.
class_docstr_tok: ["TaskGroup","context","is","used","to","keep","the","current","TaskGroup","when","TaskGroup","is","used","as","ContextManager","."]
docstr: Pops the last TaskGroup from the list of managed TaskGroups and update the current TaskGroup.
docstr_tok: ["Pops","the","last","TaskGroup","from","the","list","of","managed","TaskGroups","and","update","the","current","TaskGroup","."]
code: def pop_context_managed_task_group(cls) -> TaskGroup | None:
      """Pops the last TaskGroup from the list of managed TaskGroups and update the current TaskGroup."""
      old_task_group = cls._context_managed_task_group
      if cls._previous_context_managed_task_groups:
          cls._context_managed_task_group = (
              cls._previous_context_managed_task_groups.pop()
          )
      else:
          cls._context_managed_task_group = None
      cls.active = False
      return old_task_group
  
imports: from __future__ import annotations
  import copy
  import functools
  import operator
  import weakref
  from typing import TYPE_CHECKING, Any, Generator, Iterator, Sequence
  import re2
  from airflow.compat.functools import cache
  from airflow.exceptions import AirflowDagCycleException, AirflowException, DuplicateTaskIdFound, TaskAlreadyInTaskGroup
  from airflow.models.taskmixin import DAGNode
  from airflow.serialization.enums import DagAttributeTypes
  from airflow.utils.helpers import validate_group_key
label_desc: Use image node_id 2 for calling the TaskGroupContext obj's underlying member method code with example usage: obj.pop_context_managed_task_group(cls) and returns: old_task_group