Author: Brian Kearns <bdkea...@gmail.com> Branch: Changeset: r70073:4de7fd2dd15f Date: 2014-03-18 21:34 -0400 http://bitbucket.org/pypy/pypy/changeset/4de7fd2dd15f/
Log: unused imports/variables diff --git a/pypy/objspace/std/callmethod.py b/pypy/objspace/std/callmethod.py --- a/pypy/objspace/std/callmethod.py +++ b/pypy/objspace/std/callmethod.py @@ -11,7 +11,6 @@ """ 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 @@ -36,7 +35,6 @@ 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 @@ -79,7 +77,7 @@ 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: @@ -98,7 +96,7 @@ 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: diff --git a/pypy/objspace/std/celldict.py b/pypy/objspace/std/celldict.py --- a/pypy/objspace/std/celldict.py +++ b/pypy/objspace/std/celldict.py @@ -140,7 +140,7 @@ 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): diff --git a/pypy/objspace/std/complexobject.py b/pypy/objspace/std/complexobject.py --- a/pypy/objspace/std/complexobject.py +++ b/pypy/objspace/std/complexobject.py @@ -1,4 +1,5 @@ -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 @@ -12,8 +13,6 @@ from rpython.rlib import jit, rcomplex from rpython.rlib.rarithmetic import intmask, r_ulonglong -import math - class W_AbstractComplexObject(W_Object): __slots__ = () diff --git a/pypy/objspace/std/complextype.py b/pypy/objspace/std/complextype.py --- a/pypy/objspace/std/complextype.py +++ b/pypy/objspace/std/complextype.py @@ -1,7 +1,6 @@ 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 diff --git a/pypy/objspace/std/dictmultiobject.py b/pypy/objspace/std/dictmultiobject.py --- a/pypy/objspace/std/dictmultiobject.py +++ b/pypy/objspace/std/dictmultiobject.py @@ -1184,7 +1184,7 @@ 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) diff --git a/pypy/objspace/std/dictproxyobject.py b/pypy/objspace/std/dictproxyobject.py --- a/pypy/objspace/std/dictproxyobject.py +++ b/pypy/objspace/std/dictproxyobject.py @@ -1,7 +1,6 @@ -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 @@ -9,7 +8,6 @@ class DictProxyStrategy(DictStrategy): - erase, unerase = rerased.new_erasing_pair("dictproxy") erase = staticmethod(erase) unerase = staticmethod(unerase) @@ -62,7 +60,6 @@ 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 diff --git a/pypy/objspace/std/floatobject.py b/pypy/objspace/std/floatobject.py --- a/pypy/objspace/std/floatobject.py +++ b/pypy/objspace/std/floatobject.py @@ -1,12 +1,12 @@ +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 ( @@ -16,8 +16,6 @@ from rpython.rlib import rfloat from rpython.tool.sourcetools import func_with_new_name - -import math from pypy.objspace.std.intobject import W_IntObject diff --git a/pypy/objspace/std/intobject.py b/pypy/objspace/std/intobject.py --- a/pypy/objspace/std/intobject.py +++ b/pypy/objspace/std/intobject.py @@ -4,12 +4,11 @@ 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 @@ -20,7 +19,6 @@ 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 @@ -28,12 +26,10 @@ 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): @@ -706,7 +702,6 @@ else: value, w_longval = _string_to_int_or_long(space, w_value, buf.as_str()) - ok = True else: base = space.int_w(w_base) diff --git a/pypy/objspace/std/longobject.py b/pypy/objspace/std/longobject.py --- a/pypy/objspace/std/longobject.py +++ b/pypy/objspace/std/longobject.py @@ -9,7 +9,6 @@ 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) diff --git a/pypy/objspace/std/marshal_impl.py b/pypy/objspace/std/marshal_impl.py --- a/pypy/objspace/std/marshal_impl.py +++ b/pypy/objspace/std/marshal_impl.py @@ -10,7 +10,7 @@ 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 @@ -201,7 +201,6 @@ 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 @@ -375,7 +374,6 @@ lng = u.atom_lng(tc) res = [None] * lng idx = 0 - space = u.space while idx < lng: res[idx] = unmarshal_str(u) idx += 1 diff --git a/pypy/objspace/std/multimethod.py b/pypy/objspace/std/multimethod.py --- a/pypy/objspace/std/multimethod.py +++ b/pypy/objspace/std/multimethod.py @@ -866,7 +866,6 @@ 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: diff --git a/pypy/objspace/std/newformat.py b/pypy/objspace/std/newformat.py --- a/pypy/objspace/std/newformat.py +++ b/pypy/objspace/std/newformat.py @@ -461,7 +461,6 @@ 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 @@ -576,7 +575,6 @@ 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: @@ -673,12 +671,10 @@ 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]) diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py --- a/pypy/objspace/std/objspace.py +++ b/pypy/objspace/std/objspace.py @@ -306,7 +306,6 @@ 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): diff --git a/pypy/objspace/std/proxy_helpers.py b/pypy/objspace/std/proxy_helpers.py --- a/pypy/objspace/std/proxy_helpers.py +++ b/pypy/objspace/std/proxy_helpers.py @@ -1,10 +1,8 @@ - """ 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 @@ -24,7 +22,7 @@ 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_) @@ -32,14 +30,14 @@ 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: @@ -58,10 +56,10 @@ """ 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): @@ -69,21 +67,21 @@ 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) diff --git a/pypy/objspace/std/proxyobject.py b/pypy/objspace/std/proxyobject.py --- a/pypy/objspace/std/proxyobject.py +++ b/pypy/objspace/std/proxyobject.py @@ -1,15 +1,8 @@ - """ 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): @@ -72,25 +65,3 @@ 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 diff --git a/pypy/objspace/std/slicetype.py b/pypy/objspace/std/slicetype.py --- a/pypy/objspace/std/slicetype.py +++ b/pypy/objspace/std/slicetype.py @@ -1,4 +1,4 @@ -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 diff --git a/pypy/objspace/std/stdtypedef.py b/pypy/objspace/std/stdtypedef.py --- a/pypy/objspace/std/stdtypedef.py +++ b/pypy/objspace/std/stdtypedef.py @@ -1,8 +1,7 @@ -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 diff --git a/pypy/objspace/std/stringmethods.py b/pypy/objspace/std/stringmethods.py --- a/pypy/objspace/std/stringmethods.py +++ b/pypy/objspace/std/stringmethods.py @@ -437,7 +437,6 @@ 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) diff --git a/pypy/objspace/std/transparent.py b/pypy/objspace/std/transparent.py --- a/pypy/objspace/std/transparent.py +++ b/pypy/objspace/std/transparent.py @@ -1,14 +1,30 @@ - """ 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 = [] @@ -28,13 +44,10 @@ 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")) diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py --- a/pypy/objspace/std/typeobject.py +++ b/pypy/objspace/std/typeobject.py @@ -2,12 +2,12 @@ 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, _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit