Commits

Alex Gaynor committed 7ad06da

Random style fixes. Note: you cannot use rgc.ll_arraycopy in resize because its an array of structs

Comments (0)

Files changed (1)

pypy/rlib/dict.py

-
 from pypy.rlib.jit_hooks import _cast_to_gcref
 from pypy.rpython.lltypesystem import lltype, llmemory, rclass
 from pypy.rpython.annlowlevel import cast_base_ptr_to_instance
                                   ('value', llmemory.GCREF)))
 MAIN_TP = lltype.GcArray(lltype.Signed)
 
+
 class Dict(object):
     'Space efficient dictionary with fast iteration and cheap resizes.'
 
         else:
             perturb = hashvalue
         n = len(self.indices)
-        i = perturb & (n-1)
+        i = perturb & (n - 1)
         while True:
             index = self.indices[i]
             if index == FREE:
             elif self.values[index].key == key:
                 return (index, i)
             i = 5 * i + perturb + 1
-            i = i & (n-1)
+            i = i & (n - 1)
             perturb >>= PERTURB_SHIFT
     _lookup._always_inline_ = True
 
                 perturb = -hashvalue
             else:
                 perturb = hashvalue
-            i = hashvalue & (n-1)
+            i = hashvalue & (n - 1)
             while True:
                 if self.indices[i] == FREE:
                     break
                 i = 5 * i + perturb + 1
-                i = i & (n-1)
+                i = i & (n - 1)
                 perturb >>= PERTURB_SHIFT
             self.indices[i] = index
         self.filled = self.used
         ptr = lltype.cast_opaque_ptr(rclass.OBJECTPTR, llref)
         return cast_base_ptr_to_instance(CLS, ptr)
 
-
     def __setitem__(self, key, value):
         hashvalue = key # hash
         index, i = self._lookup(key, hashvalue)
             key = self.keylist[-1]
             value = self.valuelist[-1]
         except IndexError:
-            raise KeyError( 'popitem(): dictionary is empty')
+            raise KeyError('popitem(): dictionary is empty')
         del self[key]
         return key, value