當前位置: 首頁>>代碼示例>>Python>>正文


Python MutableMapping.values方法代碼示例

本文整理匯總了Python中collections.MutableMapping.values方法的典型用法代碼示例。如果您正苦於以下問題:Python MutableMapping.values方法的具體用法?Python MutableMapping.values怎麽用?Python MutableMapping.values使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在collections.MutableMapping的用法示例。


在下文中一共展示了MutableMapping.values方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __repr__

# 需要導入模塊: from collections import MutableMapping [as 別名]
# 或者: from collections.MutableMapping import values [as 別名]
def __repr__(self):
        if not self:
            return '%s()' % self.__class__.__name__
        try:
            items = ', '.join(map('%r: %r'.__mod__, self.most_common()))
            return '%s({%s})' % (self.__class__.__name__, items)
        except TypeError:
            # handle case where values are not orderable
            return '{0}({1!r})'.format(self.__class__.__name__, dict(self))

    # Multiset-style mathematical operations discussed in:
    #       Knuth TAOCP Volume II section 4.6.3 exercise 19
    #       and at http://en.wikipedia.org/wiki/Multiset
    #
    # Outputs guaranteed to only include positive counts.
    #
    # To strip negative and zero counts, add-in an empty counter:
    #       c += Counter() 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:20,代碼來源:misc.py

示例2: clear

# 需要導入模塊: from collections import MutableMapping [as 別名]
# 或者: from collections.MutableMapping import values [as 別名]
def clear(self):
        with self.lock:
            # Copy pointers to all values, then wipe the mapping
            values = list(itervalues(self._container))
            self._container.clear()

        if self.dispose_func:
            for value in values:
                self.dispose_func(value) 
開發者ID:war-and-code,項目名稱:jawfish,代碼行數:11,代碼來源:_collections.py

示例3: getlist

# 需要導入模塊: from collections import MutableMapping [as 別名]
# 或者: from collections.MutableMapping import values [as 別名]
def getlist(self, key):
        """Returns a list of all the values for the named field. Returns an
        empty list if the key doesn't exist."""
        try:
            vals = _dict_getitem(self, key.lower())
        except KeyError:
            return []
        else:
            if isinstance(vals, tuple):
                return [vals[1]]
            else:
                return vals[1:]

    # Backwards compatibility for httplib 
開發者ID:war-and-code,項目名稱:jawfish,代碼行數:16,代碼來源:_collections.py

示例4: __delitem__

# 需要導入模塊: from collections import MutableMapping [as 別名]
# 或者: from collections.MutableMapping import values [as 別名]
def __delitem__(self, elem):
        'Like dict.__delitem__() but does not raise KeyError for missing values.'
        if elem in self:
            super(Counter, self).__delitem__(elem) 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:6,代碼來源:misc.py

示例5: __len__

# 需要導入模塊: from collections import MutableMapping [as 別名]
# 或者: from collections.MutableMapping import values [as 別名]
def __len__(self):
        return len(set().union(*self.maps))     # reuses stored hash values if possible 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:4,代碼來源:misc.py

示例6: __delitem__

# 需要導入模塊: from collections import MutableMapping [as 別名]
# 或者: from collections.MutableMapping import values [as 別名]
def __delitem__(self, elem):
            '''Like dict.__delitem__() but does not raise KeyError for
            missing values.'''
            if elem in self:
                dict.__delitem__(self, elem) 
開發者ID:muhanzhang,項目名稱:D-VAE,代碼行數:7,代碼來源:python2x.py


注:本文中的collections.MutableMapping.values方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。