* refactor: remove redundant comments and docstrings * fix(signal): annotate async context manager as a generator
22 lines
547 B
Python
22 lines
547 B
Python
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from nanobot.channels.contracts import ChannelSetupSpec
|
|
|
|
if TYPE_CHECKING:
|
|
from nanobot.channels.plugin import ChannelPlugin
|
|
|
|
|
|
def channel_setup_spec(
|
|
name: str,
|
|
*,
|
|
plugin: ChannelPlugin | None = None,
|
|
) -> ChannelSetupSpec | None:
|
|
"""Return the setup contract declared by one channel descriptor."""
|
|
if plugin is None:
|
|
from nanobot.channels.registry import load_channel_plugin
|
|
|
|
plugin = load_channel_plugin(name)
|
|
return plugin.setup
|