boilercv.pipelines#

Pipelines.

Subpackages#

Submodules#

Package Contents#

Classes#

PipelineBase

Pipeline base model.

Pipeline

Pipeline model.

Defaults

Context for expression validation.

Functions#

set_defaults

Set self.default_keys using self.default_factory or self.default.

compose_contexts

Compose contexts.

make_pipelines

Compose defaults.

compose_context

Compose inner contexts.

Data#

PIPELINE

Pipe model context key.

API#

boilercv.pipelines.PIPELINE#

‘pipeline’

Pipe model context key.

class boilercv.pipelines.PipelineBase(
/,
**data: context_models.types.Data,
)#

Bases: context_models.ContextBase

Pipeline base model.

Initialization

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_config: ClassVar[boilercv.pipelines.contexts.types.PipelineConfigDict]#

‘PluginConfigDict(…)’

classmethod morph_validate_before(
data: dict[str, Any],
info: boilercv.pipelines.contexts.types.PipelineValidationInfo,
) dict[str, Any]#

Validate context before.

morph_validate_after(
info: boilercv.pipelines.contexts.types.PipelineValidationInfo,
) Self#

Validate context after.

classmethod apply(
mode: boilercv.pipelines.types.Mode | Any,
data: boilercv.pipelines.types.T,
info: boilercv.pipelines.contexts.types.PipelineValidationInfo,
) boilercv.pipelines.types.T#

Apply a pipe to data.

class boilercv.pipelines.Pipeline(
/,
root=PydanticUndefined,
**data: context_models.types.V,
)#

Bases: boilercv.morphs.Morph[boilercv.pipelines.types.K, boilercv.pipelines.types.V], typing.Generic[boilercv.pipelines.types.K, boilercv.pipelines.types.V]

Pipeline model.

Initialization

model_config: ClassVar[boilercv.pipelines.contexts.types.PipelineConfigDict]#

‘PluginConfigDict(…)’

classmethod morph_validate_before(
data: dict[boilercv.pipelines.types.K, boilercv.pipelines.types.V],
info: boilercv.pipelines.contexts.types.PipelineValidationInfo,
) dict[boilercv.pipelines.types.K, boilercv.pipelines.types.V]#

Validate context before.

morph_validate_after(
info: boilercv.pipelines.contexts.types.PipelineValidationInfo,
) Self#

Validate context after.

classmethod apply(
mode: boilercv.pipelines.types.Mode,
data: boilercv.pipelines.types.T,
info: boilercv.pipelines.contexts.types.PipelineValidationInfo,
) boilercv.pipelines.types.T#

Apply a pipe to data.

classmethod compose_defaults(
mapping: dict[boilercv.pipelines.types.K, boilercv.pipelines.types.V | pydantic.BaseModel] | None = None,
keys: tuple[boilercv.pipelines.types.K, ...] | None = None,
value: boilercv.pipelines.types.V | pydantic.BaseModel | None = None,
value_copier: collections.abc.Callable[[boilercv.pipelines.types.V | pydantic.BaseModel], boilercv.pipelines.types.V | pydantic.BaseModel] = lambda v: ...,
factory: collections.abc.Callable[..., Any] | None = None,
value_model: type[boilercv.pipelines.Pipeline[boilercv.pipelines.types.K, boilercv.pipelines.types.V] | boilercv.pipelines.PipelineBase | pydantic.BaseModel] | None = None,
value_context: boilercv.pipelines.contexts.PipelineCtx | None = None,
) boilercv.pipelines.contexts.PipelineCtx#

Compose defaults.

class boilercv.pipelines.Defaults#

Bases: boilercv.pipelines.pipes.ContextValue, typing.Generic[boilercv.pipelines.types.K, boilercv.pipelines.types.V]

Context for expression validation.

mapping: dict[boilercv.pipelines.types.K, boilercv.pipelines.types.V]#

‘field(…)’

Mapping of keys to their default values.

keys: tuple[boilercv.pipelines.types.K, ...]#

‘field(…)’

Default keys.

value: boilercv.pipelines.types.V | None#

None

Default value.

factory: collections.abc.Callable[..., Any] | None#

None

Default value factory.

value_copier: collections.abc.Callable[[boilercv.pipelines.types.V], boilercv.pipelines.types.V] | None#

None

Method to copy the default value.

boilercv.pipelines.set_defaults(
i: dict[boilercv.pipelines.types.K, boilercv.pipelines.types.V],
d: boilercv.pipelines.Defaults[boilercv.pipelines.types.K, boilercv.pipelines.types.V],
) dict[boilercv.pipelines.types.K, boilercv.pipelines.types.V]#

Set self.default_keys using self.default_factory or self.default.

boilercv.pipelines.compose_contexts(
*contexts: boilercv.pipelines.contexts.PipelineCtx,
) boilercv.pipelines.contexts.PipelineCtx#

Compose contexts.

boilercv.pipelines.make_pipelines(
typ: type,
/,
before: collections.abc.Sequence[boilercv.pipelines.pipes.types.AnyPipe] | boilercv.pipelines.pipes.types.AnyPipe | None = None,
after: collections.abc.Sequence[boilercv.pipelines.pipes.types.AnyPipe] | boilercv.pipelines.pipes.types.AnyPipe | None = None,
) boilercv.pipelines.contexts.PipelineCtx#

Compose defaults.

boilercv.pipelines.compose_context(
*context_values: boilercv.pipelines.pipes.ContextValue,
) boilercv.pipelines.contexts.PipelineCtx#

Compose inner contexts.