コード例 #1
0
 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
コード例 #2
0
ファイル: memory.py プロジェクト: misdoro/python-ase
 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
コード例 #3
0
 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)
コード例 #4
0
ファイル: multidict.py プロジェクト: 404minds/quiz-forest
 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)
コード例 #5
0
ファイル: ordereddict.py プロジェクト: bazsi/codega
    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)))
コード例 #6
0
 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)
コード例 #7
0
ファイル: memory.py プロジェクト: misdoro/python-ase
 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)