(tokens, local_dict, global_dict)
return result
Convert a NAME token + ParenthesisGroup into an AppliedFunction.

    Note that ParenthesisGroups, if not applied to any function, are
    converted back into lists of tokens.
Convert a NAME token + ParenthesisGroup into an AppliedFunction.
Convert a NAME token + ParenthesisGroup into an AppliedFunction .
def _apply_functions(tokens, local_dict, global_dict):
    """Convert a NAME token + ParenthesisGroup into an AppliedFunction.

    Note that ParenthesisGroups, if not applied to any function, are
    converted back into lists of tokens.

    """
    result = []
    symbol = None
    for tok in tokens:
        if tok[0] == NAME:
            symbol = tok
            result.append(tok)
        elif isinstance(tok, ParenthesisGroup):
            if symbol and _token_callable(symbol, local_dict, global_dict):
                result[-1] = AppliedFunction(symbol, tok)
                symbol = None
            else:
                result.extend(tok)
        else:
            symbol = None
            result.append(tok)
    return result
def _apply_functions ( tokens , local_dict , global_dict ) : result = [ ] symbol = None for tok in tokens : if tok [ 0 ] == NAME : symbol = tok result . append ( tok ) elif isinstance ( tok , ParenthesisGroup ) : if symbol and _token_callable ( symbol , local_dict , global_dict ) : result [ - 1 ] = AppliedFunction ( symbol , tok ) symbol = None else : result . extend ( tok ) else : symbol = None result . append ( tok ) return result