python_project_template_AS.registry#
Operation registry used to register and lookup operations by name.
The OperationRegistry is intentionally minimal: register operations,
retrieve them by name, list registered names, and update from another
registry. It raises RegistryError for lookup/registration problems.
Classes
A simple name->Operation registry. |
- class python_project_template_AS.registry.OperationRegistry[source]#
Bases:
objectA simple name->Operation registry.
Example
reg = OperationRegistry() reg.register(Operation(‘add’, func, arity=2)) op = reg.get(‘add’)
- get(name)[source]#
Return a registered Operation by name.
- Raises:
RegistryError – if the name is unknown.
- Return type:
- Parameters:
name (str)
- register(op, *, replace=False)[source]#
Register an
Operation.- Parameters:
op (
Operation) – operation instance to register.replace (
bool) – if False (default) raise on duplicate names.
- Return type:
None
- update(other)[source]#
Update the registry with operations from another registry.
- Return type:
None- Parameters:
other (OperationRegistry)