original_docstring: 
      Traverse an object looking for hook calls and running those hooks. Here we are
      keeping track of which keys are traversed in a list called `key_path` with strings
      as dict keys and byte encoded integers for list indexes.
      
docstring: Traverse an object looking for hook calls and running those hooks. Here we are
  keeping track of which keys are traversed in a list called `key_path` with strings
  as dict keys and byte encoded integers for list indexes.
docstring_tokens: Traverse an object looking for hook calls and running those hooks . Here we are keeping track of which keys are traversed in a list called ` key_path ` with strings as dict keys and byte encoded integers for list indexes .
code: def walk_sync(context: 'Context', element):
      """
      Traverse an object looking for hook calls and running those hooks. Here we are
      keeping track of which keys are traversed in a list called `key_path` with strings
      as dict keys and byte encoded integers for list indexes.
      """
      if len(context.key_path) != 0:
          # Handle compact expressions - ie key->: hook_type args
          if context.key_path[-1][-2:] in ('->', '_>'):
              context.input_string = element
              run_hook(context)
              if context.key_path[-1][-2:] == '_>':
                  # Private hook calls
                  context.keys_to_remove.append(
                      context.key_path[:-1] + [context.key_path[-1][:-2]]
                  )
              return
  
      if isinstance(element, dict):
          # Handle expanded expressions - ie key:\n  ->: hook_type args
          if '->' in element.keys():
              # Public hook calls
              context.key_path.append('->')
              context.input_string = element['->']
              run_hook(context)
              context.key_path.pop()
              return
          elif '_>' in element.keys():
              # Private hook calls
              context.key_path.append('_>')
              context.input_string = element['_>']
              run_hook(context)
              context.key_path.pop()
              context.keys_to_remove.append(context.key_path.copy())
              return
  
          for k, v in element.copy().items():
              context.key_path.append(k)
              # Special case where we have an empty hook, expanded or compact
              if k[-2:] in ('->', '_>') and (v is None or isinstance(v, dict)):
                  # Here we re-write the input to turn empty hooks into block hooks
                  handle_empty_blocks(context, v)
                  context.key_path[-1] = k[:-2]
                  walk_sync(context, v)
                  context.key_path.pop()
              else:
                  # Recurse
                  walk_sync(context, v)
                  context.key_path.pop()
  
      # Non-hook calls recurse through inputs
      elif isinstance(element, list):
          for i, v in enumerate(element.copy()):
              context.key_path.append(encode_list_index(i))
              walk_sync(context, v)
              context.key_path.pop()
      else:
          nested_set(element=context.output_dict, keys=context.key_path, value=element)
code_tokens: def walk_sync ( context : 'Context' , element ) : if len ( context . key_path ) != 0 : if context . key_path [ - 1 ] [ - 2 : ] in ( '->' , '_>' ) : context . input_string = element run_hook ( context ) if context . key_path [ - 1 ] [ - 2 : ] == '_>' : context . keys_to_remove . append ( context . key_path [ : - 1 ] + [ context . key_path [ - 1 ] [ : - 2 ] ] ) return if isinstance ( element , dict ) : if '->' in element . keys ( ) : context . key_path . append ( '->' ) context . input_string = element [ '->' ] run_hook ( context ) context . key_path . pop ( ) return elif '_>' in element . keys ( ) : context . key_path . append ( '_>' ) context . input_string = element [ '_>' ] run_hook ( context ) context . key_path . pop ( ) context . keys_to_remove . append ( context . key_path . copy ( ) ) return for k , v in element . copy ( ) . items ( ) : context . key_path . append ( k ) if k [ - 2 : ] in ( '->' , '_>' ) and ( v is None or isinstance ( v , dict ) ) : handle_empty_blocks ( context , v ) context . key_path [ - 1 ] = k [ : - 2 ] walk_sync ( context , v ) context . key_path . pop ( ) else : walk_sync ( context , v ) context . key_path . pop ( ) elif isinstance ( element , list ) : for i , v in enumerate ( element . copy ( ) ) : context . key_path . append ( encode_list_index ( i ) ) walk_sync ( context , v ) context . key_path . pop ( ) else : nested_set ( element = context . output_dict , keys = context . key_path , value = element )
short_docstring: Traverse an object looking for hook calls and running those hooks.
short_docstring_tokens: Traverse an object looking for hook calls and running those hooks .
comment: """
      Traverse an object looking for hook calls and running those hooks. Here we are
      keeping track of which keys are traversed in a list called `key_path` with strings
      as dict keys and byte encoded integers for list indexes.
      """$SEP$# Handle compact expressions - ie key->: hook_type args$SEP$# Private hook calls$SEP$# Handle expanded expressions - ie key:\n  ->: hook_type args$SEP$# Public hook calls$SEP$# Private hook calls$SEP$# Special case where we have an empty hook, expanded or compact$SEP$# Here we re-write the input to turn empty hooks into block hooks$SEP$# Recurse$SEP$# Non-hook calls recurse through inputs