ExtensionRegistry#
- class hugr.ext.ExtensionRegistry(extensions: dict[ExtensionId, Extension] = <factory>)[source]#
Bases:
object
Registry of extensions.
Methods
Add an extension to the registry.
Retrieve an extension by name.
Attributes
Extensions in the registry, indexed by name.
- exception ExtensionExists(extension_id: ExtensionId)[source]#
Bases:
Exception
Extension already exists in registry.
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception ExtensionNotFound(extension_id: ExtensionId)[source]#
Bases:
Exception
Extension not found in registry.
- with_traceback()#
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- add_extension(extension: Extension) Extension [source]#
Add an extension to the registry.
- Parameters:
extension – The extension to add.
- Returns:
The added extension.
- Raises:
ExtensionExists – If an extension with the same name already exists.
- get_extension(name: ExtensionId) Extension [source]#
Retrieve an extension by name.
- Parameters:
name – The name of the extension.
- Returns:
Extension in the registry.
- Raises:
ExtensionNotFound – If the extension is not found in the registry.