Example #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
Example #2
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
Example #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)
Example #4
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, UserWarning, stacklevel=2)
     DictMixin.update(self, *args, **kw)
Example #5
0
    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)))
Example #6
0
 def setdefault(self, name, value=None):
     """
     Retrieve the last value for the given header name.  If there are no
     values present for that header, set the value to C{value} and return
     that instead.  Note that C{None} is the default for C{value} for
     backwards compatibility, but header values may only be of type C{str}.
     """
     return DictMixin.setdefault(self, name, value)
Example #7
0
 def setdefault(self, name, value=None):
     """
     Retrieve the last value for the given header name.  If there are no
     values present for that header, set the value to C{value} and return
     that instead.  Note that C{None} is the default for C{value} for
     backwards compatibility, but header values may only be of type C{str}.
     """
     return DictMixin.setdefault(self, name, value)
Example #8
0
    def __cmp__(self, other):
        # Dont allow objects of different inherited classes to be equal.
        # This WILL ALLOW different instances with different names but the
        # same keys and values to be equal
        #
        # Subclasses may wish to override this to compare different attributes
        #

        cls_cmp = cmp(self.__class__, other.__class__)
        if cls_cmp != 0:
            return cls_cmp
        return DictMixin.__cmp__(self, other)
Example #9
0
    def __cmp__(self, other):
        # Dont allow objects of different inherited classes to be equal.
        # This WILL ALLOW different instances with different names but the
        # same keys and values to be equal
        #
        # Subclasses may wish to override this to compare different attributes
        #

        cls_cmp = cmp(self.__class__, other.__class__)
        if cls_cmp != 0:
            return cls_cmp
        return DictMixin.__cmp__(self, other)
Example #10
0
 def get(self, key, default=None):
     return DictMixin.get(self, key) or default
Example #11
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)
Example #12
0
 def readBarcodeOptions( self, description = "", labels = "", labelSheet = "avery4780", computeChecksum = "",
                         bearerBar = "", symbology = "Code128",
                         withBorderLines = "", labelTitle = "Bibliothek KGS Forster Linde", 
                         startCounter = "0", endCounter = "20" ) :
     options = DictMixin()
     options.description = description
     options.labelsConcaternated = labels
     options.labelSheet = labelSheet
     options.withBorderLines = bool( withBorderLines )
     options.labelTitle = labelTitle
     print "'%s' has type %s" % ( options.labelTitle, type( options.labelTitle ) )
     options.startCounter = int( startCounter )
     options.endCounter = int( endCounter )
     options.computeChecksum = bool( computeChecksum )
     options.bearerBar = bool( bearerBar )
     options.symbology = symbology
     return options
	def get(self, key, default=None):
		return DictMixin.get(self, key) or default
Example #14
0
 def __repr__(self):
     if not self.alive:
         return 'Dead CrossView{ }'
     return 'CrossView' + DictMixin.__repr__(self)
Example #15
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)