Commits

Brian Kearns committed 4de7fd2

unused imports/variables

  • Participants
  • Parent commits 66fcaf1

Comments (0)

Files changed (20)

File pypy/objspace/std/callmethod.py

 """
 
 from pypy.interpreter import function
-from pypy.objspace.descroperation import object_getattribute
 from rpython.rlib import jit
 from pypy.objspace.std.mapdict import LOOKUP_METHOD_mapdict, \
     LOOKUP_METHOD_mapdict_fill_cache_method
 
     if space.config.objspace.std.withmapdict and not jit.we_are_jitted():
         # mapdict has an extra-fast version of this function
-        from pypy.objspace.std.mapdict import LOOKUP_METHOD_mapdict
         if LOOKUP_METHOD_mapdict(f, nameindex, w_obj):
             return
 
     n_kwargs = (oparg >> 8) & 0xff
     w_self = f.peekvalue(n_args + (2 * n_kwargs))
     n = n_args + (w_self is not None)
-    
+
     if not n_kwargs:
         w_callable = f.peekvalue(n_args + (2 * n_kwargs) + 1)
         try:
             key = f.space.str_w(w_key)
             keywords[n_kwargs] = key
             keywords_w[n_kwargs] = w_value
-    
+
         arguments = f.popvalues(n)    # includes w_self if it is not None
         args = f.argument_factory(arguments, keywords, keywords_w, None, None)
         if w_self is None:

File pypy/objspace/std/celldict.py

                     for key, cell in iterator()]
 
     def clear(self, w_dict):
-        iterator = self.unerase(w_dict.dstorage).clear()
+        self.unerase(w_dict.dstorage).clear()
         self.mutated()
 
     def popitem(self, w_dict):

File pypy/objspace/std/complexobject.py

-from pypy.interpreter import gateway
+import math
+
 from pypy.interpreter.error import OperationError
 from pypy.objspace.std import newformat
 from pypy.objspace.std.intobject import W_IntObject
 from rpython.rlib import jit, rcomplex
 from rpython.rlib.rarithmetic import intmask, r_ulonglong
 
-import math
-
 
 class W_AbstractComplexObject(W_Object):
     __slots__ = ()

File pypy/objspace/std/complextype.py

 from pypy.interpreter.error import OperationError, oefmt
 from pypy.interpreter.gateway import interp2app, unwrap_spec, WrappedDefault
 from pypy.objspace.std.register_all import register_all
-from pypy.objspace.std.noneobject import W_NoneObject
 from pypy.objspace.std.stdtypedef import GetSetProperty, StdTypeDef
 from pypy.objspace.std.stdtypedef import StdObjSpaceMultiMethod
 from rpython.rlib.rfloat import string_to_float

File pypy/objspace/std/dictmultiobject.py

         w_clone.setup_iterator()
         # spool until we have the same pos
         while w_clone.pos < self.pos:
-            w_obj = w_clone.next_entry()
+            w_clone.next_entry()
             w_clone.pos += 1
         stuff = [w_clone.next_entry() for i in range(w_clone.pos, w_clone.len)]
         w_res = space.newlist(stuff)

File pypy/objspace/std/dictproxyobject.py

-from pypy.objspace.std.model import registerimplementation, W_Object
-from pypy.objspace.std.register_all import register_all
-from pypy.objspace.std.dictmultiobject import W_DictMultiObject, create_iterator_classes
-from pypy.objspace.std.dictmultiobject import DictStrategy
+#from pypy.objspace.std.model import registerimplementation, W_Object
+#from pypy.objspace.std.register_all import register_all
+from pypy.objspace.std.dictmultiobject import DictStrategy, create_iterator_classes
 from pypy.objspace.std.typeobject import unwrap_cell
 from pypy.interpreter.error import OperationError, oefmt
 
 
 
 class DictProxyStrategy(DictStrategy):
-
     erase, unerase = rerased.new_erasing_pair("dictproxy")
     erase = staticmethod(erase)
     unerase = staticmethod(unerase)
             w_type.dict_w[key] = w_value
 
     def setdefault(self, w_dict, w_key, w_default):
-        space = self.space
         w_result = self.getitem(w_dict, w_key)
         if w_result is not None:
             return w_result

File pypy/objspace/std/floatobject.py

+import math
 import operator
 
 from pypy.interpreter.error import OperationError, oefmt
-from pypy.objspace.std import model, newformat
+from pypy.objspace.std import newformat
 from pypy.objspace.std.floattype import float_typedef, W_AbstractFloatObject
 from pypy.objspace.std.multimethod import FailedToImplementArgs
 from pypy.objspace.std.model import registerimplementation, W_Object
 from pypy.objspace.std.register_all import register_all
-from pypy.objspace.std.noneobject import W_NoneObject
 from pypy.objspace.std.longobject import W_LongObject
 from rpython.rlib.rarithmetic import ovfcheck_float_to_int, intmask, LONG_BIT
 from rpython.rlib.rfloat import (
 from rpython.rlib import rfloat
 from rpython.tool.sourcetools import func_with_new_name
 
-
-import math
 from pypy.objspace.std.intobject import W_IntObject
 
 

File pypy/objspace/std/intobject.py

 translation this module uses rarithmetic.ovfcheck to explicitly check
 for overflows, something CPython does not do anymore.
 """
