b3j0f.annotation.check module

Interceptors dedicated to decorate decorations.

class b3j0f.annotation.check.Condition(pre_cond=None, post_cond=None, *args, **kwargs)[source]

Bases: b3j0f.annotation.interception.PrivateInterceptor

Apply a pre/post condition on an annotated element call.

exception ConditionError[source]

Bases: exceptions.Exception

Handle condition errors

Condition.POST_COND = 'post_cond'

post condition attribute name

Condition.PRE_COND = 'pre_cond'

pre condition attribute name

exception Condition.PostConditionError[source]

Bases: b3j0f.annotation.check.ConditionError

Handle post condition errors

exception Condition.PreConditionError[source]

Bases: b3j0f.annotation.check.ConditionError

Handle pre condition errors

Condition.RESULT = 'result'

result attribute name

Condition.enable
Condition.interception
Condition.override
Condition.post_cond
Condition.pre_cond
Condition.propagate
Condition.targets
class b3j0f.annotation.check.MaxCount(count=1, *args, **kwargs)[source]

Bases: b3j0f.annotation.check.AnnotationChecker

Set a maximum count of target instantiation by annotated element.

DEFAULT_COUNT = 1
exception Error[source]

Bases: exceptions.Exception

MaxCount.bind_target(target, ctx=None)

Bind self annotation to target.

Parameters:
  • target – target to annotate.
  • ctx – target ctx.
Returns:

bound target.

MaxCount.count
MaxCount.enable
MaxCount.interception
MaxCount.override
MaxCount.propagate
MaxCount.targets
class b3j0f.annotation.check.Target(types=None, rule='or', instances=False, *args, **kwargs)[source]

Bases: b3j0f.annotation.check.AnnotationChecker

Check type of all decorated elements by this decorated Annotation in using a list of types.

This list of types is checked related to logical rules such as OR and AND.

  • OR: true if at least one type is checked.
  • AND: true if all types are checked.
AND = 'and'

and rule

CALLABLE()

callable type

DEFAULT_INSTANCES = False

default instances condition

DEFAULT_RULE = 'or'

default rule

exception Error[source]

Bases: exceptions.Exception

Target.FUNC

function type

alias of function

Target.INSTANCES = 'instances'
Target.OR = 'or'

or rule

Target.ROUTINE = 'routine'

routine type

Target.RULE = 'rule'
Target.TYPES = 'types'
Target.bind_target(target, ctx=None)

Bind self annotation to target.

Parameters:
  • target – target to annotate.
  • ctx – target ctx.
Returns:

bound target.

Target.enable
Target.instances
Target.interception
Target.override
Target.propagate
Target.rule
Target.targets
Target.types

Previous topic

b3j0f.annotation.call module

Next topic

b3j0f.annotation.core module

This Page