b3j0f.annotation.async module

Decorators dedicated to asynchronous programming.

class b3j0f.annotation.async.Asynchronous(on_bind_target=None, propagate=True, override=False, ttl=None, in_memory=False)[source]

Bases: b3j0f.annotation.core.Annotation

Transform a target into an asynchronous callable target.

exception NotYetDoneException[source]

Bases: exceptions.Exception

class Asynchronous.Result(queue, thread)[source]

Bases: object

get_result(wait=-1)[source]
is_done()[source]
queue
thread
Asynchronous.on_bind_target(target)[source]
Asynchronous.start(*args, **kwargs)[source]
Asynchronous.threaded(*args, **kwargs)[source]
class b3j0f.annotation.async.Observable[source]

Bases: b3j0f.annotation.interception.PrivateInterceptor

Imlementation of the observer design pattern. It transforms a target into an observable object in adding method registerObserver, unregisterObserver and notify_observers. Observers listen to pre/post target interception.

notify_observers(target, args, kwargs, result=None, post=False)[source]

Notify observers with parameter calls and information about pre/post call.

on_bind_target(target)[source]
registerObserver(observer)[source]

Register an observer.

unregisterObserver(observer)[source]

Unregister an observer.

class b3j0f.annotation.async.Synchronized(lock=None, *args, **kwargs)[source]

Bases: b3j0f.annotation.interception.PrivateInterceptor

Transform a target into a thread safe target.

enable
interception
override
propagate
targets
class b3j0f.annotation.async.SynchronizedClass(lock=None, *args, **kwargs)[source]

Bases: b3j0f.annotation.async.Synchronized

Transform a class into a thread safe class.

on_bind_target(target)[source]
class b3j0f.annotation.async.TimeOut(seconds, error_message='Call of {0} with parameters {1} and {2} is timed out', *args, **kwargs)[source]

Bases: b3j0f.annotation.interception.PrivateInterceptor

Raise an Exception if the target call has not finished in time.

ERROR_MESSAGE = 'error_message'
SECONDS = 'seconds'
exception TimeOutError(timeout_interceptor, frame)[source]

Bases: exceptions.Exception

Exception thrown if time elapsed before the end of the target call.

DEFAULT_MESSAGE = 'Call of {0} with parameters {1} and {2} is timed out'
TimeOut.enable
TimeOut.error_message
TimeOut.interception
TimeOut.override
TimeOut.propagate
TimeOut.seconds
TimeOut.targets
class b3j0f.annotation.async.Wait(before=1, after=1, *args, **kwargs)[source]

Bases: b3j0f.annotation.interception.PrivateInterceptor

Define a time to wait before and after a target call.

AFTER = 'after'

after attribute name

BEFORE = 'before'

before attribute name

DEFAULT_WAIT = 1
after
before
enable
interception
override
propagate
targets

Previous topic

b3j0f.annotation.test.oop module

Next topic

b3j0f.annotation.call module

This Page