當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。