Python _weakrefset._IterationGuard() Examples

The following are 30 code examples of _weakrefset._IterationGuard(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module _weakrefset , or try the search function .
Example #1
Source File: weakref.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def values(self):
        with _IterationGuard(self):
            for wr, value in self.data.items():
                if wr() is not None:
                    yield value 
Example #2
Source File: weakref.py    From unity-python with MIT License 5 votes vote down vote up
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 
Example #3
Source File: weakref.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def iterkeys(self):
        with _IterationGuard(self):
            for k in self.data.iterkeys():
                yield k 
Example #4
Source File: weakref.py    From unity-python with MIT License 5 votes vote down vote up
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 
Example #5
Source File: weakref.py    From unity-python with MIT License 5 votes vote down vote up
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 
Example #6
Source File: weakref.py    From unity-python with MIT License 5 votes vote down vote up
def iterkeys(self):
        if self._pending_removals:
            self._commit_removals()
        with _IterationGuard(self):
            for k in self.data.iterkeys():
                yield k 
Example #7
Source File: weakref.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def iterkeys(self):
        with _IterationGuard(self):
            for wr in self.data.iterkeys():
                obj = wr()
                if obj is not None:
                    yield obj 
Example #8
Source File: weakref.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def iteritems(self):
        with _IterationGuard(self):
            for wr, value in self.data.iteritems():
                key = wr()
                if key is not None:
                    yield key, value 
Example #9
Source File: weakref.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def itervalues(self):
        with _IterationGuard(self):
            for wr in self.data.itervalues():
                obj = wr()
                if obj is not None:
                    yield obj 
Example #10
Source File: weakref.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
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 
Example #11
Source File: weakref.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def itervalues(self):
        with _IterationGuard(self):
            for value in self.data.itervalues():
                yield value 
Example #12
Source File: weakref.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def itervalues(self):
        with _IterationGuard(self):
            for wr in self.data.itervalues():
                obj = wr()
                if obj is not None:
                    yield obj 
Example #13
Source File: weakref.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
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 
Example #14
Source File: weakref.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def iterkeys(self):
        with _IterationGuard(self):
            for k in self.data.iterkeys():
                yield k 
Example #15
Source File: weakref.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def iteritems(self):
        with _IterationGuard(self):
            for wr in self.data.itervalues():
                value = wr()
                if value is not None:
                    yield wr.key, value 
Example #16
Source File: weakref.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def iteritems(self):
        with _IterationGuard(self):
            for wr, value in self.data.iteritems():
                key = wr()
                if key is not None:
                    yield key, value 
Example #17
Source File: weakref.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def items(self):
        with _IterationGuard(self):
            for wr, value in self.data.items():
                key = wr()
                if key is not None:
                    yield key, value 
Example #18
Source File: weakref.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def values(self):
        with _IterationGuard(self):
            for wr in self.data.values():
                obj = wr()
                if obj is not None:
                    yield obj 
Example #19
Source File: weakref.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
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() 
Example #20
Source File: weakref.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def keys(self):
        with _IterationGuard(self):
            for k, wr in self.data.items():
                if wr() is not None:
                    yield k 
Example #21
Source File: weakref.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def items(self):
        with _IterationGuard(self):
            for k, wr in self.data.items():
                v = wr()
                if v is not None:
                    yield k, v 
Example #22
Source File: weakref.py    From scylla with Apache License 2.0 5 votes vote down vote up
def values(self):
        with _IterationGuard(self):
            for wr, value in self.data.items():
                if wr() is not None:
                    yield value 
Example #23
Source File: weakref.py    From scylla with Apache License 2.0 5 votes vote down vote up
def items(self):
        with _IterationGuard(self):
            for wr, value in self.data.items():
                key = wr()
                if key is not None:
                    yield key, value 
Example #24
Source File: weakref.py    From scylla with Apache License 2.0 5 votes vote down vote up
def values(self):
        with _IterationGuard(self):
            for wr in self.data.values():
                obj = wr()
                if obj is not None:
                    yield obj 
Example #25
Source File: weakref.py    From scylla with Apache License 2.0 5 votes vote down vote up
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() 
Example #26
Source File: weakref.py    From scylla with Apache License 2.0 5 votes vote down vote up
def keys(self):
        with _IterationGuard(self):
            for k, wr in self.data.items():
                if wr() is not None:
                    yield k 
Example #27
Source File: weakref.py    From scylla with Apache License 2.0 5 votes vote down vote up
def items(self):
        with _IterationGuard(self):
            for k, wr in self.data.items():
                v = wr()
                if v is not None:
                    yield k, v 
Example #28
Source File: weakref.py    From Imogen with MIT License 5 votes vote down vote up
def values(self):
        with _IterationGuard(self):
            for wr, value in self.data.items():
                if wr() is not None:
                    yield value 
Example #29
Source File: weakref.py    From Imogen with MIT License 5 votes vote down vote up
def items(self):
        with _IterationGuard(self):
            for wr, value in self.data.items():
                key = wr()
                if key is not None:
                    yield key, value 
Example #30
Source File: weakref.py    From Imogen with MIT License 5 votes vote down vote up
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