Commits

Manuel Jacob committed 534c06c

Do some (hopefully) uncontroversiol style changes.

  • Participants
  • Parent commits 6c97b59

Comments (0)

Files changed (6)

rpython/flowspace/bytecode.py

     opnames = host_bytecode_spec.method_names
 
     def __init__(self, argcount, nlocals, stacksize, flags,
-                     code, consts, names, varnames, filename,
-                     name, firstlineno, lnotab, freevars):
+                 code, consts, names, varnames, filename,
+                 name, firstlineno, lnotab, freevars):
         """Initialize a new code object"""
         assert nlocals >= 0
         self.co_argcount = argcount
         """Initialize the code object from a real (CPython) one.
         """
         return cls(code.co_argcount,
-                      code.co_nlocals,
-                      code.co_stacksize,
-                      code.co_flags,
-                      code.co_code,
-                      list(code.co_consts),
-                      list(code.co_names),
-                      list(code.co_varnames),
-                      code.co_filename,
-                      code.co_name,
-                      code.co_firstlineno,
-                      code.co_lnotab,
-                      list(code.co_freevars))
+                   code.co_nlocals,
+                   code.co_stacksize,
+                   code.co_flags,
+                   code.co_code,
+                   list(code.co_consts),
+                   list(code.co_names),
+                   list(code.co_varnames),
+                   code.co_filename,
+                   code.co_name,
+                   code.co_firstlineno,
+                   code.co_lnotab,
+                   list(code.co_freevars))
 
     @property
     def formalargcount(self):

rpython/flowspace/flowcontext.py

         if not exceptions:
             return
         if not force and not any(isinstance(block, (ExceptBlock, FinallyBlock))
-                for block in self.blockstack):
+                                 for block in self.blockstack):
             # The implicit exception wouldn't be caught and would later get
             # removed, so don't bother creating it.
             return
     def newfunction(self, w_code, defaults_w):
         if not all(isinstance(value, Constant) for value in defaults_w):
             raise FlowingError("Dynamically created function must"
-                    " have constant default values.")
+                               " have constant default values.")
         code = w_code.value
         globals = self.w_globals.value
         defaults = tuple([default.value for default in defaults_w])
             w_exc = self.exc_from_raise(const(ValueError), const(None))
             raise Raise(w_exc)
         return [op.getitem(w_iterable, const(i)).eval(self)
-                    for i in range(expected_length)]
+                for i in range(expected_length)]
 
     def UNPACK_SEQUENCE(self, itemcount):
         w_iterable = self.popvalue()

rpython/flowspace/model.py

 
 class FunctionGraph(object):
     def __init__(self, name, startblock, return_var=None):
-        self.name        = name    # function name (possibly mangled already)
-        self.startblock  = startblock
+        self.name = name  # function name (possibly mangled already)
+        self.startblock = startblock
         # build default returnblock
         self.returnblock = Block([return_var or Variable()])
         self.returnblock.operations = ()
-        self.returnblock.exits      = ()
+        self.returnblock.exits = ()
         # block corresponding to exception results
         self.exceptblock = Block([Variable('etype'),   # exception class
                                   Variable('evalue')])  # exception value
         self.exceptblock.operations = ()
-        self.exceptblock.exits      = ()
+        self.exceptblock.exits = ()
         self.tag = None
 
     def getargs(self):
         self.operations = []              # list of SpaceOperation(s)
         self.exitswitch = None            # a variable or
                                           #  Constant(last_exception), see below
-        self.exits      = []              # list of Link(s)
+        self.exits = []                   # list of Link(s)
 
     def at(self):
         if self.operations and self.operations[0].offset >= 0:
     __slots__ = ["_name", "_nr", "concretetype"]
 
     dummyname = 'v'
-    namesdict = {dummyname : (dummyname, 0)}
+    namesdict = {dummyname: (dummyname, 0)}
 
     @property
     def name(self):
 class Constant(Hashable):
     __slots__ = ["concretetype"]
 
-    def __init__(self, value, concretetype = None):
+    def __init__(self, value, concretetype=None):
         Hashable.__init__(self, value)
         if concretetype is not None:
             self.concretetype = concretetype
 
     def __init__(self, opname, args, result, offset=-1):
         self.opname = intern(opname)      # operation name
-        self.args   = list(args)  # mixed list of var/const
+        self.args = list(args)    # mixed list of var/const
         self.result = result      # either Variable or Constant instance
         self.offset = offset      # offset in code string
 
         return not (self == other)
 
     def __hash__(self):
-        return hash((self.opname,tuple(self.args),self.result))
+        return hash((self.opname, tuple(self.args), self.result))
 
     def __repr__(self):
         return "%r = %s(%s)" % (self.result, self.opname,
 
 class Atom(object):
     def __init__(self, name):
-        self.__name__ = name # make save_global happy
+        self.__name__ = name  # make save_global happy
     def __repr__(self):
         return self.__name__
 
         try:
             for atom in flattenobj(*arg):
                 yield atom
-        except: yield arg
+        except:
+            yield arg
 
 def mkentrymap(funcgraph):
     "Returns a dict mapping Blocks to lists of Links."

rpython/flowspace/objspace.py

         raise ValueError("RPython functions cannot create closures")
     if not (func.func_code.co_flags & CO_NEWLOCALS):
         raise ValueError("The code object for a RPython function should have "
-                "the flag CO_NEWLOCALS set.")
+                         "the flag CO_NEWLOCALS set.")
 
 
 def build_flow(func):

rpython/flowspace/operation.py

         base_cls = HLOperation
     bases.append(base_cls)
     cls = HLOperationMeta(name, tuple(bases), {'opname': name, 'arity': arity,
-                                              'canraise': [],
-                                              'dispatch': dispatch})
+                                               'canraise': [],
+                                               'dispatch': dispatch})
     if pyfunc is not None:
         func2op[pyfunc] = cls
     if operator_func:

rpython/flowspace/pygraph.py

         for c in "<>&!":
             name = name.replace(c, '_')
         return name
-