Python UserDict.DictMixin 模块,pop() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用UserDict.DictMixin.pop()

项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:my-first-blog    作者:AnkurBegining    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:my-first-blog    作者:AnkurBegining    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:oscars2016    作者:0x0ece    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:oscars2016    作者:0x0ece    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        # Modified from original to support Python 2.4, see
        # http://code.google.com/p/simplejson/issues/detail?id=53
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:mongodb-monitoring    作者:jruaux    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:mongodb-monitoring    作者:jruaux    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:deb-python-cassandra-driver    作者:openstack    | 项目源码 | 文件源码
def __delitem__(self, key):
            dict.__delitem__(self, key)
            key, prev, next = self.__map.pop(key)
            prev[2] = next
            next[1] = prev
项目:deb-python-cassandra-driver    作者:openstack    | 项目源码 | 文件源码
def popitem(self, last=True):
            if not self:
                raise KeyError('dictionary is empty')
            if last:
                key = next(reversed(self))
            else:
                key = next(iter(self))
            value = self.pop(key)
            return key, value
项目:deb-python-cassandra-driver    作者:openstack    | 项目源码 | 文件源码
def _commit_removals(self):
        l = self._pending_removals
        discard = self.data.discard
        while l:
            discard(l.pop())
项目:deb-python-cassandra-driver    作者:openstack    | 项目源码 | 文件源码
def pop(self):
        if self._pending_removals:
            self._commit_removals()
        while True:
            try:
                itemref = self.data.pop()
            except KeyError:
                raise KeyError('pop from empty WeakSet')
            item = itemref()
            if item is not None:
                return item
项目:deb-python-cassandra-driver    作者:openstack    | 项目源码 | 文件源码
def pop(self):
        if not self._items:
            raise KeyError("pop from empty set")
        return self._items.pop()
项目:deb-python-cassandra-driver    作者:openstack    | 项目源码 | 文件源码
def __delitem__(self, key):
        # not efficient -- for convenience only
        try:
            index = self._index.pop(self._serialize_key(key))
            self._index = dict((k, i if i < index else i - 1) for k, i in self._index.items())
            self._items.pop(index)
        except KeyError:
            raise KeyError(str(key))
项目:deb-python-cassandra-driver    作者:openstack    | 项目源码 | 文件源码
def popitem(self):
        try:
            kv = self._items.pop()
            del self._index[self._serialize_key(kv[0])]
            return kv
        except IndexError:
            raise KeyError()
项目:Splunk_CBER_App    作者:MHaggis    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:Splunk_CBER_App    作者:MHaggis    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:swjtu-pyscraper    作者:Desgard    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:swjtu-pyscraper    作者:Desgard    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:jira_worklog_scanner    作者:pgarneau    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:jira_worklog_scanner    作者:pgarneau    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:llk    作者:Tycx2ry    | 项目源码 | 文件源码
def __delitem__(self, key):
    dict.__delitem__(self, key)
    key, prev, next = self.__map.pop(key)
    prev[2] = next
    next[1] = prev
项目:llk    作者:Tycx2ry    | 项目源码 | 文件源码
def popitem(self, last=True):
    if not self:
      raise KeyError('dictionary is empty')
    if last:
      key = reversed(self).next()
    else:
      key = iter(self).next()
    value = self.pop(key)
    return key, value
项目:pythonVSCode    作者:DonJayamanne    | 项目源码 | 文件源码
def __delitem__(self, key):
            dict.__delitem__(self, key)
            key, prev, next = self.__map.pop(key)
            prev[2] = next
            next[1] = prev
项目:pythonVSCode    作者:DonJayamanne    | 项目源码 | 文件源码
def popitem(self, last=True):
            if not self:
                raise KeyError('dictionary is empty')
            if last:
                key = reversed(self).next()
            else:
                key = iter(self).next()
            value = self.pop(key)
            return key, value
项目:pythonVSCode    作者:DonJayamanne    | 项目源码 | 文件源码
def discard(self, key):
        if key in self.map:
            key, prev, next = self.map.pop(key)
            prev[2] = next
            next[1] = prev
项目:pythonVSCode    作者:DonJayamanne    | 项目源码 | 文件源码
def pop(self, last=True):
        if not self:
            raise KeyError('set is empty')
        key = self.end[1][0] if last else self.end[2][0]
        self.discard(key)
        return key
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:harbour-sailfinder    作者:DylanVanAssche    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:harbour-sailfinder    作者:DylanVanAssche    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value
项目:harbour-sailfinder    作者:DylanVanAssche    | 项目源码 | 文件源码
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev
项目:harbour-sailfinder    作者:DylanVanAssche    | 项目源码 | 文件源码
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = reversed(self).next()
        else:
            key = iter(self).next()
        value = self.pop(key)
        return key, value