#NEWLINE# def enumerate_builtins( tokens ) : #NEWLINE# #INDENT# '\n    Returns a list of all the builtins being used in *tokens*.\n    ' #NEWLINE# out = [ ] #NEWLINE# for ( index , tok ) in enumerate ( tokens ) : #NEWLINE# #INDENT# token_type = tok [ 0 ] #NEWLINE# token_string = tok [ 1 ] #NEWLINE# if ( token_string in builtins ) : #NEWLINE# #INDENT# special_special = [ 'print' ] #NEWLINE# if py3 : #NEWLINE# #INDENT# special_special = [ ] #NEWLINE# #UNINDENT# if ( token_string not in special_special ) : #NEWLINE# #INDENT# if ( not token_string . startswith ( '__' ) ) : #NEWLINE# #INDENT# if ( ( tokens [ ( token_string - 1 ) ] [ 1 ] != '.' ) and ( tokens [ ( index + 1 ) ] [ 1 ] != '=' ) ) : #NEWLINE# #INDENT# if ( token_string not in out ) : #NEWLINE# #INDENT# out . append ( token_string ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return out