b3j0f.annotation.oop module¶
Annotations dedicated to object oriented programming.
-
class
b3j0f.annotation.oop.Transform(name=None, bases=None, _dict=None, update=True, *args, **kwargs)[source]¶ Bases:
b3j0f.annotation.core.AnnotationTransform a class into an annotation or something else if parameters are different.
-
BASES= 'bases'¶
-
DICT= 'dict'¶
-
NAME= 'name'¶
-
UPDATE= 'update'¶
-
bases¶
-
dict¶
-
name¶
-
override¶
-
propagate¶
-
targets¶
-
update¶
-
-
class
b3j0f.annotation.oop.Mixin(classes=(), *attributes, **named_attributes)[source]¶ Bases:
b3j0f.annotation.core.AnnotationAnnotation which enrichs a target with Mixin.
For every defined mixin, a private couple of (name, array of mixed items) is created into the target in order to go back in a no mixin state.
-
exception
MixInError[source]¶ Bases:
exceptions.ExceptionRaised for any Mixin error.
-
static
Mixin.get_mixedins_by_name(target)[source]¶ Get a set of couple (name, field) of target mixedin.
-
static
Mixin.mixin(target, resource, name=None)[source]¶ Do the correct mixin depending on the type of input resource.
- Method or Function: mixin_function_or_method.
- class: mixin_class.
- other: set_mixin.
And returns the result of the choosen method (one or a list of mixins).
-
static
Mixin.mixin_function_or_method(target, routine, name=None, isbound=False)[source]¶ Mixin a routine into the target.
Parameters:
-
static
Mixin.remove_mixin(target, name, mixedin=None, replace=True)[source]¶ Remove a mixin with name (and reference) from targetand returns the replaced one or None.
Parameters: - mixedin – a mixedin value or the last defined mixedin if is None (by default).
- replace (bool) – If True (default), the removed mixedin replaces the current mixin.
-
static
Mixin.remove_mixins(target)[source]¶ Tries to get back target in a no mixin consistent state.
-
exception
-
class
b3j0f.annotation.oop.Deprecated(*args, **kwargs)[source]¶ Bases:
b3j0f.annotation.interception.PrivateInterceptorDecorator which can be used to mark functions as deprecated. It will result in a warning being emitted when the function is used.
-
class
b3j0f.annotation.oop.Singleton(*args, **kwargs)[source]¶ Bases:
b3j0f.annotation.core.AnnotationTransforms cls into a singleton.
Reference to cls, or to any instance is the same reference.
-
class
b3j0f.annotation.oop.MethodMixin(function, *args, **kwargs)[source]¶ Bases:
b3j0f.annotation.core.AnnotationApply a mixin on a method.