-
 import operator
 import sys
 
 from rpython.rlib import jit
-from rpython.rlib.objectmodel import instantiate, import_from_mixin, specialize
+from rpython.rlib.objectmodel import instantiate
 from rpython.rlib.rarithmetic import (
     LONG_BIT, is_valid_int, ovfcheck, r_longlong, r_uint, string_to_int)
 from rpython.rlib.rbigint import rbigint
 
 from pypy.interpreter import typedef
 from pypy.interpreter.baseobjspace import W_Root
-from pypy.interpreter.buffer import Buffer
 from pypy.interpreter.error import OperationError, oefmt
 from pypy.interpreter.gateway import WrappedDefault, interp2app, unwrap_spec
 from pypy.objspace.std import newformat
     BINARY_OPS, CMP_OPS, COMMUTATIVE_OPS, IDTAG_INT)
 from pypy.objspace.std.stdtypedef import StdTypeDef
 
-
 SENTINEL = object()
 
 
 class W_AbstractIntObject(W_Root):
-
     __slots__ = ()
 
     def is_w(self, space, w_other):
             else:
                 value, w_longval = _string_to_int_or_long(space, w_value,
                                                           buf.as_str())
-                ok = True
     else:
         base = space.int_w(w_base)
 

File pypy/objspace/std/longobject.py

 
 from pypy.interpreter import typedef
 from pypy.interpreter.baseobjspace import W_Root
-from pypy.interpreter.buffer import Buffer
 from pypy.interpreter.error import OperationError, oefmt
 from pypy.interpreter.gateway import (
     WrappedDefault, interp2app, interpindirect2app, unwrap_spec)

File pypy/objspace/std/marshal_impl.py

 
 from pypy.interpreter.error import OperationError
 from pypy.objspace.std.register_all import register_all
-from rpython.rlib.rarithmetic import LONG_BIT, r_longlong, r_uint, intmask
+from rpython.rlib.rarithmetic import LONG_BIT, r_longlong, r_uint
 from pypy.objspace.std import model
 from pypy.objspace.std.dictmultiobject import W_DictMultiObject
 from pypy.interpreter.special import Ellipsis
 register(TYPE_BINARY_COMPLEX, unmarshal_Complex_bin)
 
 def marshal_w__Long(space, w_long, m):
-    from rpython.rlib.rbigint import rbigint
     from rpython.rlib.rarithmetic import r_ulonglong
     m.start(TYPE_LONG)
     SHIFT = 15
     lng = u.atom_lng(tc)
     res = [None] * lng
     idx = 0
-    space = u.space
     while idx < lng:
         res[idx] = unmarshal_str(u)
         idx += 1

File pypy/objspace/std/multimethod.py

         entryarray = CompressedArray(null_entry)
         indexarray = self.mrdtable.indexarray
         lst = self.mrdtable.list_of_types
-        indexline = []
 
         def compress(typesprefix, typesnum):
             if len(typesprefix) == self.multimethod.arity:

File pypy/objspace/std/newformat.py

                 if not got_align:
                     self._align = "="
                 i += 1
-            start_i = i
             self._width, i = _parse_int(self.space, spec, i, length)
             if length != i and spec[i] == ",":
                 self._thousands_sep = True
             return space.wrap(self._pad(string))
 
         def _get_locale(self, tp):
