Some decorator implementations.
Property descriptor that caches the return value of the get function.
Examples
@cached_property
def connection(self):
return Connection()
@connection.setter # Prepares stored value
def connection(self, value):
if value is None:
raise TypeError('Connection must be a connection')
return value
@connection.deleter
def connection(self, value):
# Additional action to do at del(self.attr)
if value is not None:
print('Connection %r deleted' % (value, ))
Execute cleanup handlers when objects go out of scope.
Taken from multiprocessing.util.Finalize.
copyright: |
|
---|---|
license: | BSD, see LICENSE for more details. |
Get the real Python module, regardless of any monkeypatching
Import module, but make sure it finds modules located in the current directory.
Modules located in the current directory has precedence over modules located in sys.path.
Instantiate class by name.
See symbol_by_name().
Get symbol by qualified name.
The name should be the full dot-separated path to the class:
modulename.ClassName
Example:
celery.concurrency.processes.TaskPool
^- class name
or using ‘:’ to separate module and symbol:
celery.concurrency.processes:TaskPool
If aliases is provided, a dict containing short name/long name mappings, the name is looked up in the aliases first.
Examples:
>>> symbol_by_name("celery.concurrency.processes.TaskPool") <class 'celery.concurrency.processes.TaskPool'>>>> symbol_by_name("default", { ... "default": "celery.concurrency.processes.TaskPool"}) <class 'celery.concurrency.processes.TaskPool'># Does not try to look up non-string names. >>> from celery.concurrency.processes import TaskPool >>> symbol_by_name(TaskPool) is TaskPool True
Execute some function in loop and wait for answer.
Bases: object
Mutable that store result.
Specify default timeout for delegation decorators.
Some useful mixins here.
Bases: object
Move loop closer to instance.
Bases: object
Implement some stubs method for object that can be started / stopped.
Bases: object
Subclass an app-compatible class by setting its app attribute to be this app instance.
App-compatible means that the class has a class attribute that provides the default app it should use, e.g. class Foo: app = None.
Parameters: |
|
---|
Some other useful tools.
Get addresses from pool.
Parts of this module is Copyright by Werkzeug Team.