Decorators dedicated to class or functions calls.
Bases: b3j0f.annotation.interception.PrivateInterceptor
Check routine parameters and return type.
parameter types attribute name
return type attribute name
Bases: exceptions.Exception
Bind self annotation to target.
Parameters: |
|
---|---|
Returns: | bound target. |
Quick alias for the Types Annotation with only args and kwargs parameters.
args may contain rtype and kwargs is ptypes.
Bases: b3j0f.annotation.interception.PrivateInterceptor
Annotation that returns a function that keeps returning functions until all arguments are supplied; then the original function is evaluated.
Inspirated from Jeff Laughlin Consulting LLC projects.
args attribute name
Bases: object
Curried result in case of missing arguments.
default args attribute name
default kwargs attribute name
kwargs attribute name
Bases: b3j0f.annotation.interception.PrivateInterceptor
Function decorator implementing retrying logic.
delay: Sleep this many seconds * backoff * try number after failure backoff: Multiply delay by this factor after each failure exceptions: A tuple of exception classes; default (Exception,) hook: A function with the signature myhook(tries_remaining, exception); default None.
The decorator will call the function up to max_tries times if it raises an exception.
By default it catches instances of the Exception class and subclasses. This will recover after all but the most fatal errors. You may specify a custom tuple of exception classes with the ‘exceptions’ argument; the function will only be retried if it raises one of the specified exceptions.
Additionally you may specify a hook function which will be called prior to retrying with the number of remaining tries and the exception instance; see given example. This is primarily intended to give the opportunity to log the failure. Hook is not called after failure if no retries remain.