Python _weakrefset 模块,_IterationGuard() 实例源码

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

项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def items(self):
        if self._pending_removals:
            self._commit_removals()
        with _IterationGuard(self):
            for k, wr in self.data.items():
                v = wr()
                if v is not None:
                    yield k, v
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def keys(self):
        if self._pending_removals:
            self._commit_removals()
        with _IterationGuard(self):
            for k, wr in self.data.items():
                if wr() is not None:
                    yield k
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def itervaluerefs(self):
        """Return an iterator that yields the weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        """
        if self._pending_removals:
            self._commit_removals()
        with _IterationGuard(self):
            yield from self.data.values()
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def values(self):
        if self._pending_removals:
            self._commit_removals()
        with _IterationGuard(self):
            for wr in self.data.values():
                obj = wr()
                if obj is not None:
                    yield obj
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def items(self):
        with _IterationGuard(self):
            for wr, value in self.data.items():
                key = wr()
                if key is not None:
                    yield key, value
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def values(self):
        with _IterationGuard(self):
            for wr, value in self.data.items():
                if wr() is not None:
                    yield value
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def iteritems(self):
        with _IterationGuard(self):
            for wr in self.data.itervalues():
                value = wr()
                if value is not None:
                    yield wr.key, value
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def iterkeys(self):
        with _IterationGuard(self):
            for k in self.data.iterkeys():
                yield k
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def itervaluerefs(self):
        """Return an iterator that yields the weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        """
        with _IterationGuard(self):
            for wr in self.data.itervalues():
                yield wr
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def itervalues(self):
        with _IterationGuard(self):
            for wr in self.data.itervalues():
                obj = wr()
                if obj is not None:
                    yield obj
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def iteritems(self):
        with _IterationGuard(self):
            for wr, value in self.data.iteritems():
                key = wr()
                if key is not None:
                    yield key, value
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def iterkeys(self):
        with _IterationGuard(self):
            for wr in self.data.iterkeys():
                obj = wr()
                if obj is not None:
                    yield obj
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def itervalues(self):
        with _IterationGuard(self):
            for value in self.data.itervalues():
                yield value
项目:ivaochdoc    作者:ivaoch    | 项目源码 | 文件源码
def items(self):
        if self._pending_removals:
            self._commit_removals()
        with _IterationGuard(self):
            for k, wr in self.data.items():
                v = wr()
                if v is not None:
                    yield k, v
项目:ivaochdoc    作者:ivaoch    | 项目源码 | 文件源码
def keys(self):
        if self._pending_removals:
            self._commit_removals()
        with _IterationGuard(self):
            for k, wr in self.data.items():
                if wr() is not None:
                    yield k
项目:ivaochdoc    作者:ivaoch    | 项目源码 | 文件源码
def itervaluerefs(self):
        """Return an iterator that yields the weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        """
        if self._pending_removals:
            self._commit_removals()
        with _IterationGuard(self):
            yield from self.data.values()
项目:ivaochdoc    作者:ivaoch    | 项目源码 | 文件源码
def values(self):
        if self._pending_removals:
            self._commit_removals()
        with _IterationGuard(self):
            for wr in self.data.values():
                obj = wr()
                if obj is not None:
                    yield obj
项目:ivaochdoc    作者:ivaoch    | 项目源码 | 文件源码
def items(self):
        with _IterationGuard(self):
            for wr, value in self.data.items():
                key = wr()
                if key is not None:
                    yield key, value
项目:ivaochdoc    作者:ivaoch    | 项目源码 | 文件源码
def values(self):
        with _IterationGuard(self):
            for wr, value in self.data.items():
                if wr() is not None:
                    yield value
项目:Intranet-Penetration    作者:yuxiaokui    | 项目源码 | 文件源码
def iteritems(self):
        with _IterationGuard(self):
            for wr in self.data.itervalues():
                value = wr()
                if value is not None:
                    yield wr.key, value
项目:Intranet-Penetration    作者:yuxiaokui    | 项目源码 | 文件源码
def iterkeys(self):
        with _IterationGuard(self):
            for k in self.data.iterkeys():
                yield k
项目:Intranet-Penetration    作者:yuxiaokui    | 项目源码 | 文件源码
def itervaluerefs(self):
        """Return an iterator that yields the weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        """
        with _IterationGuard(self):
            for wr in self.data.itervalues():
                yield wr
项目:Intranet-Penetration    作者:yuxiaokui    | 项目源码 | 文件源码
def itervalues(self):
        with _IterationGuard(self):
            for wr in self.data.itervalues():
                obj = wr()
                if obj is not None:
                    yield obj
项目:Intranet-Penetration    作者:yuxiaokui    | 项目源码 | 文件源码
def iteritems(self):
        with _IterationGuard(self):
            for wr, value in self.data.iteritems():
                key = wr()
                if key is not None:
                    yield key, value
项目:Intranet-Penetration    作者:yuxiaokui    | 项目源码 | 文件源码
def iterkeys(self):
        with _IterationGuard(self):
            for wr in self.data.iterkeys():
                obj = wr()
                if obj is not None:
                    yield obj
