original_docstring: Helper function of depth first search for deserialization.
docstring: Helper function of depth first search for deserialization.
docstring_tokens: Helper function of depth first search for deserialization .
code: def _deserialize(cls, encoded_var: Any) -> Any:  # pylint: disable=too-many-return-statements
          """Helper function of depth first search for deserialization."""
          # JSON primitives (except for dict) are not encoded.
          if cls._is_primitive(encoded_var):
              return encoded_var
          elif isinstance(encoded_var, list):
              return [cls._deserialize(v) for v in encoded_var]
  
          if not isinstance(encoded_var, dict):
              raise ValueError(f"The encoded_var should be dict and is {type(encoded_var)}")
          var = encoded_var[Encoding.VAR]
          type_ = encoded_var[Encoding.TYPE]
  
          if type_ == DAT.DICT:
              return {k: cls._deserialize(v) for k, v in var.items()}
          elif type_ == DAT.DAG:
              return SerializedDAG.deserialize_dag(var)
          elif type_ == DAT.OP:
              return SerializedBaseOperator.deserialize_operator(var)
          elif type_ == DAT.DATETIME:
              return pendulum.from_timestamp(var)
          elif type_ == DAT.POD:
              if not HAS_KUBERNETES:
                  raise RuntimeError("Cannot deserialize POD objects without kubernetes libraries installed!")
              pod = PodGenerator.deserialize_model_dict(var)
              return pod
          elif type_ == DAT.TIMEDELTA:
              return datetime.timedelta(seconds=var)
          elif type_ == DAT.TIMEZONE:
              return Timezone(var)
          elif type_ == DAT.RELATIVEDELTA:
              if 'weekday' in var:
                  var['weekday'] = relativedelta.weekday(*var['weekday'])  # type: ignore
              return relativedelta.relativedelta(**var)
          elif type_ == DAT.SET:
              return {cls._deserialize(v) for v in var}
          elif type_ == DAT.TUPLE:
              return tuple([cls._deserialize(v) for v in var])
          else:
              raise TypeError(f'Invalid type {type_!s} in deserialization.')
code_tokens: def _deserialize ( cls , encoded_var : Any ) -> Any : if cls . _is_primitive ( encoded_var ) : return encoded_var elif isinstance ( encoded_var , list ) : return [ cls . _deserialize ( v ) for v in encoded_var ] if not isinstance ( encoded_var , dict ) : raise ValueError ( f"The encoded_var should be dict and is {type(encoded_var)}" ) var = encoded_var [ Encoding . VAR ] type_ = encoded_var [ Encoding . TYPE ] if type_ == DAT . DICT : return { k : cls . _deserialize ( v ) for k , v in var . items ( ) } elif type_ == DAT . DAG : return SerializedDAG . deserialize_dag ( var ) elif type_ == DAT . OP : return SerializedBaseOperator . deserialize_operator ( var ) elif type_ == DAT . DATETIME : return pendulum . from_timestamp ( var ) elif type_ == DAT . POD : if not HAS_KUBERNETES : raise RuntimeError ( "Cannot deserialize POD objects without kubernetes libraries installed!" ) pod = PodGenerator . deserialize_model_dict ( var ) return pod elif type_ == DAT . TIMEDELTA : return datetime . timedelta ( seconds = var ) elif type_ == DAT . TIMEZONE : return Timezone ( var ) elif type_ == DAT . RELATIVEDELTA : if 'weekday' in var : var [ 'weekday' ] = relativedelta . weekday ( * var [ 'weekday' ] ) return relativedelta . relativedelta ( ** var ) elif type_ == DAT . SET : return { cls . _deserialize ( v ) for v in var } elif type_ == DAT . TUPLE : return tuple ( [ cls . _deserialize ( v ) for v in var ] ) else : raise TypeError ( f'Invalid type {type_!s} in deserialization.' )
short_docstring: Helper function of depth first search for deserialization.
short_docstring_tokens: Helper function of depth first search for deserialization .
comment: # pylint: disable=too-many-return-statements$SEP$"""Helper function of depth first search for deserialization."""$SEP$# JSON primitives (except for dict) are not encoded.$SEP$# type: ignore