original_docstring: Parse input dict for loop and when logic and calls hooks.
docstring: Parse input dict for loop and when logic and calls hooks.
docstring_tokens: Parse input dict for loop and when logic and calls hooks .
code: def parse_hook(
      hook_dict, Hook: ModelMetaclass, context: 'Context', append_hook_value: bool = None
  ):
      """Parse input dict for loop and when logic and calls hooks."""
      if evaluate_if(hook_dict, context, append_hook_value):
  
          if 'for' in hook_dict:
              # This runs the current function in a loop with `append_hook_value` set so
              # that keys are appended in the loop.
              evaluate_for(hook_dict, Hook, context)
              return
  
          else:
              # Render the remaining hook variables
              render_hook_vars(hook_dict, Hook, context)
  
              try:
                  hook = Hook(
                      **hook_dict,
                      input_dict=context.input_dict,
                      output_dict=context.output_dict,
                      existing_context=context.existing_context,
                      no_input=context.no_input,
                      calling_directory=context.calling_directory,
                      providers_=context.providers,
                      key_path_=context.key_path,
                  )
              except ValidationError as e:
                  raise e
  
              # Normal hook run
              hook_output_value = hook.call()
  
              if hook.merge:
                  evaluate_merge(hook_output_value, context, append_hook_value)
              else:
                  set_key(
                      element=context.output_dict,
                      keys=context.key_path,
                      value=hook_output_value,
                      append_hook_value=append_hook_value,
                  )
  
      elif 'else' in hook_dict:
          set_key(
              element=context.output_dict,
              keys=context.key_path,
              value=render_variable(context, wrap_jinja_braces(hook_dict['else'])),
              append_hook_value=append_hook_value,
          )
code_tokens: def parse_hook ( hook_dict , Hook : ModelMetaclass , context : 'Context' , append_hook_value : bool = None ) : if evaluate_if ( hook_dict , context , append_hook_value ) : if 'for' in hook_dict : evaluate_for ( hook_dict , Hook , context ) return else : render_hook_vars ( hook_dict , Hook , context ) try : hook = Hook ( ** hook_dict , input_dict = context . input_dict , output_dict = context . output_dict , existing_context = context . existing_context , no_input = context . no_input , calling_directory = context . calling_directory , providers_ = context . providers , key_path_ = context . key_path , ) except ValidationError as e : raise e hook_output_value = hook . call ( ) if hook . merge : evaluate_merge ( hook_output_value , context , append_hook_value ) else : set_key ( element = context . output_dict , keys = context . key_path , value = hook_output_value , append_hook_value = append_hook_value , ) elif 'else' in hook_dict : set_key ( element = context . output_dict , keys = context . key_path , value = render_variable ( context , wrap_jinja_braces ( hook_dict [ 'else' ] ) ) , append_hook_value = append_hook_value , )
short_docstring: Parse input dict for loop and when logic and calls hooks.
short_docstring_tokens: Parse input dict for loop and when logic and calls hooks .
comment: """Parse input dict for loop and when logic and calls hooks."""$SEP$# This runs the current function in a loop with `append_hook_value` set so$SEP$# that keys are appended in the loop.$SEP$# Render the remaining hook variables$SEP$# Normal hook run