original_docstring: Merge the contents into it's top level set of keys.
docstring: Merge the contents into it's top level set of keys.
docstring_tokens: Merge the contents into it ' s top level set of keys .
code: def evaluate_merge(
      hook_output_value, context: 'Context', append_hook_value: bool = False
  ):
      """Merge the contents into it's top level set of keys."""
      if append_hook_value:
          raise HookCallException("Can't merge from for loop.")
  
      if context.key_path[-1] in ('->', '_>'):
          # Expanded key - Remove parent key from key path
          key_path = context.key_path[:-2] + [context.key_path[-1]]
      else:
          # Compact key
          key_path = context.key_path[:-1] + [context.key_path[-1][:-2]]
  
      # Can't merge into top level keys without merging k/v individually
      if len(key_path) == 1:
          # This is only valid for dict output
          if isinstance(hook_output_value, dict):
              for k, v in hook_output_value.items():
                  set_key(
                      element=context.output_dict,
                      keys=[k] + key_path,
                      value=v,
                  )
              return
          else:
              raise HookCallException("Can't merge non maps into top level keys.")
      else:
          set_key(
              element=context.output_dict,
              keys=key_path,
              value=hook_output_value,
          )
code_tokens: def evaluate_merge ( hook_output_value , context : 'Context' , append_hook_value : bool = False ) : if append_hook_value : raise HookCallException ( "Can't merge from for loop." ) if context . key_path [ - 1 ] in ( '->' , '_>' ) : key_path = context . key_path [ : - 2 ] + [ context . key_path [ - 1 ] ] else : key_path = context . key_path [ : - 1 ] + [ context . key_path [ - 1 ] [ : - 2 ] ] if len ( key_path ) == 1 : if isinstance ( hook_output_value , dict ) : for k , v in hook_output_value . items ( ) : set_key ( element = context . output_dict , keys = [ k ] + key_path , value = v , ) return else : raise HookCallException ( "Can't merge non maps into top level keys." ) else : set_key ( element = context . output_dict , keys = key_path , value = hook_output_value , )
short_docstring: Merge the contents into it's top level set of keys.
short_docstring_tokens: Merge the contents into it ' s top level set of keys .
comment: """Merge the contents into it's top level set of keys."""$SEP$# Expanded key - Remove parent key from key path$SEP$# Compact key$SEP$# Can't merge into top level keys without merging k/v individually$SEP$# This is only valid for dict output