Did I find the right examples for you? yes no

All Samples(9)  |  Call(6)  |  Derive(0)  |  Import(3)
Decorator to lock and unlock a method (Phillip J. Eby).

:argument func: method to decorate

        def synchronized(func):
    '''
    Decorator to lock and unlock a method (Phillip J. Eby).

    :argument func: method to decorate
    '''
    def wrapper(self, *__args, **__kw):
        self._lock.acquire()
        try:
            return func(self, *__args, **__kw)
        finally:
            self._lock.release()
    wrapper.__name__ = func.__name__
    wrapper.__dict__ = func.__dict__
    wrapper.__doc__ = func.__doc__
    return wrapper
        


src/s/h/shove-0.5.6/shove/store.py   shove(Download)
 
from shove.base import Mapping, FileBase
from shove._compat import anydbm, synchronized, url2pathname
 
__all__ = 'DBMStore FileStore MemoryStore SimpleStore'.split()
        return deepcopy(super(MemoryStore, self).__getitem__(key))
 
    __setitem__ = synchronized(SimpleStore.__setitem__)
    __delitem__ = synchronized(SimpleStore.__delitem__)
 

src/s/h/shove-0.5.6/shove/cache.py   shove(Download)
from threading import Condition
 
from shove._compat import synchronized
from shove.base import Mapping, FileBase
 
        return deepcopy(super(MemoryCache, self).__getitem__(key))
 
    __setitem__ = synchronized(SimpleCache.__setitem__)
    __delitem__ = synchronized(SimpleCache.__delitem__)
 
        return deepcopy(super(MemoryLRUCache, self).__getitem__(key))
 
    __setitem__ = synchronized(SimpleLRUCache.__setitem__)
    __delitem__ = synchronized(SimpleLRUCache.__delitem__)
 

src/s/h/shove-0.5.6/shove/stores/bsdb.py   shove(Download)
 
from shove.store import SyncStore
from shove._compat import synchronized
 
__all__ = ['BSDBStore']