registry ¶
A common basic registry object for all type of classes.
This registry can add a class to the registry either by using metaclass=BaseRegistry in a new object or using the wrapper function as a header @BaseRegistry.register(name)
Classes:
-
AbstractRegistry–Abstract class for registry.
-
BaseRegistry–A generic registry implementation.
AbstractRegistry ¶
Bases: ABCMeta
Abstract class for registry.
A registry registers and manage classes.
THIS CLASS SHOULD NOT BE CALLED DIRECTLY. USE THE ADAPTED CLASS INHERITING FROM IT.
REIMPLEMENT THE FUNCTION save_class in the children to change the behaviour
Methods:
-
register–wrapper to register a class.
-
get–returns the class by given name.
-
all–returns all registered classes.
all classmethod ¶
Return all the saved classes.
Source code in src/stimulus/core/registry.py
79 80 81 82 | |
get classmethod ¶
Returns the saved classe with a given name as key.
Source code in src/stimulus/core/registry.py
74 75 76 77 | |
register classmethod ¶
Function using a wrapper to register the given class with a specific name.
Source code in src/stimulus/core/registry.py
60 61 62 63 64 65 66 67 68 69 70 71 72 | |
save_class classmethod ¶
Saves the class and the given name in the registry.
Source code in src/stimulus/core/registry.py
49 50 51 52 53 54 55 56 57 58 | |
BaseRegistry ¶
Bases: AbstractRegistry
A generic registry implementation.
type is necessary to be registered as a metaclass.
registry-subclasses.¶
Source: https: // charlesreid1.github.io/python-patterns-the-registry.html
Methods:
-
all–Return all the saved classes.
-
get–Returns the saved classe with a given name as key.
-
register–Function using a wrapper to register the given class with a specific name.
-
save_class–Saves the class and the given name in the registry.
all classmethod ¶
Return all the saved classes.
Source code in src/stimulus/core/registry.py
79 80 81 82 | |
get classmethod ¶
Returns the saved classe with a given name as key.
Source code in src/stimulus/core/registry.py
74 75 76 77 | |
register classmethod ¶
Function using a wrapper to register the given class with a specific name.
Source code in src/stimulus/core/registry.py
60 61 62 63 64 65 66 67 68 69 70 71 72 | |
save_class classmethod ¶
Saves the class and the given name in the registry.
Source code in src/stimulus/core/registry.py
49 50 51 52 53 54 55 56 57 58 | |