kuai.backends package

Submodules

kuai.backends.priority module

kuai.backends.priority.setup(app)[source]

kuai.backends.simple module

kuai.backends.simple.setup(app)[source]

kuai.backends.threaded module

kuai.backends.threaded.setup(app)[source]

Module contents

kuai.backends.set_backend(name)[source]
kuai.backends.which_backend()[source]
class kuai.backends.WeakCallback(callback)[source]

Bases: object

A Weak Callback object that will keep a reference to the connecting object with weakref semantics.

This allows object A to pass a callback method to object S, without object S keeping A alive. **Extended to work with unbound calls, ie: functions, lambdas..

class kuai.backends.Singleton[source]

Bases: type

Metaclass for singleton objects. Any instantiation of a Singleton class yields the exact same object, e.g.:

>>> class MyClass(metaclass=Singleton):
        pass
>>> a = MyClass()
>>> b = MyClass()
>>> a is b
True
kuai.backends.singleton_object(cls)[source]

Class decorator that transforms (and replaces) a class definition (which must have a Singleton metaclass) with the actual singleton object. Ensures that the resulting object can still be “instantiated” (i.e., called), returning the same object. Also ensures the object can be pickled, is hashable, and has the correct string representation (the name of the singleton)