Author: Raffael Tfirst <raffael.tfi...@gmail.com> Branch: py3.5 Changeset: r85059:af060ac191a1 Date: 2016-06-09 19:22 +0200 http://bitbucket.org/pypy/pypy/changeset/af060ac191a1/
Log: Fix formatting error because of new asdl.py diff --git a/pypy/interpreter/astcompiler/ast.py b/pypy/interpreter/astcompiler/ast.py --- a/pypy/interpreter/astcompiler/ast.py +++ b/pypy/interpreter/astcompiler/ast.py @@ -172,7 +172,7 @@ return Suite.from_object(space, w_node) raise oefmt(space.w_TypeError, "Expected mod node, got %T", w_node) -State.ast_type(''mod'', 'AST', None, []) +State.ast_type('mod', 'AST', None, []) class Module(mod): @@ -204,7 +204,7 @@ _body = [stmt.from_object(space, w_item) for w_item in body_w] return Module(_body) -State.ast_type(''Module'', 'mod', ["'body'"]) +State.ast_type('Module', 'mod', ["'body'"]) class Interactive(mod): @@ -237,7 +237,7 @@ _body = [stmt.from_object(space, w_item) for w_item in body_w] return Interactive(_body) -State.ast_type(''Interactive'', 'mod', ["'body'"]) +State.ast_type('Interactive', 'mod', ["'body'"]) class Expression(mod): @@ -266,7 +266,7 @@ raise_required_value(space, w_node, 'body') return Expression(_body) -State.ast_type(''Expression'', 'mod', ["'body'"]) +State.ast_type('Expression', 'mod', ["'body'"]) class Suite(mod): @@ -299,7 +299,7 @@ _body = [stmt.from_object(space, w_item) for w_item in body_w] return Suite(_body) -State.ast_type(''Suite'', 'mod', ["'body'"]) +State.ast_type('Suite', 'mod', ["'body'"]) class stmt(AST): @@ -356,7 +356,7 @@ return Continue.from_object(space, w_node) raise oefmt(space.w_TypeError, "Expected stmt node, got %T", w_node) -State.ast_type(''stmt'', 'AST', None, ["'lineno'", "'col_offset'"]) +State.ast_type('stmt', 'AST', None, ["'lineno'", "'col_offset'"]) class FunctionDef(stmt): @@ -431,7 +431,7 @@ _col_offset = space.int_w(w_col_offset) return FunctionDef(_name, _args, _body, _decorator_list, _returns, _lineno, _col_offset) -State.ast_type(''FunctionDef'', 'stmt', ["'name'", "'args'", "'body'", "'decorator_list'", "'returns'"]) +State.ast_type('FunctionDef', 'stmt', ["'name'", "'args'", "'body'", "'decorator_list'", "'returns'"]) class ClassDef(stmt): @@ -516,7 +516,7 @@ _col_offset = space.int_w(w_col_offset) return ClassDef(_name, _bases, _keywords, _body, _decorator_list, _lineno, _col_offset) -State.ast_type(''ClassDef'', 'stmt', ["'name'", "'bases'", "'keywords'", "'body'", "'decorator_list'"]) +State.ast_type('ClassDef', 'stmt', ["'name'", "'bases'", "'keywords'", "'body'", "'decorator_list'"]) class Return(stmt): @@ -553,7 +553,7 @@ _col_offset = space.int_w(w_col_offset) return Return(_value, _lineno, _col_offset) -State.ast_type(''Return'', 'stmt', ["'value'"]) +State.ast_type('Return', 'stmt', ["'value'"]) class Delete(stmt): @@ -595,7 +595,7 @@ _col_offset = space.int_w(w_col_offset) return Delete(_targets, _lineno, _col_offset) -State.ast_type(''Delete'', 'stmt', ["'targets'"]) +State.ast_type('Delete', 'stmt', ["'targets'"]) class Assign(stmt): @@ -645,7 +645,7 @@ _col_offset = space.int_w(w_col_offset) return Assign(_targets, _value, _lineno, _col_offset) -State.ast_type(''Assign'', 'stmt', ["'targets'", "'value'"]) +State.ast_type('Assign', 'stmt', ["'targets'", "'value'"]) class AugAssign(stmt): @@ -698,7 +698,7 @@ _col_offset = space.int_w(w_col_offset) return AugAssign(_target, _op, _value, _lineno, _col_offset) -State.ast_type(''AugAssign'', 'stmt', ["'target'", "'op'", "'value'"]) +State.ast_type('AugAssign', 'stmt', ["'target'", "'op'", "'value'"]) class For(stmt): @@ -768,7 +768,7 @@ _col_offset = space.int_w(w_col_offset) return For(_target, _iter, _body, _orelse, _lineno, _col_offset) -State.ast_type(''For'', 'stmt', ["'target'", "'iter'", "'body'", "'orelse'"]) +State.ast_type('For', 'stmt', ["'target'", "'iter'", "'body'", "'orelse'"]) class While(stmt): @@ -830,7 +830,7 @@ _col_offset = space.int_w(w_col_offset) return While(_test, _body, _orelse, _lineno, _col_offset) -State.ast_type(''While'', 'stmt', ["'test'", "'body'", "'orelse'"]) +State.ast_type('While', 'stmt', ["'test'", "'body'", "'orelse'"]) class If(stmt): @@ -892,7 +892,7 @@ _col_offset = space.int_w(w_col_offset) return If(_test, _body, _orelse, _lineno, _col_offset) -State.ast_type(''If'', 'stmt', ["'test'", "'body'", "'orelse'"]) +State.ast_type('If', 'stmt', ["'test'", "'body'", "'orelse'"]) class With(stmt): @@ -946,7 +946,7 @@ _col_offset = space.int_w(w_col_offset) return With(_items, _body, _lineno, _col_offset) -State.ast_type(''With'', 'stmt', ["'items'", "'body'"]) +State.ast_type('With', 'stmt', ["'items'", "'body'"]) class Raise(stmt): @@ -990,7 +990,7 @@ _col_offset = space.int_w(w_col_offset) return Raise(_exc, _cause, _lineno, _col_offset) -State.ast_type(''Raise'', 'stmt', ["'exc'", "'cause'"]) +State.ast_type('Raise', 'stmt', ["'exc'", "'cause'"]) class Try(stmt): @@ -1068,7 +1068,7 @@ _col_offset = space.int_w(w_col_offset) return Try(_body, _handlers, _orelse, _finalbody, _lineno, _col_offset) -State.ast_type(''Try'', 'stmt', ["'body'", "'handlers'", "'orelse'", "'finalbody'"]) +State.ast_type('Try', 'stmt', ["'body'", "'handlers'", "'orelse'", "'finalbody'"]) class Assert(stmt): @@ -1113,7 +1113,7 @@ _col_offset = space.int_w(w_col_offset) return Assert(_test, _msg, _lineno, _col_offset) -State.ast_type(''Assert'', 'stmt', ["'test'", "'msg'"]) +State.ast_type('Assert', 'stmt', ["'test'", "'msg'"]) class Import(stmt): @@ -1155,7 +1155,7 @@ _col_offset = space.int_w(w_col_offset) return Import(_names, _lineno, _col_offset) -State.ast_type(''Import'', 'stmt', ["'names'"]) +State.ast_type('Import', 'stmt', ["'names'"]) class ImportFrom(stmt): @@ -1207,7 +1207,7 @@ _col_offset = space.int_w(w_col_offset) return ImportFrom(_module, _names, _level, _lineno, _col_offset) -State.ast_type(''ImportFrom'', 'stmt', ["'module'", "'names'", "'level'"]) +State.ast_type('ImportFrom', 'stmt', ["'module'", "'names'", "'level'"]) class Global(stmt): @@ -1247,7 +1247,7 @@ _col_offset = space.int_w(w_col_offset) return Global(_names, _lineno, _col_offset) -State.ast_type(''Global'', 'stmt', ["'names'"]) +State.ast_type('Global', 'stmt', ["'names'"]) class Nonlocal(stmt): @@ -1287,7 +1287,7 @@ _col_offset = space.int_w(w_col_offset) return Nonlocal(_names, _lineno, _col_offset) -State.ast_type(''Nonlocal'', 'stmt', ["'names'"]) +State.ast_type('Nonlocal', 'stmt', ["'names'"]) class Expr(stmt): @@ -1325,7 +1325,7 @@ _col_offset = space.int_w(w_col_offset) return Expr(_value, _lineno, _col_offset) -State.ast_type(''Expr'', 'stmt', ["'value'"]) +State.ast_type('Expr', 'stmt', ["'value'"]) class Pass(stmt): @@ -1355,7 +1355,7 @@ _col_offset = space.int_w(w_col_offset) return Pass(_lineno, _col_offset) -State.ast_type(''Pass'', 'stmt', []) +State.ast_type('Pass', 'stmt', []) class Break(stmt): @@ -1385,7 +1385,7 @@ _col_offset = space.int_w(w_col_offset) return Break(_lineno, _col_offset) -State.ast_type(''Break'', 'stmt', []) +State.ast_type('Break', 'stmt', []) class Continue(stmt): @@ -1415,7 +1415,7 @@ _col_offset = space.int_w(w_col_offset) return Continue(_lineno, _col_offset) -State.ast_type(''Continue'', 'stmt', []) +State.ast_type('Continue', 'stmt', []) class expr(AST): @@ -1484,7 +1484,7 @@ return Const.from_object(space, w_node) raise oefmt(space.w_TypeError, "Expected expr node, got %T", w_node) -State.ast_type(''expr'', 'AST', None, ["'lineno'", "'col_offset'"]) +State.ast_type('expr', 'AST', None, ["'lineno'", "'col_offset'"]) class BoolOp(expr): @@ -1532,7 +1532,7 @@ _col_offset = space.int_w(w_col_offset) return BoolOp(_op, _values, _lineno, _col_offset) -State.ast_type(''BoolOp'', 'expr', ["'op'", "'values'"]) +State.ast_type('BoolOp', 'expr', ["'op'", "'values'"]) class BinOp(expr): @@ -1585,7 +1585,7 @@ _col_offset = space.int_w(w_col_offset) return BinOp(_left, _op, _right, _lineno, _col_offset) -State.ast_type(''BinOp'', 'expr', ["'left'", "'op'", "'right'"]) +State.ast_type('BinOp', 'expr', ["'left'", "'op'", "'right'"]) class UnaryOp(expr): @@ -1630,7 +1630,7 @@ _col_offset = space.int_w(w_col_offset) return UnaryOp(_op, _operand, _lineno, _col_offset) -State.ast_type(''UnaryOp'', 'expr', ["'op'", "'operand'"]) +State.ast_type('UnaryOp', 'expr', ["'op'", "'operand'"]) class Lambda(expr): @@ -1676,7 +1676,7 @@ _col_offset = space.int_w(w_col_offset) return Lambda(_args, _body, _lineno, _col_offset) -State.ast_type(''Lambda'', 'expr', ["'args'", "'body'"]) +State.ast_type('Lambda', 'expr', ["'args'", "'body'"]) class IfExp(expr): @@ -1730,7 +1730,7 @@ _col_offset = space.int_w(w_col_offset) return IfExp(_test, _body, _orelse, _lineno, _col_offset) -State.ast_type(''IfExp'', 'expr', ["'test'", "'body'", "'orelse'"]) +State.ast_type('IfExp', 'expr', ["'test'", "'body'", "'orelse'"]) class Dict(expr): @@ -1784,7 +1784,7 @@ _col_offset = space.int_w(w_col_offset) return Dict(_keys, _values, _lineno, _col_offset) -State.ast_type(''Dict'', 'expr', ["'keys'", "'values'"]) +State.ast_type('Dict', 'expr', ["'keys'", "'values'"]) class Set(expr): @@ -1826,7 +1826,7 @@ _col_offset = space.int_w(w_col_offset) return Set(_elts, _lineno, _col_offset) -State.ast_type(''Set'', 'expr', ["'elts'"]) +State.ast_type('Set', 'expr', ["'elts'"]) class ListComp(expr): @@ -1876,7 +1876,7 @@ _col_offset = space.int_w(w_col_offset) return ListComp(_elt, _generators, _lineno, _col_offset) -State.ast_type(''ListComp'', 'expr', ["'elt'", "'generators'"]) +State.ast_type('ListComp', 'expr', ["'elt'", "'generators'"]) class SetComp(expr): @@ -1926,7 +1926,7 @@ _col_offset = space.int_w(w_col_offset) return SetComp(_elt, _generators, _lineno, _col_offset) -State.ast_type(''SetComp'', 'expr', ["'elt'", "'generators'"]) +State.ast_type('SetComp', 'expr', ["'elt'", "'generators'"]) class DictComp(expr): @@ -1984,7 +1984,7 @@ _col_offset = space.int_w(w_col_offset) return DictComp(_key, _value, _generators, _lineno, _col_offset) -State.ast_type(''DictComp'', 'expr', ["'key'", "'value'", "'generators'"]) +State.ast_type('DictComp', 'expr', ["'key'", "'value'", "'generators'"]) class GeneratorExp(expr): @@ -2034,7 +2034,7 @@ _col_offset = space.int_w(w_col_offset) return GeneratorExp(_elt, _generators, _lineno, _col_offset) -State.ast_type(''GeneratorExp'', 'expr', ["'elt'", "'generators'"]) +State.ast_type('GeneratorExp', 'expr', ["'elt'", "'generators'"]) class Yield(expr): @@ -2071,7 +2071,7 @@ _col_offset = space.int_w(w_col_offset) return Yield(_value, _lineno, _col_offset) -State.ast_type(''Yield'', 'expr', ["'value'"]) +State.ast_type('Yield', 'expr', ["'value'"]) class YieldFrom(expr): @@ -2109,7 +2109,7 @@ _col_offset = space.int_w(w_col_offset) return YieldFrom(_value, _lineno, _col_offset) -State.ast_type(''YieldFrom'', 'expr', ["'value'"]) +State.ast_type('YieldFrom', 'expr', ["'value'"]) class Compare(expr): @@ -2169,7 +2169,7 @@ _col_offset = space.int_w(w_col_offset) return Compare(_left, _ops, _comparators, _lineno, _col_offset) -State.ast_type(''Compare'', 'expr', ["'left'", "'ops'", "'comparators'"]) +State.ast_type('Compare', 'expr', ["'left'", "'ops'", "'comparators'"]) class Call(expr): @@ -2231,7 +2231,7 @@ _col_offset = space.int_w(w_col_offset) return Call(_func, _args, _keywords, _lineno, _col_offset) -State.ast_type(''Call'', 'expr', ["'func'", "'args'", "'keywords'"]) +State.ast_type('Call', 'expr', ["'func'", "'args'", "'keywords'"]) class Num(expr): @@ -2268,7 +2268,7 @@ _col_offset = space.int_w(w_col_offset) return Num(_n, _lineno, _col_offset) -State.ast_type(''Num'', 'expr', ["'n'"]) +State.ast_type('Num', 'expr', ["'n'"]) class Str(expr): @@ -2305,7 +2305,7 @@ _col_offset = space.int_w(w_col_offset) return Str(_s, _lineno, _col_offset) -State.ast_type(''Str'', 'expr', ["'s'"]) +State.ast_type('Str', 'expr', ["'s'"]) class Bytes(expr): @@ -2342,7 +2342,7 @@ _col_offset = space.int_w(w_col_offset) return Bytes(_s, _lineno, _col_offset) -State.ast_type(''Bytes'', 'expr', ["'s'"]) +State.ast_type('Bytes', 'expr', ["'s'"]) class NameConstant(expr): @@ -2379,7 +2379,7 @@ _col_offset = space.int_w(w_col_offset) return NameConstant(_value, _lineno, _col_offset) -State.ast_type(''NameConstant'', 'expr', ["'value'"]) +State.ast_type('NameConstant', 'expr', ["'value'"]) class Ellipsis(expr): @@ -2409,7 +2409,7 @@ _col_offset = space.int_w(w_col_offset) return Ellipsis(_lineno, _col_offset) -State.ast_type(''Ellipsis'', 'expr', []) +State.ast_type('Ellipsis', 'expr', []) class Attribute(expr): @@ -2461,7 +2461,7 @@ _col_offset = space.int_w(w_col_offset) return Attribute(_value, _attr, _ctx, _lineno, _col_offset) -State.ast_type(''Attribute'', 'expr', ["'value'", "'attr'", "'ctx'"]) +State.ast_type('Attribute', 'expr', ["'value'", "'attr'", "'ctx'"]) class Subscript(expr): @@ -2514,7 +2514,7 @@ _col_offset = space.int_w(w_col_offset) return Subscript(_value, _slice, _ctx, _lineno, _col_offset) -State.ast_type(''Subscript'', 'expr', ["'value'", "'slice'", "'ctx'"]) +State.ast_type('Subscript', 'expr', ["'value'", "'slice'", "'ctx'"]) class Starred(expr): @@ -2559,7 +2559,7 @@ _col_offset = space.int_w(w_col_offset) return Starred(_value, _ctx, _lineno, _col_offset) -State.ast_type(''Starred'', 'expr', ["'value'", "'ctx'"]) +State.ast_type('Starred', 'expr', ["'value'", "'ctx'"]) class Name(expr): @@ -2603,7 +2603,7 @@ _col_offset = space.int_w(w_col_offset) return Name(_id, _ctx, _lineno, _col_offset) -State.ast_type(''Name'', 'expr', ["'id'", "'ctx'"]) +State.ast_type('Name', 'expr', ["'id'", "'ctx'"]) class List(expr): @@ -2652,7 +2652,7 @@ _col_offset = space.int_w(w_col_offset) return List(_elts, _ctx, _lineno, _col_offset) -State.ast_type(''List'', 'expr', ["'elts'", "'ctx'"]) +State.ast_type('List', 'expr', ["'elts'", "'ctx'"]) class Tuple(expr): @@ -2701,7 +2701,7 @@ _col_offset = space.int_w(w_col_offset) return Tuple(_elts, _ctx, _lineno, _col_offset) -State.ast_type(''Tuple'', 'expr', ["'elts'", "'ctx'"]) +State.ast_type('Tuple', 'expr', ["'elts'", "'ctx'"]) class Const(expr): @@ -2738,7 +2738,7 @@ _col_offset = space.int_w(w_col_offset) return Const(_value, _lineno, _col_offset) -State.ast_type(''Const'', 'expr', ["'value'"]) +State.ast_type('Const', 'expr', ["'value'"]) class expr_context(AST): @@ -2819,7 +2819,7 @@ return Index.from_object(space, w_node) raise oefmt(space.w_TypeError, "Expected slice node, got %T", w_node) -State.ast_type(''slice'', 'AST', None, []) +State.ast_type('slice', 'AST', None, []) class Slice(slice): @@ -2860,7 +2860,7 @@ _step = expr.from_object(space, w_step) if w_step is not None else None return Slice(_lower, _upper, _step) -State.ast_type(''Slice'', 'slice', ["'lower'", "'upper'", "'step'"]) +State.ast_type('Slice', 'slice', ["'lower'", "'upper'", "'step'"]) class ExtSlice(slice): @@ -2893,7 +2893,7 @@ _dims = [slice.from_object(space, w_item) for w_item in dims_w] return ExtSlice(_dims) -State.ast_type(''ExtSlice'', 'slice', ["'dims'"]) +State.ast_type('ExtSlice', 'slice', ["'dims'"]) class Index(slice): @@ -2922,7 +2922,7 @@ raise_required_value(space, w_node, 'value') return Index(_value) -State.ast_type(''Index'', 'slice', ["'value'"]) +State.ast_type('Index', 'slice', ["'value'"]) class boolop(AST): @@ -3276,7 +3276,7 @@ _ifs = [expr.from_object(space, w_item) for w_item in ifs_w] return comprehension(_target, _iter, _ifs) -State.ast_type(''comprehension'', 'AST', ["'target'", "'iter'", "'ifs'"]) +State.ast_type('comprehension', 'AST', ["'target'", "'iter'", "'ifs'"]) class excepthandler(AST): @@ -3292,7 +3292,7 @@ return ExceptHandler.from_object(space, w_node) raise oefmt(space.w_TypeError, "Expected excepthandler node, got %T", w_node) -State.ast_type(''excepthandler'', 'AST', None, ["'lineno'", "'col_offset'"]) +State.ast_type('excepthandler', 'AST', None, ["'lineno'", "'col_offset'"]) class ExceptHandler(excepthandler): @@ -3345,7 +3345,7 @@ _col_offset = space.int_w(w_col_offset) return ExceptHandler(_type, _name, _body, _lineno, _col_offset) -State.ast_type(''ExceptHandler'', 'excepthandler', ["'type'", "'name'", "'body'"]) +State.ast_type('ExceptHandler', 'excepthandler', ["'type'", "'name'", "'body'"]) class arguments(AST): @@ -3428,7 +3428,7 @@ _defaults = [expr.from_object(space, w_item) for w_item in defaults_w] return arguments(_args, _vararg, _kwonlyargs, _kw_defaults, _kwarg, _defaults) -State.ast_type(''arguments'', 'AST', ["'args'", "'vararg'", "'kwonlyargs'", "'kw_defaults'", "'kwarg'", "'defaults'"]) +State.ast_type('arguments', 'AST', ["'args'", "'vararg'", "'kwonlyargs'", "'kw_defaults'", "'kwarg'", "'defaults'"]) class arg(AST): @@ -3462,7 +3462,7 @@ _annotation = expr.from_object(space, w_annotation) if w_annotation is not None else None return arg(_arg, _annotation) -State.ast_type(''arg'', 'AST', ["'arg'", "'annotation'"]) +State.ast_type('arg', 'AST', ["'arg'", "'annotation'"]) class keyword(AST): @@ -3495,7 +3495,7 @@ raise_required_value(space, w_node, 'value') return keyword(_arg, _value) -State.ast_type(''keyword'', 'AST', ["'arg'", "'value'"]) +State.ast_type('keyword', 'AST', ["'arg'", "'value'"]) class alias(AST): @@ -3527,7 +3527,7 @@ _asname = space.str_or_None_w(w_asname) return alias(_name, _asname) -State.ast_type(''alias'', 'AST', ["'name'", "'asname'"]) +State.ast_type('alias', 'AST', ["'name'", "'asname'"]) class withitem(AST): @@ -3562,7 +3562,7 @@ _optional_vars = expr.from_object(space, w_optional_vars) if w_optional_vars is not None else None return withitem(_context_expr, _optional_vars) -State.ast_type(''withitem'', 'AST', ["'context_expr'", "'optional_vars'"]) +State.ast_type('withitem', 'AST', ["'context_expr'", "'optional_vars'"]) class ASTVisitor(object): diff --git a/pypy/interpreter/astcompiler/tools/asdl_py.py b/pypy/interpreter/astcompiler/tools/asdl_py.py --- a/pypy/interpreter/astcompiler/tools/asdl_py.py +++ b/pypy/interpreter/astcompiler/tools/asdl_py.py @@ -101,7 +101,7 @@ % (typ.name,), 3) self.emit("raise oefmt(space.w_TypeError,", 2) self.emit(" \"Expected %s node, got %%T\", w_node)" % (base,), 2) - self.emit("State.ast_type('%r', 'AST', None, %s)" % + self.emit("State.ast_type(%r, 'AST', None, %s)" % (base, [repr(attr.name) for attr in sum.attributes])) self.emit("") for cons in sum.types: @@ -118,7 +118,7 @@ self.emit("visitor.visit_%s(self)" % (name,), 2) self.emit("") self.make_converters(product.fields, name) - self.emit("State.ast_type('%r', 'AST', %s)" % + self.emit("State.ast_type(%r, 'AST', %s)" % (name, [repr(f.name) for f in product.fields])) self.emit("") @@ -262,7 +262,7 @@ self.emit("") self.make_mutate_over(cons, cons.name) self.make_converters(cons.fields, cons.name, extra_attributes) - self.emit("State.ast_type('%r', '%s', %s)" % + self.emit("State.ast_type(%r, '%s', %s)" % (cons.name, base, [repr(f.name) for f in cons.fields])) self.emit("") _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit