Beispiel #1
0
def get_graph(*, _limit=(), _print=()):
    return bonobo.Graph(
        bonobo.FileReader('datasets/passwd.txt'),
        skip_comments,
        *_limit,
        lambda s: s.split(':')[0],
        *_print,
        bonobo.FileWriter('usernames.txt', fs='fs.output'),
    )
Beispiel #2
0
def get_graph(*, _limit=(), _print=()):
    return bonobo.Graph(
        bonobo.FileReader("passwd.txt", fs="fs.static"),
        skip_comments,
        *_limit,
        lambda s: s.split(":")[0],
        *_print,
        bonobo.FileWriter("usernames.txt", fs="fs.output"),
    )
Beispiel #3
0
"""
Extracts a list of parisian bars where you can buy a coffee for a reasonable price, and store them in a flat text file.

.. graphviz::

    digraph {
        rankdir = LR;
        stylesheet = "../_static/graphs.css";

        BEGIN [shape="point"];
        BEGIN -> "ODS()" -> "transform" -> "FileWriter()";
    }

"""

import bonobo
from bonobo.commands.run import get_default_services
from bonobo.ext.opendatasoft import OpenDataSoftAPI

filename = 'coffeeshops.txt'

graph = bonobo.Graph(
    OpenDataSoftAPI(dataset='liste-des-cafes-a-un-euro', netloc='opendata.paris.fr'),
    lambda row: '{nom_du_cafe}, {adresse}, {arrondissement} Paris, France'.format(**row),
    bonobo.FileWriter(path=filename),
)

if __name__ == '__main__':
    bonobo.run(graph, services=get_default_services(__file__))
Beispiel #4
0
from os.path import dirname, realpath, join

import bonobo
from bonobo.ext.opendatasoft import OpenDataSoftAPI

OUTPUT_FILENAME = realpath(join(dirname(__file__), 'coffeeshops.txt'))

graph = bonobo.Graph(
    OpenDataSoftAPI(dataset='liste-des-cafes-a-un-euro', netloc='opendata.paris.fr'),
    lambda row: '{nom_du_cafe}, {adresse}, {arrondissement} Paris, France'.format(**row),
    bonobo.FileWriter(path=OUTPUT_FILENAME),
)

if __name__ == '__main__':
    bonobo.run(graph)
    print('Import done, read {} for results.'.format(OUTPUT_FILENAME))