Skip to main content

Reuseable Pipes

Project description


Type safe, reusable pipes to process streams of data.

from typing import Tuple
from plmbr.pipes import *
from plmbr.pipe import Pipe

if __name__ == '__main__':
    double_x: Pipe[Dict, Dict] = to(lambda p: {'x': p['x'] * 2, 'y': p['y']})
    point = Tuple[int, int]
    double_y: Pipe[Dict, Dict] = to(lambda p: {'x': p['x'], 'y': p['y'] * 2})

        zip(range(5), range(5))
        - keep[point](lambda p: p[0] >= 2)
        - to[point, Dict](lambda p: {'x': p[0], 'y': p[1]})
        - json_dumps()
        > save('points.json')

        - json_loads()
        - tee(
        > log()

    # {'x': 4, 'y': 2}
    # {'x': 2, 'y': 4}
    # {'x': 6, 'y': 3}
    # {'x': 3, 'y': 6}
    # {'x': 8, 'y': 4}
    # {'x': 4, 'y': 8}

Project details

Download files

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

Files for plmbr, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size plmbr-0.2.1.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page