当前位置: 首页>>代码示例>>Python>>正文


Python _weakrefset._IterationGuard方法代码示例

本文整理汇总了Python中_weakrefset._IterationGuard方法的典型用法代码示例。如果您正苦于以下问题:Python _weakrefset._IterationGuard方法的具体用法?Python _weakrefset._IterationGuard怎么用?Python _weakrefset._IterationGuard使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在_weakrefset的用法示例。


在下文中一共展示了_weakrefset._IterationGuard方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: items

# 需要导入模块: import _weakrefset [as 别名]
# 或者: from _weakrefset import _IterationGuard [as 别名]
def items(self):
        with _IterationGuard(self):
            for k, wr in self.data.items():
                v = wr()
                if v is not None:
                    yield k, v 
开发者ID:war-and-code,项目名称:jawfish,代码行数:8,代码来源:weakref.py

示例2: keys

# 需要导入模块: import _weakrefset [as 别名]
# 或者: from _weakrefset import _IterationGuard [as 别名]
def keys(self):
        with _IterationGuard(self):
            for k, wr in self.data.items():
                if wr() is not None:
                    yield k 
开发者ID:war-and-code,项目名称:jawfish,代码行数:7,代码来源:weakref.py

示例3: itervaluerefs

# 需要导入模块: import _weakrefset [as 别名]
# 或者: from _weakrefset import _IterationGuard [as 别名]
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 
开发者ID:war-and-code,项目名称:jawfish,代码行数:15,代码来源:weakref.py

示例4: values

# 需要导入模块: import _weakrefset [as 别名]
# 或者: from _weakrefset import _IterationGuard [as 别名]
def values(self):
        with _IterationGuard(self):
            for wr in self.data.values():
                obj = wr()
                if obj is not None:
                    yield obj 
开发者ID:war-and-code,项目名称:jawfish,代码行数:8,代码来源:weakref.py

示例5: iteritems

# 需要导入模块: import _weakrefset [as 别名]
# 或者: from _weakrefset import _IterationGuard [as 别名]
def iteritems(self):
        if self._pending_removals:
            self._commit_removals()
        with _IterationGuard(self):
            for wr in self.data.itervalues():
                value = wr()
                if value is not None:
                    yield wr.key, value 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:weakref.py

示例6: iterkeys

# 需要导入模块: import _weakrefset [as 别名]
# 或者: from _weakrefset import _IterationGuard [as 别名]
def iterkeys(self):
        if self._pending_removals:
            self._commit_removals()
        with _IterationGuard(self):
            for k in self.data.iterkeys():
                yield k 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:8,代码来源:weakref.py

示例7: itervaluerefs

# 需要导入模块: import _weakrefset [as 别名]
# 或者: from _weakrefset import _IterationGuard [as 别名]
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):
            for wr in self.data.itervalues():
                yield wr 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:17,代码来源:weakref.py

示例8: itervalues

# 需要导入模块: import _weakrefset [as 别名]
# 或者: from _weakrefset import _IterationGuard [as 别名]
def itervalues(self):
        if self._pending_removals:
            self._commit_removals()
        with _IterationGuard(self):
            for wr in self.data.itervalues():
                obj = wr()
                if obj is not None:
                    yield obj 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:weakref.py

示例9: itervaluerefs

# 需要导入模块: import _weakrefset [as 别名]
# 或者: from _weakrefset import _IterationGuard [as 别名]
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() 
开发者ID:awemulya,项目名称:kobo-predict,代码行数:14,代码来源:weakref.py

示例10: iteritems

# 需要导入模块: import _weakrefset [as 别名]
# 或者: from _weakrefset import _IterationGuard [as 别名]
def iteritems(self):
        with _IterationGuard(self):
            for wr in self.data.itervalues():
                value = wr()
                if value is not None:
                    yield wr.key, value 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:8,代码来源:weakref.py

示例11: iterkeys

# 需要导入模块: import _weakrefset [as 别名]
# 或者: from _weakrefset import _IterationGuard [as 别名]
def iterkeys(self):
        with _IterationGuard(self):
            for k in self.data.iterkeys():
                yield k 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:6,代码来源:weakref.py

示例12: itervaluerefs

# 需要导入模块: import _weakrefset [as 别名]
# 或者: from _weakrefset import _IterationGuard [as 别名]
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 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:15,代码来源:weakref.py

示例13: itervalues

# 需要导入模块: import _weakrefset [as 别名]
# 或者: from _weakrefset import _IterationGuard [as 别名]
def itervalues(self):
        with _IterationGuard(self):
            for wr in self.data.itervalues():
                obj = wr()
                if obj is not None:
                    yield obj 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:8,代码来源:weakref.py

示例14: items

# 需要导入模块: import _weakrefset [as 别名]
# 或者: from _weakrefset import _IterationGuard [as 别名]
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 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:10,代码来源:weakref.py

示例15: keys

# 需要导入模块: import _weakrefset [as 别名]
# 或者: from _weakrefset import _IterationGuard [as 别名]
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 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:9,代码来源:weakref.py


注:本文中的_weakrefset._IterationGuard方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。