jgdv.decorators.mixin
Classes
TODO A Decorator for annotating a class with mixins |
|
Decorator to App/Prepend Mixins into the decorated class. |
|
TODO The trigger for delayed mixins. |
Module Contents
- class jgdv.decorators.mixin.DelayMixin(keys, **kwargs)[source]
Bases:
jgdv.decorators._core.DataDecTODO A Decorator for annotating a class with mixins
Delays the construction of the True class until later, using @MixinNow
- class jgdv.decorators.mixin.Mixin(
- *mixins,
- allow_inheritance=False,
- silent=False,
Bases:
jgdv.decorators._core.MonotonicDecDecorator to App/Prepend Mixins into the decorated class.
Converts:
class ClsName(mixins, Supers, Protocols, metaclass=MCls, **kwargs):...
into:
@Protocols(*ps) @Mixin(*ms, None) class ClsName(Supers): ...
(‘None’ is used to separate pre and post mixins)
- _build_annotations_h(target, current) <Unknown>[source]
Given a list of the current annotation list, return its replacement
- _validate_target_h(
- target,
- form,
- args=None,
Abstract class for specialization. Given the original target, throw an error here if it isn’t ‘correct’ in some way
- Parameters:
target (jgdv.decorators._interface.Decorable)
args (jgdv.Maybe[list])
- Return type:
None
- _wrap_class_h(cls) <Unknown>[source]
Override this to decorate a class
- Parameters:
cls (jgdv.decorators._interface.Decorable)
- Return type:
jgdv.decorators._interface.Decorated
- __builder: ClassVar[jgdv.mixins.annotate.Subclasser]
- _name_mod = 'M'
- _silent = False
- needs_args = True
- class jgdv.decorators.mixin.MixinNow(
- *args,
- prefix=None,
- mark=None,
- data=None,
Bases:
jgdv.decorators._core.MonotonicDecTODO The trigger for delayed mixins.
After using @DelayMixin, trigger the True class using this.
eg:
@MixinNow @DelayMixin(m3, None, m4) @DelayMixin(m1, m2) class Blah:...