annotations.manager

annotations.manager

Classes

Name Description
BaseAnnotationManager Base class for Annotation Manager

BaseAnnotationManager

annotations.manager.BaseAnnotationManager(self, entity)

Base class for Annotation Manager

This is the base class for the Annotation Manager, which manages all the annotation classes, instances and interfaces

Entities that need annotation support have to derive from this base class and set the class attribute _entity_type to the entity tpye, the class attribute ’_classes’ and instance attribute ’_interfaces’ to empty dictionaries. Derived classes will have to pass the entity instance as part of its ‘init’ as well.

Attributes

Name Type Description
visible bool Whether to show or hide all annotations

Methods

Name Description
clear Remove all annotations
get Get an annotation by name
register Register an annotation class
remove Remove an annotation by name or instance
unregister Unregister a registered annotation class
clear
annotations.manager.BaseAnnotationManager.clear()

Remove all annotations

get
annotations.manager.BaseAnnotationManager.get(name)

Get an annotation by name

register
annotations.manager.BaseAnnotationManager.register(annotation_class)

Register an annotation class

This method adds the annotation class to the entity specific class registry (classes) and adds a new method (add) to the manager with a signature that matches the annotation inputs.

remove
annotations.manager.BaseAnnotationManager.remove(annotation)

Remove an annotation by name or instance

When a name is used, all annotations that match the name will be removed

unregister
annotations.manager.BaseAnnotationManager.unregister(annotation_class)

Unregister a registered annotation class

This method removes the annotation class from the entity speicific class registry and removes the ‘add_<>’ method from the manager