项目:Intranet-Penetration    作者:yuxiaokui    | 项目源码 | 文件源码
def itervalues(self):
        with _IterationGuard(self):
            for value in self.data.itervalues():
                yield value
项目:MKFQ    作者:maojingios    | 项目源码 | 文件源码
def iteritems(self):
        with _IterationGuard(self):
            for wr in self.data.itervalues():
                value = wr()
                if value is not None:
                    yield wr.key, value
项目:MKFQ    作者:maojingios    | 项目源码 | 文件源码
def iterkeys(self):
        with _IterationGuard(self):
            for k in self.data.iterkeys():
                yield k
项目:MKFQ    作者:maojingios    | 项目源码 | 文件源码
def itervaluerefs(self):
        """Return an iterator that yields the weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        """
        with _IterationGuard(self):
            for wr in self.data.itervalues():
                yield wr
项目:MKFQ    作者:maojingios    | 项目源码 | 文件源码
def itervalues(self):
        with _IterationGuard(self):
            for wr in self.data.itervalues():
                obj = wr()
                if obj is not None:
                    yield obj
项目:MKFQ    作者:maojingios    | 项目源码 | 文件源码
def iteritems(self):
        with _IterationGuard(self):
            for wr, value in self.data.iteritems():
                key = wr()
                if key is not None:
                    yield key, value
项目:MKFQ    作者:maojingios    | 项目源码 | 文件源码
def iterkeys(self):
        with _IterationGuard(self):
            for wr in self.data.iterkeys():
                obj = wr()
                if obj is not None:
                    yield obj
项目:MKFQ    作者:maojingios    | 项目源码 | 文件源码
def itervalues(self):
        with _IterationGuard(self):
            for value in self.data.itervalues():
                yield value
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def items(self):
        with _IterationGuard(self):
            for k, wr in self.data.items():
                v = wr()
                if v is not None:
                    yield k, v
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def keys(self):
        with _IterationGuard(self):
            for k, wr in self.data.items():
                if wr() is not None:
                    yield k
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def itervaluerefs(self):
        """Return an iterator that yields the weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        """
        with _IterationGuard(self):
            for wr in self.data.values():
                yield wr
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def values(self):
        with _IterationGuard(self):
            for wr in self.data.values():
                obj = wr()
                if obj is not None:
                    yield obj
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def items(self):
        with _IterationGuard(self):
            for wr, value in self.data.items():
                key = wr()
                if key is not None:
                    yield key, value
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def values(self):
        with _IterationGuard(self):
            for wr, value in self.data.items():
                if wr() is not None:
                    yield value
项目:news-for-good    作者:thecodinghub    | 项目源码 | 文件源码
def items(self):
        with _IterationGuard(self):
            for k, wr in self.data.items():
                v = wr()
                if v is not None:
                    yield k, v
项目:news-for-good    作者:thecodinghub    | 项目源码 | 文件源码
def keys(self):
        with _IterationGuard(self):
            for k, wr in self.data.items():
                if wr() is not None:
                    yield k
项目:news-for-good    作者:thecodinghub    | 项目源码 | 文件源码
def itervaluerefs(self):
        """Return an iterator that yields the weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        """
        with _IterationGuard(self):
            yield from self.data.values()
项目:news-for-good    作者:thecodinghub    | 项目源码 | 文件源码
def values(self):
        with _IterationGuard(self):
            for wr in self.data.values():
                obj = wr()
                if obj is not None:
                    yield obj
项目:news-for-good    作者:thecodinghub    | 项目源码 | 文件源码
def items(self):
        with _IterationGuard(self):
            for wr, value in self.data.items():
                key = wr()
                if key is not None:
                    yield key, value
项目:news-for-good    作者:thecodinghub    | 项目源码 | 文件源码
def values(self):
        with _IterationGuard(self):
            for wr, value in self.data.items():
                if wr() is not None:
                    yield value
项目:Tencent_Cartoon_Download    作者:Fretice    | 项目源码 | 文件源码
def items(self):
        with _IterationGuard(self):
            for k, wr in self.data.items():
                v = wr()
                if v is not None:
                    yield k, v
项目:Tencent_Cartoon_Download    作者:Fretice    | 项目源码 | 文件源码
def keys(self):
        with _IterationGuard(self):
            for k, wr in self.data.items():
                if wr() is not None:
                    yield k
项目:Tencent_Cartoon_Download    作者:Fretice    | 项目源码 | 文件源码
def itervaluerefs(self):
        """Return an iterator that yields the weak references to the values.

        The references are not guaranteed to be 'live' at the time
        they are used, so the result of calling the references needs
        to be checked before being used.  This can be used to avoid
        creating references that will cause the garbage collector to
        keep the values around longer than needed.

        """
        with _IterationGuard(self):
            yield from self.data.values()
项目:Tencent_Cartoon_Download    作者:Fretice    | 项目源码 | 文件源码
def values(self):
        with _IterationGuard(self):
            for wr in self.data.values():
                obj = wr()
                if obj is not None:
                    yield obj
项目:Tencent_Cartoon_Download    作者:Fretice    | 项目源码 | 文件源码
def items(self):
        with _IterationGuard(self):
            for wr, value in self.data.items():
                key = wr()
                if key is not None:
                    yield key, value