ulauncher.util.decorator package


ulauncher.util.decorator.alias module


see http://www.drdobbs.com/web-development/184406073#l9

ulauncher.util.decorator.debounce module


Decorator that will postpone a functions execution until after wait seconds have elapsed since the last time it was invoked.

ulauncher.util.decorator.lru_cache module

Full-featured O(1) LRU cache backported from Python3.3.

The full Py3.3 API is supported (thread safety, maxsize, keyword args, type checking, __wrapped__, and cache_info). Includes Py3.3 optimizations for better memory utilization, fewer dependencies, and fewer dict lookups.

ulauncher.util.decorator.lru_cache.lru_cache(maxsize=100, typed=False)

Least-recently-used cache decorator.

If maxsize is set to None, the LRU features are disabled and the cache can grow without bound.

If typed is True, arguments of different types will be cached separately. For example, f(3.0) and f(3) will be treated as distinct calls with distinct results.

Arguments to the cached function must be hashable.

View the cache statistics named tuple (hits, misses, maxsize, currsize) with f.cache_info(). Clear the cache and statistics with f.cache_clear(). Access the underlying function with f.__wrapped__.

See: http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used

ulauncher.util.decorator.run_async module

ulauncher.util.decorator.run_async.run_async(*args, **kwargs)

Function decorator, intended to make “func” run in a new thread (asynchronously).

Return type:threading.Thread


>>> @run_async
>>> def task1():
>>>     do_something
>>> @run_async(daemon=True)
>>> def task2():
>>>     do_something_too
>>> t1 = task1()
>>> t2 = task2()
>>> ...
>>> t1.join()
>>> t2.join()

ulauncher.util.decorator.singleton module


Decorator function. Call to a decorated function always returns the same instance

Note: it doesn’t take into account args and kwargs when looks up a saved instance Call a decorated function with spawn=True in order to get a new instance

Module contents