def copy(self): """Return a shallow copy of a VM statistics instance. D.copy() -> a shallow copy of D""" if self.verbose >= 1: print('MemoryBase.copy') res = object.__new__(self.__class__) MemoryBase.__init__(res, self.verbose) DictMixin.update(res, self) return res
def copy(self): """Return a shallow copy of a VM statistics instance. D.copy() -> a shallow copy of D""" if self.verbose>=1: print('MemoryBase.copy') res = object.__new__(self.__class__) MemoryBase.__init__(res, self.verbose) DictMixin.update(res, self) return res
def update(self, *args, **kw): if args: lst = args[0] if len(lst) != len(dict(lst)): # this does not catch the cases where we overwrite existing # keys, but those would produce too many warning msg = ( "Behavior of MultiDict.update() has changed " "and overwrites duplicate keys. Consider using .extend()") warnings.warn(msg, stacklevel=2) DictMixin.update(self, *args, **kw)
def update(self, *args, **kw): if args: lst = args[0] if len(lst) != len(dict(lst)): # this does not catch the cases where we overwrite existing # keys, but those would produce too many warning msg = ("Behavior of MultiDict.update() has changed " "and overwrites duplicate keys. Consider using .extend()" ) warnings.warn(msg, UserWarning, stacklevel=2) DictMixin.update(self, *args, **kw)
def update(self, *args): if len(args) == 1: DictMixin.update(self, args[0]) elif len(args) == 2: pos, udict = args for ndx, key in enumerate(udict.keys()): self.insert(pos + ndx, key, udict[key]) else: raise TypeError("update expected at most 3 arguments, got " + repr(1 + len(args)))
def update(self, other=None): """D.update(E) -> None. Update D from E: for k in E.keys(): D[k] = E[k]""" if self.verbose >= 1: print('MemoryBase.update') DictMixin.update(self, other)
def update(self, other=None): """D.update(E) -> None. Update D from E: for k in E.keys(): D[k] = E[k]""" if self.verbose>=1: print('MemoryBase.update') DictMixin.update(self, other)