Skip to content

Async Pipelines

pdum.plumbum.async_pipeline

Attributes

__all__ module-attribute

__all__ = ['AsyncPb', 'AsyncPbFunc', 'AsyncPbPair', 'apb']

Classes

AsyncPb

Bases: ABC

Base class for asynchronous plumbum operators.

Attributes
operator_kind class-attribute instance-attribute
operator_kind = 'async'
Functions
to_async_function
to_async_function()

AsyncPbFunc

Bases: AsyncPb

Attributes
args instance-attribute
args = tuple((_normalize(value)) for value in args)
function instance-attribute
function = function
kwargs instance-attribute
kwargs = {key: (_normalize(value))for (key, value) in (items())}
operator_kind class-attribute instance-attribute
operator_kind = 'async'
Functions
to_async_function
to_async_function()

AsyncPbPair

Bases: AsyncPb

Attributes
left instance-attribute
left = ensure_async_pb(left)
operator_kind class-attribute instance-attribute
operator_kind = 'async'
right instance-attribute
right = ensure_async_pb(right)
Functions
to_async_function
to_async_function()

Pb

Bases: ABC

Abstract base class for plumbum pipe operations.

Pb defines the core interface for threading data through function calls using pipe operators. It provides a clear distinction between data and operators, allowing operators to be composed and assigned without execution.

The primary operators are: - | (pipe): Combines operators into a pipeline (creates PbPair) - > (thread): Threads data through the pipeline

Coercing an operator or pipeline into a plain callable can be done explicitly via :meth:Pb.to_function:

pipeline = add_one | mul_two as_function = pipeline.to_function() as_function(10) 22

This form mirrors Pb.to_function but fits naturally into pipeline expressions, enabling constructs like select((add_one | double).to_function()) to embed synchronous pipelines inside iterable operators.

Attributes
operator_kind class-attribute instance-attribute
operator_kind = 'sync'
Functions
to_function
to_function()

_SyncToAsyncAdapter

Bases: AsyncPb

Attributes
operator instance-attribute
operator = operator
operator_kind class-attribute instance-attribute
operator_kind = 'async'
Functions
to_async_function
to_async_function()

Functions

_wrap_sync_callable

_wrap_sync_callable(function)

apb

apb(function)

ensure_async_pb

ensure_async_pb(obj)