-            space = self.space
             if tp == "n":
                 dec, thousands, grouping = rlocale.numeric_formatting()
             elif self._thousands_sep:
             grouping = self._loc_grouping
             min_width = spec.n_min_width
             grouping_state = 0
-            count = 0
             left = spec.n_digits
             n_ts = len(self._loc_thousands)
             need_separator = False
             done = False
-            groupings = len(grouping)
             previous = 0
             while True:
                 group = ord(grouping[grouping_state])

File pypy/objspace/std/objspace.py

                 strdict=strdict, kwargs=kwargs)
 
     def newset(self):
-        from pypy.objspace.std.setobject import newset
         return W_SetObject(self, None)
 
     def newslice(self, w_start, w_end, w_step):

File pypy/objspace/std/proxy_helpers.py

-
 """ Some transparent helpers, put here because
 of cyclic imports
 """
 
-from pypy.objspace.std.model import W_ANY, W_Object
-from pypy.interpreter import baseobjspace
+from pypy.objspace.std.model import W_ANY
 from pypy.interpreter.argument import Arguments
 from rpython.tool.sourcetools import func_with_new_name
 
     def function(space, w_transparent_list, __args__):
         args = __args__.prepend(space.wrap(op_name))
         return space.call_args(w_transparent_list.w_controller, args)
-    
+
     function = func_with_new_name(function, mm.name)
     mm.register(function, type_)
 
     def function(space, w_transparent_list, *args_w):
         args = Arguments(space, [space.wrap(op_name)] + list(args_w[:-1]) + args_w[-1])
         return space.call_args(w_transparent_list.w_controller, args)
-    
+
     function = func_with_new_name(function, mm.name)
     mm.register(function, type_, *([W_ANY] * (mm.arity - 1)))
 
 def install_mm_trampoline(type_, mm, is_local):
     classname = type_.__name__[2:]
     mm_name, op_name = create_mm_names(classname, mm, is_local)
