' one of the sets.)') frozenset_union = SMM('union', 2, doc='Return the union of two sets as a' ' new set.\n\n(i.e. all elements' ' that are in either set.)') frozenset_reduce = SMM('__reduce__',1, doc='Return state information for' ' pickling.') register_all(vars(), globals()) def descr__frozenset__new__(space, w_frozensettype, w_iterable=NoneNotWrapped): from pypy.objspace.std.setobject import W_FrozensetObject from pypy.objspace.std.setobject import _is_frozenset_exact if (space.is_w(w_frozensettype, space.w_frozenset) and _is_frozenset_exact(w_iterable)): return w_iterable w_obj = space.allocate_instance(W_FrozensetObject, w_frozensettype) W_FrozensetObject.__init__(w_obj, space, None) return w_obj frozenset_typedef = StdTypeDef("frozenset", __doc__ = """frozenset(iterable) --> frozenset object Build an immutable unordered collection.""", __new__ = newmethod(descr__frozenset__new__), ) frozenset_typedef.registermethods(globals())
' one of the sets.)') frozenset_union = SMM('union', 2, doc='Return the union of two sets as a' ' new set.\n\n(i.e. all elements' ' that are in either set.)') frozenset_reduce = SMM('__reduce__',1, doc='Return state information for' ' pickling.') register_all(vars(), globals()) def descr__frozenset__new__(space, w_frozensettype, w_iterable=NoneNotWrapped): from pypy.objspace.std.setobject import W_FrozensetObject from pypy.objspace.std.setobject import _is_frozenset_exact if _is_frozenset_exact(w_iterable): return w_iterable w_obj = space.allocate_instance(W_FrozensetObject, w_frozensettype) W_FrozensetObject.__init__(w_obj, space, None) return w_obj frozenset_typedef = StdTypeDef("frozenset", __doc__ = """frozenset(iterable) --> frozenset object Build an immutable unordered collection.""", __new__ = newmethod(descr__frozenset__new__), ) frozenset_typedef.custom_hash = True frozenset_typedef.registermethods(globals())
def complexwprop(name): def fget(space, w_obj): from pypy.objspace.std.complexobject import W_ComplexObject if not isinstance(w_obj, W_ComplexObject): raise OperationError(space.w_TypeError, space.wrap("descriptor is for 'complex'")) return space.newfloat(getattr(w_obj, name)) return GetSetProperty(fget) def descr___getnewargs__(space, w_self): from pypy.objspace.std.complexobject import W_ComplexObject assert isinstance(w_self, W_ComplexObject) return space.newtuple([space.newcomplex(w_self.realval, w_self.imagval)]) complex_typedef = StdTypeDef( "complex", __doc__="""complex(real[, imag]) -> complex number Create a complex number from a real part and an optional imaginary part. This is equivalent to (real + imag*1j) where imag defaults to 0.""", __new__=newmethod(descr__new__), __getnewargs__=newmethod(descr___getnewargs__), real=complexwprop('realval'), imag=complexwprop('imagval'), ) complex_typedef.registermethods(globals())
' itself and another.') set_reduce = SMM('__reduce__', 1, doc='Return state information for' ' pickling.') register_all(vars(), globals()) def descr__new__(space, w_settype, __args__): from pypy.objspace.std.setobject import W_SetObject w_obj = space.allocate_instance(W_SetObject, w_settype) W_SetObject.__init__(w_obj, space, None) return w_obj set_typedef = StdTypeDef( "set", __doc__="""set(iterable) --> set object Build an unordered collection.""", __new__=newmethod( descr__new__, unwrap_spec=[gateway.ObjSpace, gateway.W_Root, gateway.Arguments]), __hash__=no_hash_descr, ) set_typedef.registermethods(globals()) setiter_typedef = StdTypeDef("setiterator")
W_ComplexObject.__init__(w_obj, realval, imagval) return w_obj def complexwprop(name): def fget(space, w_obj): from pypy.objspace.std.complexobject import W_ComplexObject if not isinstance(w_obj, W_ComplexObject): raise OperationError(space.w_TypeError, space.wrap("descriptor is for 'complex'")) return space.newfloat(getattr(w_obj, name)) return GetSetProperty(fget) def descr___getnewargs__(space, w_self): from pypy.objspace.std.complexobject import W_ComplexObject assert isinstance(w_self, W_ComplexObject) return space.newtuple([space.newcomplex(w_self.realval,w_self.imagval)]) complex_typedef = StdTypeDef("complex", __doc__ = """complex(real[, imag]) -> complex number Create a complex number from a real part and an optional imaginary part. This is equivalent to (real + imag*1j) where imag defaults to 0.""", __new__ = newmethod(descr__new__), __getnewargs__ = newmethod(descr___getnewargs__), real = complexwprop('realval'), imag = complexwprop('imagval'), ) complex_typedef.custom_hash = True complex_typedef.registermethods(globals())
) set_union = SMM( "union", 2, doc="Return the union of two sets as a" " new set.\n\n(i.e. all elements" " that are in either set.)" ) set_update = SMM("update", 2, doc="Update a set with the union of" " itself and another.") set_reduce = SMM("__reduce__", 1, doc="Return state information for" " pickling.") register_all(vars(), globals()) def descr__new__(space, w_settype, __args__): from pypy.objspace.std.setobject import W_SetObject w_obj = space.allocate_instance(W_SetObject, w_settype) W_SetObject.__init__(w_obj, space, None) return w_obj set_typedef = StdTypeDef( "set", __doc__="""set(iterable) --> set object Build an unordered collection.""", __new__=newmethod(descr__new__, unwrap_spec=[gateway.ObjSpace, gateway.W_Root, gateway.Arguments]), __hash__=no_hash_descr, ) set_typedef.registermethods(globals()) setiter_typedef = StdTypeDef("setiterator")