original_docstring: Deserializes a DAG from a JSON object.
docstring: Deserializes a DAG from a JSON object.
docstring_tokens: Deserializes a DAG from a JSON object .
code: def deserialize_dag(cls, encoded_dag: Dict[str, Any]) -> 'SerializedDAG':
          """Deserializes a DAG from a JSON object."""
          dag = SerializedDAG(dag_id=encoded_dag['_dag_id'])
  
          for k, v in encoded_dag.items():
              if k == "_downstream_task_ids":
                  v = set(v)
              elif k == "tasks":
                  v = {task["task_id"]: SerializedBaseOperator.deserialize_operator(task) for task in v}
                  k = "task_dict"
              elif k == "timezone":
                  v = cls._deserialize_timezone(v)
              elif k in {"dagrun_timeout"}:
                  v = cls._deserialize_timedelta(v)
              elif k.endswith("_date"):
                  v = cls._deserialize_datetime(v)
              elif k in cls._decorated_fields:
                  v = cls._deserialize(v)
              # else use v as it is
  
              setattr(dag, k, v)
  
          # Set _task_group
          # pylint: disable=protected-access
          if "_task_group" in encoded_dag:
              dag._task_group = SerializedTaskGroup.deserialize_task_group(  # type: ignore
                  encoded_dag["_task_group"], None, dag.task_dict
              )
          else:
              # This must be old data that had no task_group. Create a root TaskGroup and add
              # all tasks to it.
              dag._task_group = TaskGroup.create_root(dag)
              for task in dag.tasks:
                  dag.task_group.add(task)
          # pylint: enable=protected-access
  
          keys_to_set_none = dag.get_serialized_fields() - encoded_dag.keys() - cls._CONSTRUCTOR_PARAMS.keys()
          for k in keys_to_set_none:
              setattr(dag, k, None)
  
          setattr(dag, 'full_filepath', dag.fileloc)
          for task in dag.task_dict.values():
              task.dag = dag
              serializable_task: BaseOperator = task
  
              for date_attr in ["start_date", "end_date"]:
                  if getattr(serializable_task, date_attr) is None:
                      setattr(serializable_task, date_attr, getattr(dag, date_attr))
  
              if serializable_task.subdag is not None:
                  setattr(serializable_task.subdag, 'parent_dag', dag)
                  serializable_task.subdag.is_subdag = True
  
              for task_id in serializable_task.downstream_task_ids:
                  # Bypass set_upstream etc here - it does more than we want
                  # noqa: E501 # pylint: disable=protected-access
                  dag.task_dict[task_id]._upstream_task_ids.add(serializable_task.task_id)
  
          return dag
code_tokens: def deserialize_dag ( cls , encoded_dag : Dict [ str , Any ] ) -> 'SerializedDAG' : dag = SerializedDAG ( dag_id = encoded_dag [ '_dag_id' ] ) for k , v in encoded_dag . items ( ) : if k == "_downstream_task_ids" : v = set ( v ) elif k == "tasks" : v = { task [ "task_id" ] : SerializedBaseOperator . deserialize_operator ( task ) for task in v } k = "task_dict" elif k == "timezone" : v = cls . _deserialize_timezone ( v ) elif k in { "dagrun_timeout" } : v = cls . _deserialize_timedelta ( v ) elif k . endswith ( "_date" ) : v = cls . _deserialize_datetime ( v ) elif k in cls . _decorated_fields : v = cls . _deserialize ( v ) setattr ( dag , k , v ) if "_task_group" in encoded_dag : dag . _task_group = SerializedTaskGroup . deserialize_task_group ( encoded_dag [ "_task_group" ] , None , dag . task_dict ) else : dag . _task_group = TaskGroup . create_root ( dag ) for task in dag . tasks : dag . task_group . add ( task ) keys_to_set_none = dag . get_serialized_fields ( ) - encoded_dag . keys ( ) - cls . _CONSTRUCTOR_PARAMS . keys ( ) for k in keys_to_set_none : setattr ( dag , k , None ) setattr ( dag , 'full_filepath' , dag . fileloc ) for task in dag . task_dict . values ( ) : task . dag = dag serializable_task : BaseOperator = task for date_attr in [ "start_date" , "end_date" ] : if getattr ( serializable_task , date_attr ) is None : setattr ( serializable_task , date_attr , getattr ( dag , date_attr ) ) if serializable_task . subdag is not None : setattr ( serializable_task . subdag , 'parent_dag' , dag ) serializable_task . subdag . is_subdag = True for task_id in serializable_task . downstream_task_ids : dag . task_dict [ task_id ] . _upstream_task_ids . add ( serializable_task . task_id ) return dag
short_docstring: Deserializes a DAG from a JSON object.
short_docstring_tokens: Deserializes a DAG from a JSON object .
comment: """Deserializes a DAG from a JSON object."""$SEP$# else use v as it is$SEP$# Set _task_group$SEP$# pylint: disable=protected-access$SEP$# type: ignore$SEP$# This must be old data that had no task_group. Create a root TaskGroup and add$SEP$# all tasks to it.$SEP$# pylint: enable=protected-access$SEP$# Bypass set_upstream etc here - it does more than we want$SEP$# noqa: E501 # pylint: disable=protected-access