Example #1
0
def flatten():
    p = Pipe(None, name="flatten")
    p.flatten()
    return p
Example #2
0
def flat_map(func):
    p = Pipe(None, name="flatmap")
    p.flat_map(func)
    return p
Example #3
0
def map_to(func):
    p = Pipe(None, name="map_to")
    p.steps.append(func)
    return p
Example #4
0
def curl(url):
    import urllib.request
    with urllib.request.urlopen(url) as response:
        lines = response.readlines()
        p = Pipe(lines, name="curl")
        return p
Example #5
0
def echo(str_input):
    p = Pipe([str_input], final=True, name="echo")
    return p
Example #6
0
def cat(filename):
    reader = open(filename, 'r')
    return Pipe(reader.read().splitlines(), name="cat")
Example #7
0
def pipe(*args, **kwargs):
    return Pipe(*args, **kwargs)