本文整理匯總了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
示例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
示例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
示例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
示例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
示例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
示例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
示例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
示例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()
示例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
示例11: iterkeys
# 需要導入模塊: import _weakrefset [as 別名]
# 或者: from _weakrefset import _IterationGuard [as 別名]
def iterkeys(self):
with _IterationGuard(self):
for k in self.data.iterkeys():
yield k
示例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
示例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
示例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
示例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