def __delitem__(self, key): try: self.sync() except AttributeError: pass exhaustmap(methodcaller("__delitem__", key), self._stores) try: del self._cache[key] except KeyError: pass
def __delitem__(self, key): try: self.sync() except AttributeError: pass exhaustmap(methodcaller('__delitem__', key), self._stores) try: del self._cache[key] except KeyError: pass
def sync(self): """Writes buffer to stores.""" exhaustmap(methodcaller("update", self._buffer), self._stores) self._buffer.clear()
def sync(self): '''Writes buffer to stores.''' exhaustmap(methodcaller('update', self._buffer), self._stores) self._buffer.clear()
def test_exhaustmap(self): from stuf import exhaustmap deferred = exhaustmap(lambda x: x + x, iter([1, 2, 3]), StopIteration) self.assertIsNone(deferred)