Skip to content

chaining module

Utilities for chaining.


Chainable class

Chainable()

Class representing an object that can be chained.

Subclasses


pipe class method

Chainable.pipe(
    func,
    *args,
    **kwargs
)

Apply a chainable function that expects a Chainable instance.

Can be called as a class method, but then will pass only *args and **kwargs.

Argument func can be a function, a string denoting a (deep) attribute to be resolved with deep_getattr(), or a tuple where the first element is one of the above and the second element is a positional argument or keyword argument where to pass the instance. If not a tuple, passes the instance as the first positional argument. If a string and the target function is an instance method, won't pass the instance since it's already bound to this instance.