Skip to content

Core Pipelines

pdum.plumbum.core

Attributes

__all__ module-attribute

__all__ = ['Pb', 'PbFunc', 'PbPair', 'pb']

Classes

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()

PbFunc

Bases: Pb

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 = 'sync'
Functions
to_function
to_function()

PbPair

Bases: Pb

Attributes
left instance-attribute
left = left if isinstance(left, Pb) else PbFunc(left)
operator_kind class-attribute instance-attribute
operator_kind = 'sync'
right instance-attribute
right = right if isinstance(right, Pb) else PbFunc(right)
Functions
to_function
to_function()

Functions

pb

pb(function)