parameters: (input_file)
return_statement: return signatures
docstring: Returns a list of parsed UDTF signatures.
docstring_summary: Returns a list of parsed UDTF signatures.
docstring_tokens: Returns a list of parsed UDTF signatures .
function: def find_signatures(input_file):
      """Returns a list of parsed UDTF signatures."""
      signatures = []
  
      last_line = None
      for line in open(input_file).readlines():
          line = line.strip()
          if last_line is not None:
              line = last_line + line
              last_line = None
          if not line.startswith('UDTF:'):
              continue
          if line_is_incomplete(line):
              last_line = line
              continue
          last_line = None
          line = line[5:].lstrip()
          i = line.find('(')
          j = line.find(')')
          if i == -1 or j == -1:
              sys.stderr.write('Invalid UDTF specification: `%s`. Skipping.\n' % (line))
              continue
  
          expected_result = None
          if separator in line:
              line, expected_result = line.split(separator, 1)
              expected_result = expected_result.strip().split(separator)
              expected_result = list(map(lambda s: s.strip(), expected_result))
  
          ast = Parser(line).parse()
  
          if expected_result is not None:
              # Template transformer expands templates into multiple lines
              skip_signature = False
              try:
                  result = Pipeline(TemplateTransformer,
                                    FieldAnnotationTransformer,
                                    TextEncodingDictTransformer,
                                    SupportedAnnotationsTransformer,
                                    FixRowMultiplierPosArgTransformer,
                                    RenameNodesTransformer,
                                    AstPrinter)(ast)
              except TransformerException as msg:
                  result = ['%s: %s' % (type(msg).__name__, msg)]
                  skip_signature = True
              assert set(result) == set(expected_result), "\n\tresult:   %s != \n\texpected: %s" % (
                  result,
                  expected_result,
              )
              if skip_signature:
                  continue
  
          signature = Pipeline(TemplateTransformer,
                               FieldAnnotationTransformer,
                               TextEncodingDictTransformer,
                               SupportedAnnotationsTransformer,
                               FixRowMultiplierPosArgTransformer,
                               RenameNodesTransformer,
                               DeclBracketTransformer)(ast)
  
          signatures.extend(signature)
  
      return signatures
function_tokens: def find_signatures ( input_file ) : signatures = [ ] last_line = None for line in open ( input_file ) . readlines ( ) : line = line . strip ( ) if last_line is not None : line = last_line + line last_line = None if not line . startswith ( 'UDTF:' ) : continue if line_is_incomplete ( line ) : last_line = line continue last_line = None line = line [ 5 : ] . lstrip ( ) i = line . find ( '(' ) j = line . find ( ')' ) if i == - 1 or j == - 1 : sys . stderr . write ( 'Invalid UDTF specification: `%s`. Skipping.\n' % ( line ) ) continue expected_result = None if separator in line : line , expected_result = line . split ( separator , 1 ) expected_result = expected_result . strip ( ) . split ( separator ) expected_result = list ( map ( lambda s : s . strip ( ) , expected_result ) ) ast = Parser ( line ) . parse ( ) if expected_result is not None : # Template transformer expands templates into multiple lines skip_signature = False try : result = Pipeline ( TemplateTransformer , FieldAnnotationTransformer , TextEncodingDictTransformer , SupportedAnnotationsTransformer , FixRowMultiplierPosArgTransformer , RenameNodesTransformer , AstPrinter ) ( ast ) except TransformerException as msg : result = [ '%s: %s' % ( type ( msg ) . __name__ , msg ) ] skip_signature = True assert set ( result ) == set ( expected_result ) , "\n\tresult:   %s != \n\texpected: %s" % ( result , expected_result , ) if skip_signature : continue signature = Pipeline ( TemplateTransformer , FieldAnnotationTransformer , TextEncodingDictTransformer , SupportedAnnotationsTransformer , FixRowMultiplierPosArgTransformer , RenameNodesTransformer , DeclBracketTransformer ) ( ast ) signatures . extend ( signature ) return signatures