ezmsg.baseproc.processor#
Base processor classes for ezmsg (non-stateful).
Classes
- class BaseConsumer(*args, settings=None, **kwargs)[source]#
Bases:
BaseProcessor[SettingsType,MessageInType,None],ABC,Generic[SettingsType,MessageInType]Base class for consumers – processors that receive messages but don’t produce output. This base simply overrides type annotations of BaseProcessor to remove the outputs. (We don’t bother overriding send and asend because those are deprecated.)
- Parameters:
settings (SettingsType)
- class BaseProcessor(*args, settings=None, **kwargs)[source]#
Bases:
ABC,Generic[SettingsType,MessageInType,MessageOutType]Base class for processors. You probably do not want to inherit from this class directly. Refer instead to the more specific base classes.
Use
BaseConsumerorBaseTransformerfor ops that return a result or not, respectively.Use
BaseStatefulProcessorand its children for operations that require state.
Note that BaseProcessor and its children are sync by default. If you need async by defualt, then override the async methods and call them from the sync methods. Look to BaseProducer for examples of calling async methods from sync methods.
- Parameters:
settings (SettingsType)
- class BaseProducer(*args, settings=None, **kwargs)[source]#
Bases:
ABC,Generic[SettingsType,MessageOutType]Base class for producers – processors that generate messages without consuming inputs.
- Note that BaseProducer and its children are async by default, and the sync methods simply wrap
the async methods. This is the opposite of
BaseProcessorand its children which are sync by default. These classes are designed this way because it is highly likely that a producer, which (probably) does not receive inputs, will require some sort of IO which will benefit from being async.
- Parameters:
settings (SettingsType | None)
- class BaseTransformer(*args, settings=None, **kwargs)[source]#
Bases:
BaseProcessor[SettingsType,MessageInType,MessageOutType],ABC,Generic[SettingsType,MessageInType,MessageOutType]Base class for transformers – processors which receive messages and produce output. This base simply overrides type annotations of
BaseProcessorto indicate that outputs are not optional. (We don’t bother overriding send and asend because those are deprecated.)- Parameters:
settings (SettingsType)
- class BaseProcessor(*args, settings=None, **kwargs)[source]#
Bases:
ABC,Generic[SettingsType,MessageInType,MessageOutType]Base class for processors. You probably do not want to inherit from this class directly. Refer instead to the more specific base classes.
Use
BaseConsumerorBaseTransformerfor ops that return a result or not, respectively.Use
BaseStatefulProcessorand its children for operations that require state.
Note that BaseProcessor and its children are sync by default. If you need async by defualt, then override the async methods and call them from the sync methods. Look to BaseProducer for examples of calling async methods from sync methods.
- Parameters:
settings (SettingsType)
- class BaseProducer(*args, settings=None, **kwargs)[source]#
Bases:
ABC,Generic[SettingsType,MessageOutType]Base class for producers – processors that generate messages without consuming inputs.
- Note that BaseProducer and its children are async by default, and the sync methods simply wrap
the async methods. This is the opposite of
BaseProcessorand its children which are sync by default. These classes are designed this way because it is highly likely that a producer, which (probably) does not receive inputs, will require some sort of IO which will benefit from being async.
- Parameters:
settings (SettingsType | None)
- class BaseConsumer(*args, settings=None, **kwargs)[source]#
Bases:
BaseProcessor[SettingsType,MessageInType,None],ABC,Generic[SettingsType,MessageInType]Base class for consumers – processors that receive messages but don’t produce output. This base simply overrides type annotations of BaseProcessor to remove the outputs. (We don’t bother overriding send and asend because those are deprecated.)
- Parameters:
settings (SettingsType)
- class BaseTransformer(*args, settings=None, **kwargs)[source]#
Bases:
BaseProcessor[SettingsType,MessageInType,MessageOutType],ABC,Generic[SettingsType,MessageInType,MessageOutType]Base class for transformers – processors which receive messages and produce output. This base simply overrides type annotations of
BaseProcessorto indicate that outputs are not optional. (We don’t bother overriding send and asend because those are deprecated.)- Parameters:
settings (SettingsType)