kaira.channels.ChannelRegistry

Inheritance diagram for ChannelRegistry
- class kaira.channels.ChannelRegistry[source]
Bases:
objectA registry for channels in Kaira.
This class provides a centralized registry for all channels, making it easier to instantiate them by name with appropriate parameters.
Methods
Create a channel instance by name.
Get a channel class by name.
List all available channels in the registry.
Register a new channel in the registry.
Decorator to register a channel class in the registry.
- classmethod register(name: str, channel_class: Type[BaseChannel]) None[source]
Register a new channel in the registry.
- Parameters:
name (str) – The name to register the channel under.
channel_class (Type[BaseChannel]) – The channel class to register.
- classmethod register_channel(name: str | None = None) Callable[source]
Decorator to register a channel class in the registry.
- Parameters:
name (Optional[str], optional) – The name to register the channel under. If None, the class name will be used (converted to lowercase).
- Returns:
A decorator function that registers the channel class.
- Return type:
callable
- classmethod get(name: str) Type[BaseChannel][source]
Get a channel class by name.
- Parameters:
name (str) – The name of the channel to get.
- Returns:
The channel class.
- Return type:
Type[BaseChannel]
- Raises:
KeyError – If the channel is not registered.
- classmethod create(name: str, **kwargs) BaseChannel[source]
Create a channel instance by name.
- Parameters:
name (str) – The name of the channel to create.
**kwargs – Additional arguments to pass to the channel constructor.
- Returns:
The instantiated channel.
- Return type:
- classmethod list_channels() list[source]
List all available channels in the registry.
- Returns:
A list of channel names.
- Return type:
- __init__()