-    
+
     if ['__args__'] == mm.argnames_after:
         return install_general_args_trampoline(type_, mm, is_local, op_name)
     if ['args_w'] == mm.argnames_after:
     """
     if mm.arity != 2:
         return False
-    
+
     if len(mm.specialnames) != 2:
         return False
-    
+
     # search over the signatures
     for signature in mm.signatures():
         if signature == (type_.original, type_.original):
     return False
 
 def install_mm_special(type_, mm, is_local):
-    classname = type_.__name__[2:]
+    #classname = type_.__name__[2:]
     #mm_name, op_name = create_mm_names(classname, mm, is_local)
-    
+
     def function(space, w_any, w_transparent_list):
         retval = space.call_function(w_transparent_list.w_controller, space.wrap(mm.specialnames[1]),
             w_any)
         return retval
-        
+
     function = func_with_new_name(function, mm.specialnames[0])
-    
+
     mm.register(function, type_.typedef.any, type_)
 
 def register_type(type_):
     from pypy.objspace.std.stdtypedef import multimethods_defined_on
-    
+
     for mm, is_local in multimethods_defined_on(type_.original):
         if not mm.name.startswith('__'):
             install_mm_trampoline(type_, mm, is_local)

File pypy/objspace/std/proxyobject.py

-
 """ transparent list implementation
 """
-
-from pypy.objspace.std.model import W_Object
 from pypy.interpreter.error import OperationError
 from pypy.interpreter import baseobjspace
 
-#class W_Transparent(W_Object):
-#    def __init__(self, w_controller):
-#        self.controller = w_controller
-
 
 def transparent_class(name, BaseCls):
     class W_Transparent(BaseCls):
     return W_Transparent
 
 W_Transparent = transparent_class('W_Transparent', baseobjspace.W_Root)
-#W_TransparentObject = transparent_class('W_TransparentObject', W_Object)
-
-#from pypy.objspace.std.objecttype import object_typedef
-#W_TransparentObject.typedef = object_typedef
-
-from pypy.interpreter.typedef import Function, GeneratorIterator, PyTraceback, \
-    PyFrame, PyCode
-
-class W_TransparentFunction(W_Transparent):
-    typedef = Function.typedef
-
-class W_TransparentTraceback(W_Transparent):
-    typedef = PyTraceback.typedef
-
-class W_TransparentCode(W_Transparent):
-    typedef = PyCode.typedef
-
-class W_TransparentFrame(W_Transparent):
-    typedef = PyFrame.typedef
-
-class W_TransparentGenerator(W_Transparent):
-    typedef = GeneratorIterator.typedef

File pypy/objspace/std/slicetype.py

-from pypy.interpreter import baseobjspace, gateway
+from pypy.interpreter import gateway
 from pypy.interpreter.typedef import GetSetProperty
 from pypy.objspace.std.stdtypedef import StdTypeDef, SMM
 from pypy.objspace.std.register_all import register_all

File pypy/objspace/std/stdtypedef.py

-from pypy.interpreter import gateway, baseobjspace, argument
+from pypy.interpreter import gateway, baseobjspace
 from pypy.interpreter.error import OperationError, oefmt
-from pypy.interpreter.typedef import TypeDef, GetSetProperty, Member
-from pypy.interpreter.typedef import descr_get_dict, descr_set_dict
-from pypy.interpreter.typedef import descr_del_dict
+from pypy.interpreter.typedef import TypeDef, GetSetProperty, \
+    descr_get_dict, descr_set_dict, descr_del_dict
 from pypy.interpreter.baseobjspace import SpaceCache
 from pypy.objspace.std import model
 from pypy.objspace.std.model import StdObjSpaceMultiMethod

File pypy/objspace/std/stringmethods.py

     def descr_split(self, space, w_sep=None, maxsplit=-1):
         res = []
         value = self._val(space)
-        length = len(value)
         if space.is_none(w_sep):
             res = split(value, maxsplit=maxsplit)
             return self._newlist_unwrapped(space, res)

File pypy/objspace/std/transparent.py

-
 """ transparent.py - Several transparent proxy helpers
 """
-
 from pypy.interpreter import gateway
 from pypy.interpreter.error import OperationError, oefmt
-from pypy.objspace.std.proxyobject import *
+from pypy.interpreter.typedef import Function, GeneratorIterator, PyTraceback, \
+    PyFrame, PyCode
+from pypy.objspace.std.proxyobject import W_Transparent
 from pypy.objspace.std.typeobject import W_TypeObject
-from rpython.rlib.objectmodel import r_dict
 from rpython.rlib.unroll import unrolling_iterable
 
+
+class W_TransparentFunction(W_Transparent):
+    typedef = Function.typedef
+
+class W_TransparentTraceback(W_Transparent):
+    typedef = PyTraceback.typedef
+
+class W_TransparentCode(W_Transparent):
+    typedef = PyCode.typedef
+
+class W_TransparentFrame(W_Transparent):
+    typedef = PyFrame.typedef
+
+class W_TransparentGenerator(W_Transparent):
+    typedef = GeneratorIterator.typedef
+
+
 class TypeCache(object):
     def __init__(self):
         self.cache = []
                   space.wrap(app_proxy_controller))
 
 
-
 def proxy(space, w_type, w_controller):
     """tproxy(typ, controller) -> obj
 Return something that looks like it is of type typ. Its behaviour is
 completely controlled by the controller."""
-    from pypy.interpreter.typedef import Function, PyTraceback, PyFrame, \
-        PyCode, GeneratorIterator
     if not space.is_true(space.callable(w_controller)):
         raise OperationError(space.w_TypeError, space.wrap("controller should be function"))
 

File pypy/objspace/std/typeobject.py

 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.error import OperationError, oefmt
 from pypy.interpreter.function import Function, StaticMethod
-from pypy.interpreter.typedef import weakref_descr, GetSetProperty,\
+from pypy.interpreter.typedef import weakref_descr, GetSetProperty, Member, \
      descr_get_dict
 from pypy.interpreter.astcompiler.misc import mangle
 from pypy.objspace.std.model import W_Object
 from pypy.objspace.std.register_all import register_all
-from pypy.objspace.std.stdtypedef import std_dict_descr, issubtypedef, Member
+from pypy.objspace.std.stdtypedef import std_dict_descr, issubtypedef
 from pypy.objspace.std.stdtypedef import StdTypeDef
 
 from rpython.rlib.jit import (promote, elidable_promote, we_are_jitted,