Author: Manuel Jacob
Branch: 
Changeset: r68835:534c06c36a58
Date: 2014-01-21 20:55 +0100
http://bitbucket.org/pypy/pypy/changeset/534c06c36a58/

Log:    Do some (hopefully) uncontroversiol style changes.

diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py
--- a/rpython/flowspace/bytecode.py
+++ b/rpython/flowspace/bytecode.py
@@ -34,8 +34,8 @@
     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
@@ -58,18 +58,18 @@
         """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):
diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -436,7 +436,7 @@
         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
@@ -1042,7 +1042,7 @@
     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])
@@ -1069,7 +1069,7 @@
             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()
diff --git a/rpython/flowspace/model.py b/rpython/flowspace/model.py
--- a/rpython/flowspace/model.py
+++ b/rpython/flowspace/model.py
@@ -35,17 +35,17 @@
 
 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):
@@ -187,7 +187,7 @@
         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:
@@ -276,7 +276,7 @@
     __slots__ = ["_name", "_nr", "concretetype"]
 
     dummyname = 'v'
-    namesdict = {dummyname : (dummyname, 0)}
+    namesdict = {dummyname: (dummyname, 0)}
 
     @property
     def name(self):
@@ -338,7 +338,7 @@
 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
@@ -416,7 +416,7 @@
 
     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
 
@@ -430,7 +430,7 @@
         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,
@@ -443,7 +443,7 @@
 
 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__
 
@@ -470,7 +470,8 @@
         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."
diff --git a/rpython/flowspace/objspace.py b/rpython/flowspace/objspace.py
--- a/rpython/flowspace/objspace.py
+++ b/rpython/flowspace/objspace.py
@@ -19,7 +19,7 @@
         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):
diff --git a/rpython/flowspace/operation.py b/rpython/flowspace/operation.py
--- a/rpython/flowspace/operation.py
+++ b/rpython/flowspace/operation.py
@@ -169,8 +169,8 @@
         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:
diff --git a/rpython/flowspace/pygraph.py b/rpython/flowspace/pygraph.py
--- a/rpython/flowspace/pygraph.py
+++ b/rpython/flowspace/pygraph.py
@@ -31,4 +31,3 @@
         for c in "<>&!":
             name = name.replace(c, '_')
         return name
-
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to