Commits

Mike Bayer committed e1086cd

move the function out to compat so we don't import _ast_util if _ast isn't present

  • Participants
  • Parent commits c5d7b54

Comments (0)

Files changed (4)

mako/_ast_util.py

     :license: Python License.
 """
 from _ast import *
-
+from mako.compat import arg_stringname
 
 BOOLOP_SYMBOLS = {
     And:        'and',
 ALL_SYMBOLS.update(CMPOP_SYMBOLS)
 ALL_SYMBOLS.update(UNARYOP_SYMBOLS)
 
-def arg_stringname(func_arg):
-    """Gets the string name of a kwarg or vararg
-    In Python3.4 a function's args are
-    of _ast.arg type not _ast.name
-    """
-    if hasattr(func_arg, 'arg'):
-        return func_arg.arg
-    else:
-        return str(func_arg)
 
 def parse(expr, filename='<unknown>', mode='exec'):
     """Parse an expression into an AST node."""
 code, as well as generating Python from AST nodes"""
 
 from mako import exceptions, pyparser, compat
-from mako._ast_util import arg_stringname
+from mako.compat import arg_stringname
 import re
 
 class PythonCode(object):
     return meta("%sBase" % meta.__name__, (base,), {})
 ################################################
 
+
+def arg_stringname(func_arg):
+    """Gets the string name of a kwarg or vararg
+    In Python3.4 a function's args are
+    of _ast.arg type not _ast.name
+    """
+    if hasattr(func_arg, 'arg'):
+        return func_arg.arg
+    else:
+        return str(func_arg)
 """
 
 from mako import exceptions, util, compat
-from mako._ast_util import arg_stringname
-from mako.compat import StringIO
+from mako.compat import StringIO, arg_stringname
 import operator
 
 if compat.py3k:
     from compiler import visitor
 
 
+
 def parse(code, mode='exec', **exception_kwargs):
     """Parse an expression into AST"""