Skip to main content

Python with pipes, utils, and pipe utils

Project description

Pipe Utils

Python with pipes, utils, and pipe utils.

Install

pip install pipe-utils

Docs

https://pipe-utils.rtfd.io

Example

from pipe_utils import Pipe
from pipe_utils.iterables import *
from pipe_utils.mappings import *

words = "I just think pipes are neat"

result = (
        Pipe(words)
        | str.lower
        | str.split
        | group_by(len)
        | sorted_dict
).get()

print(result)
#  {1: ['i'], 3: ['are'], 4: ['just', 'neat'], 5: ['think', 'pipes']}

And, if you're feeling dangerous, override the builtin filter, map, and all functions:

from pipe_utils.override import *

data = [[1, -3, 4], [1, 2, 3], [2, 3, 4], [5, -1, 4]]

result = (
        Pipe(data)
        | filter(all(it >= 0))
        | map(sum_by(it * it))
        | list
).get()

print(result)  # [14, 29]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pipe-utils-0.2.1.tar.gz (20.0 kB view hashes)

Uploaded Source

Built Distribution

pipe_utils-0.2.1-py3-none-any.whl (13.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page