*** astng/nodes.py 2007-02-22 03:40:30.000000000 -0800 --- astng-patched/nodes.py 2008-01-10 14:46:36.000000000 -0800 *************** *** 73,78 **** --- 73,85 ---- class Decorators: """dummy Decorators node, shouldn't be used since py < 2.4""" + try: + # introduced in python 2.5 + from compiler.ast import With + except: + class With: + """dummy With node, shouldn't be used since py < 2.5""" + from logilab.astng._exceptions import NotFoundError, InferenceError from logilab.astng.utils import extend_class *************** *** 771,776 **** --- 778,791 ---- return whiles While.as_string = while_as_string + def with_as_string(node): + """return an ast.With node as string""" + withs = 'with (%s) as (%s):\n %s' % (node.expr.as_string(), + node.vars.as_string(), + node.body.as_string()) + return withs + With.as_string = with_as_string + def yield_as_string(node): """yield an ast.Yield node as string""" return 'yield %s' % node.value.as_string()