A non-intrusive Python pipeline.
Project description
Pipe.py
A non-intrusive Python pipeline.
There are only pipeline. If you want more functional tools, you should look for another library.
Install
pip install only-pipe
Or fetch from github
pip install git+https://github.com/abersheeran/only-pipe
Usage
Use pipeline to pass data as a positional parameter to the next function:
from pipe import F
range(10) | F(filter, lambda x: x % 2) | F(sum) == 25
Or you need to pass multiple parameters through the pipeline:
from pipe import FF
def get_data():
return 1, 2
get_data() | FF(lambda x, y: x + y) == 3
Set Global
Maybe you don't want to use from pipe import F
in every file of the entire project, you can use the following code to set it as a global function, just like min
/max
/sum
.
import pipe
pipe.set_global(pipe.F, pipe.FF)
Maybe you also want to expose functools.reduce
to the world, just like map
/filter
.
import pipe
import functools
pipe.set_global(pipe.F, pipe.FF, functools.reduce)
More
No more ~ This library has less than ten lines of valid code, but it is very effective.
If you like it, please give a Star. 😀
This repository is released under the MIT. Do what you want!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for only_pipe-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2dcfc66323e1df7fec221b8af243017e521c1caab44fd67b70118bbfd2b07a9a |
|
MD5 | 5ceef902a7dd654db9f9180462980ee0 |
|
BLAKE2b-256 | 1c78699b99345f2957c7f6d06a77b32692fae67860f61a9047509732d803ae28 |