b3j0f.annotation.async module¶
Decorators dedicated to asynchronous programming.
-
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.
-
class
b3j0f.annotation.async.
Asynchronous
(*args, **kwargs)[source]¶ Bases:
b3j0f.annotation.core.Annotation
Transform a target into an asynchronous callable target.
-
exception
NotYetDoneException
[source]¶ Bases:
exceptions.Exception
Handle when a result is not yet available.
-
exception
-
class
b3j0f.annotation.async.
TimeOut
(seconds, error_message='Call of {0} with parameters {1} and {2} is timed out in frame {3}', *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 in frame {3}'¶ Default time out error message.
-
-
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_AFTER
= 1¶ default seconds to wait after the target call.
-
DEFAULT_BEFORE
= 1¶ default seconds to wait before the target call.
-
after
¶
-
before
¶
-
enable
¶
-
interception
¶
-
override
¶
-
propagate
¶
-
targets
¶
-
-
class
b3j0f.annotation.async.
Observable
(*args, **kwargs)[source]¶ Bases:
b3j0f.annotation.interception.PrivateInterceptor
Imlementation of the observer design pattern.
It transforms a target into an observable object in adding method register_observer, unregister_observer and notify_observers. Observers listen to pre/post target interception.