precept.events

class precept.events.Event(name: str, payload: dict)[source]

Bases: object

Event with payload and stop property.

__init__(name: str, payload: dict)[source]
class precept.events.EventDispatcher[source]

Bases: object

Dispatch events to subscribers functions.

__init__()[source]
async dispatch(event: str, **payload)[source]

Dispatch an event with optional payload data.

Parameters
  • event – Name of the event.

  • payload – Data of the event.

Returns

subscribe(event: str, func)[source]

Subscribe func to execute every time event is dispatched.

Parameters
  • event – The event to subscribe to.

  • func – The func to call when event is dispathed.

Returns

class precept.events.PreceptEvent(value)[source]

Bases: precept._tools.AutoNameEnum

Precept cli events.

BEFORE_CLI_START = 'before_cli_start'
CLI_PARSED = 'cli_parsed'
CLI_STARTED = 'cli_started'
CLI_STOPPED = 'cli_stopped'