Exemplo n.º 1
0
 def show(self):
     yield "$trydead:"
     yield from indent(self.try_.show())
     for item in self.items:
         yield from item.show()
     if self.any is not None:
         yield "except:"
         yield from indent(self.any.show())
Exemplo n.º 2
0
 def show(self):
     for idx, item in enumerate(self.items):
         yield "{} {}:".format('if' if idx == 0 else 'elif',
                               item.cond.show(None))
         yield from indent(item.body.show())
     if self.else_:
         yield "else:"
         yield from indent(self.else_.show())
Exemplo n.º 3
0
 def show(self):
     yield "try:"
     yield from indent(self.try_.show())
     for item in self.items:
         yield from item.show()
     if self.any is not None:
         yield "except:"
         yield from indent(self.any.show())
     if self.else_ is not None:
         yield "else:"
         yield from indent(self.else_.show())
Exemplo n.º 4
0
 def show(self):
     if self.dst:
         yield "with {} as {}:".format(self.expr.show(None),
                                       self.dst.show(None))
     else:
         yield "with {}:".format(self.expr.show(None))
     yield from indent(self.body.show())
Exemplo n.º 5
0
 def show(self):
     for d in self.deco:
         yield '@{}'.format(d.show(None))
     if self.args.args:
         yield 'class {}({}):'.format(self.name, self.args.show())
     else:
         yield 'class {}:'.format(self.name)
     yield from indent(self.body.show())
Exemplo n.º 6
0
 def show(self):
     if self.dst is None:
         yield 'except {}:'.format(self.expr.show(None))
     else:
         # TODO as
         yield 'except {}, {}:'.format(self.expr.show(None),
                                       self.dst.show(None))
     yield from indent(self.body.show())
Exemplo n.º 7
0
 def show(self):
     for d in self.deco:
         yield '@{}'.format(d.show(None))
     yield 'def {}({}){}:'.format(
         self.name,
         self.args.show(),
         ' -> {}'.format(self.args.ann['return'].show(None))
         if 'return' in self.args.ann else '',
     )
     yield from indent(self.body.show())
Exemplo n.º 8
0
 def show(self):
     yield 'CODE'
     # name
     yield 'name: {} from {}'.format(self.name, self.filename)
     # flags
     yield 'flags: {}'.format(', '.join(flag.name for flag in self.flags))
     # args
     if self.args:
         yield 'args: {}'.format(self.args.show())
     # vars
     if self.varnames:
         yield 'vars: {}'.format(', '.join(self.varnames))
     if self.freevars:
         yield 'freevars: {}'.format(', '.join(self.freevars))
     if self.cellvars:
         yield 'cellvars: {}'.format(', '.join(self.cellvars))
     # consts
     yield 'consts:'
     for idx, const in enumerate(self.consts):
         if isinstance(const, (Code, CodeDict)):
             yield from indent(preindent(idx, const.show()))
         else:
             yield '\t{}: {}'.format(idx, const.show(None))
     # and the actual bytecode
     import binascii
     if self.names:
         yield 'names: {}'.format(', '.join(self.names))
     if self.stacksize is not None:
         yield "stacksize: {}".format(self.stacksize)
     yield "code:"
     inflow = process_flow(self.ops)
     for op in self.ops:
         if inflow[op.pos]:
             yield "\t{}\t{}".format(op.pos, op)
         else:
             yield "\t\t{}".format(op)
     if self.firstlineno is not None:
         yield "line: {} {}".format(self.firstlineno, self.lnotab)
Exemplo n.º 9
0
 def show(self):
     yield "try:"
     yield from indent(self.try_.show())
     yield "finally:"
     yield from indent(self.finally_.show())
Exemplo n.º 10
0
 def show(self):
     yield "for {} in {}:".format(self.dst.show(None), self.expr.show(None))
     yield from indent(self.body.show())
     if self.else_ is not None:
         yield "else:"
         yield from indent(self.else_.show())
Exemplo n.º 11
0
 def show(self):
     yield "$top {} in {}:".format(self.dst.show(None),
                                   self.expr.show(None))
     yield from indent(self.body.show())
Exemplo n.º 12
0
 def show(self):
     yield "while {}:".format(self.expr.show(None))
     yield from indent(self.body.show())
     if self.else_ is not None:
         yield "else:"
         yield from indent(self.else_.show())
Exemplo n.º 13
0
 def show(self):
     yield "$while {}:".format(self.expr.show(None))
     yield from indent(self.body.show())
Exemplo n.º 14
0
 def show(self):
     yield "$loop:"
     yield from indent(self.body.show())
     yield "else:"
     yield from indent(self.else_.show())
Exemplo n.º 15
0
 def show(self):
     yield "$junk:"
     yield from indent(self.body.show())
Exemplo n.º 16
0
 def show(self):
     yield "$if {}:".format(self.cond.show(None))
     yield from indent(self.body.show())