console.adapter

适配器

class melobot.protocols.console.adapter.Adapter[源代码]

基类:Adapter[EventFactory, OutputFactory, EchoFactory, Action, ConsoleIO, ConsoleIO]

async send(msg: str, stderr: bool = False, next_prompt_args: dict[str, Any] | None = None) ActionHandleGroup[Echo][源代码]
参数:
返回类型:

ActionHandleGroup[Echo]

async raw_output(executor: SyncOrAsyncCallable[(), Any], next_prompt_args: dict[str, Any] | None = None) ActionHandleGroup[Echo][源代码]
参数:
返回类型:

ActionHandleGroup[Echo]

事件

class melobot.protocols.console.adapter.event.Event[源代码]

基类:Event, Generic[InputDataT]

is_stdin() bool[源代码]
返回类型:

bool

class melobot.protocols.console.adapter.event.StdinEvent[源代码]

基类:TextEvent, Event[StdinInputData]

spread: bool

行为(动作)

一般来说,无需手动通过这些原始的行为类构建行为,直接调用 Adapter 的输出方法即可。

但仍然提供这些接口用于高级操作。

class melobot.protocols.console.adapter.action.Action[源代码]

基类:Action

__init__(type: OutputType) None[源代码]
参数:

type (OutputType)

返回类型:

None

class melobot.protocols.console.adapter.action.NormalOutputAction[源代码]

基类:Action

__init__(msg: str, stream: Literal['stdout', 'stderr'] = 'stdout', next_prompt_args: dict[str, Any] | None = None) None[源代码]
参数:
  • msg (str)

  • stream (Literal['stdout', 'stderr'])

  • next_prompt_args (dict[str, Any] | None)

返回类型:

None

class melobot.protocols.console.adapter.action.RawOutputAction[源代码]

基类:Action

__init__(executor: SyncOrAsyncCallable[(), Any], next_prompt_args: dict[str, Any] | None = None) None[源代码]
参数:
返回类型:

None

回应

此协议无需回应,因此目前不会创建回应对象。

以下所有对象不会被行为操作方法返回。但仍然提供用于类型注解。

class melobot.protocols.console.adapter.echo.Echo[源代码]

基类:Echo, Generic[EchoDataT]