core.utils#

Module Contents#

Functions#

pipe

Allows to compose a value and up to multiple functions that use this value.

Data#

_InstanceType

_PipelineStepType

_ReturnType

API#

core.utils._InstanceType = None#
core.utils._PipelineStepType = None#
core.utils._ReturnType = None#
core.utils.pipe(instance: core.utils._InstanceType, *functions: core.utils._PipelineStepType) core.utils._ReturnType#

Allows to compose a value and up to multiple functions that use this value.

All starts with the value itself. Each next function uses the previous result as an input parameter.

Currently, pipe has a hard limit of 21 steps. Because, it is not possible to type it otherwise. We need a hard limit. See: dry-python/returns#461

Here’s how it should be used:

>>> # => executes: str(float(int('1')))
>>> assert pipe('1', int, float, str) == '1.0'
See also:
Note:
Vendored from:

dry-python/returns

Edits:
  • Reduced irrelevant info in the docstring content to avoid confusion.

  • Renamed “flow” to “pipe”.