def init__DictMulti(space, w_dict, __args__): w_src, w_kwds = __args__.parse_obj( None, 'dict', init_signature, # signature init_defaults) # default argument if w_src is None: pass elif space.findattr(w_src, space.wrap("keys")) is None: list_of_w_pairs = space.unpackiterable(w_src) for w_pair in list_of_w_pairs: pair = space.unpackiterable(w_pair) if len(pair) != 2: raise OperationError( space.w_ValueError, space.wrap("dict() takes a sequence of pairs")) w_k, w_v = pair w_dict.implementation = w_dict.implementation.setitem(w_k, w_v) else: if space.is_true(w_src): from pypy.objspace.std.dicttype import update1 update1(space, w_dict, w_src) if space.is_true(w_kwds): from pypy.objspace.std.dicttype import update1 update1(space, w_dict, w_kwds)
def init__Dict(space, w_dict, __args__): w_src, w_kwds = __args__.parse('dict', (['seq_or_map'], None, 'kwargs'), # signature [W_DictObject(space)]) # default argument # w_dict.content.clear() - disabled only for CPython compatibility if space.findattr(w_src, space.wrap("keys")) is None: list_of_w_pairs = space.unpackiterable(w_src) for w_pair in list_of_w_pairs: pair = space.unpackiterable(w_pair) if len(pair)!=2: raise OperationError(space.w_ValueError, space.wrap("dict() takes a sequence of pairs")) w_k, w_v = pair w_dict.content[w_k] = w_v else: if space.is_true(w_src): from pypy.objspace.std.dicttype import update1 update1(space, w_dict, w_src) if space.is_true(w_kwds): from pypy.objspace.std.dicttype import update1 update1(space, w_dict, w_kwds)
def init__DictMulti(space, w_dict, __args__): w_src, w_kwds = __args__.parse_obj( None, 'dict', init_signature, # signature init_defaults) # default argument if w_src is None: pass elif space.findattr(w_src, space.wrap("keys")) is None: list_of_w_pairs = space.listview(w_src) for w_pair in list_of_w_pairs: pair = space.fixedview(w_pair) if len(pair)!=2: raise OperationError(space.w_ValueError, space.wrap("dict() takes a sequence of pairs")) w_k, w_v = pair w_dict.setitem(w_k, w_v) else: if space.is_true(w_src): from pypy.objspace.std.dicttype import update1 update1(space, w_dict, w_src) if space.is_true(w_kwds): from pypy.objspace.std.dicttype import update1 update1(space, w_dict, w_kwds)
def dict_copy__DictMulti(space, w_self): from pypy.objspace.std.dicttype import update1 w_new = W_DictMultiObject.allocate_and_init_instance(space) update1(space, w_new, w_self) return w_new
def dict_copy__DictMulti(space, w_self): from pypy.objspace.std.dicttype import update1 w_new = W_DictMultiObject(space) update1(space, w_new, w_self) return w_new