From 43ed9ad154a40ca8623018542a6c7d888ca7e20a Mon Sep 17 00:00:00 2001 From: Obiamaka Agbaneje Date: Sun, 29 Jul 2018 16:08:45 +0100 Subject: [PATCH] Delete old files --- bonobo/examples/datasets/coffeeshops.py | 5 ++ bonobo/examples/datasets/fablabs.py | 2 +- bonobo/examples/tutorials/__init__.py | 0 bonobo/examples/tutorials/_services.py | 5 -- bonobo/examples/tutorials/tut01e01.py | 23 --------- bonobo/examples/tutorials/tut01e02.py | 14 ------ bonobo/examples/tutorials/tut02e01_read.py | 14 ------ bonobo/examples/tutorials/tut02e02_write.py | 23 --------- .../examples/tutorials/tut02e03_writeasmap.py | 36 ------------- .../tutorials/tutorial_basics_firststeps.py | 25 ---------- .../tutorials/tutorial_basics_summary.py | 11 ---- docs/reference/examples.rst | 14 +++++- docs/reference/examples/tutorials.rst | 50 ------------------- 13 files changed, 19 insertions(+), 203 deletions(-) delete mode 100644 bonobo/examples/tutorials/__init__.py delete mode 100644 bonobo/examples/tutorials/_services.py delete mode 100644 bonobo/examples/tutorials/tut01e01.py delete mode 100644 bonobo/examples/tutorials/tut01e02.py delete mode 100644 bonobo/examples/tutorials/tut02e01_read.py delete mode 100644 bonobo/examples/tutorials/tut02e02_write.py delete mode 100644 bonobo/examples/tutorials/tut02e03_writeasmap.py delete mode 100644 bonobo/examples/tutorials/tutorial_basics_firststeps.py delete mode 100644 bonobo/examples/tutorials/tutorial_basics_summary.py delete mode 100644 docs/reference/examples/tutorials.rst diff --git a/bonobo/examples/datasets/coffeeshops.py b/bonobo/examples/datasets/coffeeshops.py index 93aa0d5..fdca3cd 100644 --- a/bonobo/examples/datasets/coffeeshops.py +++ b/bonobo/examples/datasets/coffeeshops.py @@ -5,6 +5,11 @@ from bonobo.examples.datasets.services import get_services def get_graph(graph=None, *, _limit=(), _print=()): + """ + Extracts a list of cafes with on euro in Paris, renames the name, address and zipcode fields, + reorders the fields and formats to json and csv files. + + """ graph = graph or bonobo.Graph() producer = graph.add_chain( diff --git a/bonobo/examples/datasets/fablabs.py b/bonobo/examples/datasets/fablabs.py index 9a02593..9d2f4ed 100644 --- a/bonobo/examples/datasets/fablabs.py +++ b/bonobo/examples/datasets/fablabs.py @@ -1,5 +1,5 @@ """ -Extracts a list of fablabs in the world, restrict to the ones in france, then format it both for a nice console output +Extracts a list of fablabs in the world, restricted to the ones in france, then format its both for a nice console output and a flat txt file. .. graphviz:: diff --git a/bonobo/examples/tutorials/__init__.py b/bonobo/examples/tutorials/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/bonobo/examples/tutorials/_services.py b/bonobo/examples/tutorials/_services.py deleted file mode 100644 index 25d783d..0000000 --- a/bonobo/examples/tutorials/_services.py +++ /dev/null @@ -1,5 +0,0 @@ -from bonobo import open_examples_fs - - -def get_services(): - return {'fs': open_examples_fs('datasets')} diff --git a/bonobo/examples/tutorials/tut01e01.py b/bonobo/examples/tutorials/tut01e01.py deleted file mode 100644 index c524039..0000000 --- a/bonobo/examples/tutorials/tut01e01.py +++ /dev/null @@ -1,23 +0,0 @@ -import bonobo - - -def extract(): - yield 'foo' - yield 'bar' - yield 'baz' - - -def transform(x): - return x.upper() - - -def load(x): - print(x) - - -graph = bonobo.Graph(extract, transform, load) - -graph.__doc__ = 'hello' - -if __name__ == '__main__': - bonobo.run(graph) diff --git a/bonobo/examples/tutorials/tut01e02.py b/bonobo/examples/tutorials/tut01e02.py deleted file mode 100644 index 78b7f43..0000000 --- a/bonobo/examples/tutorials/tut01e02.py +++ /dev/null @@ -1,14 +0,0 @@ -import bonobo - -graph = bonobo.Graph( - [ - 'foo', - 'bar', - 'baz', - ], - str.upper, - print, -) - -if __name__ == '__main__': - bonobo.run(graph) diff --git a/bonobo/examples/tutorials/tut02e01_read.py b/bonobo/examples/tutorials/tut02e01_read.py deleted file mode 100644 index 362051a..0000000 --- a/bonobo/examples/tutorials/tut02e01_read.py +++ /dev/null @@ -1,14 +0,0 @@ -import bonobo - -graph = bonobo.Graph( - bonobo.FileReader('coffeeshops.txt'), - print, -) - - -def get_services(): - return {'fs': bonobo.open_examples_fs('datasets')} - - -if __name__ == '__main__': - bonobo.run(graph, services=get_services()) diff --git a/bonobo/examples/tutorials/tut02e02_write.py b/bonobo/examples/tutorials/tut02e02_write.py deleted file mode 100644 index a33a11b..0000000 --- a/bonobo/examples/tutorials/tut02e02_write.py +++ /dev/null @@ -1,23 +0,0 @@ -import bonobo - - -def split_one(line): - return dict(zip(("name", "address"), line.split(', ', 1))) - - -graph = bonobo.Graph( - bonobo.FileReader('coffeeshops.txt'), - split_one, - bonobo.JsonWriter('coffeeshops.json', fs='fs.output'), -) - - -def get_services(): - return { - 'fs': bonobo.open_examples_fs('datasets'), - 'fs.output': bonobo.open_fs(), - } - - -if __name__ == '__main__': - bonobo.run(graph, services=get_services()) diff --git a/bonobo/examples/tutorials/tut02e03_writeasmap.py b/bonobo/examples/tutorials/tut02e03_writeasmap.py deleted file mode 100644 index afc251e..0000000 --- a/bonobo/examples/tutorials/tut02e03_writeasmap.py +++ /dev/null @@ -1,36 +0,0 @@ -import json - -import bonobo - - -def split_one_to_map(line): - k, v = line.split(', ', 1) - return {k: v} - - -class MyJsonWriter(bonobo.JsonWriter): - prefix, suffix = '{', '}' - - def write(self, fs, file, lineno, **row): - return bonobo.FileWriter.write( - self, fs, file, lineno, - json.dumps(row)[1:-1] - ) - - -graph = bonobo.Graph( - bonobo.FileReader('coffeeshops.txt'), - split_one_to_map, - MyJsonWriter('coffeeshops.json', fs='fs.output'), -) - - -def get_services(): - return { - 'fs': bonobo.open_examples_fs('datasets'), - 'fs.output': bonobo.open_fs(), - } - - -if __name__ == '__main__': - bonobo.run(graph, services=get_services()) diff --git a/bonobo/examples/tutorials/tutorial_basics_firststeps.py b/bonobo/examples/tutorials/tutorial_basics_firststeps.py deleted file mode 100644 index d024287..0000000 --- a/bonobo/examples/tutorials/tutorial_basics_firststeps.py +++ /dev/null @@ -1,25 +0,0 @@ -import bonobo - - -def generate_data(): - yield 'foo' - yield 'bar' - yield 'baz' - - -def uppercase(x: str): - return x.upper() - - -def output(x: str): - print(x) - - -graph = bonobo.Graph( - generate_data, - uppercase, - output, -) - -if __name__ == '__main__': - bonobo.run(graph) diff --git a/bonobo/examples/tutorials/tutorial_basics_summary.py b/bonobo/examples/tutorials/tutorial_basics_summary.py deleted file mode 100644 index a75e0f5..0000000 --- a/bonobo/examples/tutorials/tutorial_basics_summary.py +++ /dev/null @@ -1,11 +0,0 @@ -import bonobo - -# Represent our data processor as a simple directed graph of callables. -graph = bonobo.Graph( - ['foo', 'bar', 'baz'], - str.upper, - print, -) - -if __name__ == '__main__': - bonobo.run(graph) diff --git a/docs/reference/examples.rst b/docs/reference/examples.rst index b36c414..4edc910 100644 --- a/docs/reference/examples.rst +++ b/docs/reference/examples.rst @@ -5,7 +5,19 @@ There are a few examples bundled with **bonobo**. You'll find them under the :mod:`bonobo.examples` package, and you can run them directly as modules: - $ bonobo run -m bonobo.examples...module +.. code-block:: shell-session + + $ bonobo run -m bonobo.examples.module + + +or + +.. code-block:: shell-session + + $ python -m bonobo.examples.module + + + .. toctree:: :maxdepth: 4 diff --git a/docs/reference/examples/tutorials.rst b/docs/reference/examples/tutorials.rst deleted file mode 100644 index dbee6fd..0000000 --- a/docs/reference/examples/tutorials.rst +++ /dev/null @@ -1,50 +0,0 @@ -Examples from the tutorial -========================== - -Examples from :doc:`/tutorial/tut01` -:::::::::::::::::::::::::::::::::::: - -Example 1 ---------- - -.. automodule:: bonobo.examples.tutorials.tut01e01 - :members: - :undoc-members: - :show-inheritance: - -Example 2 ---------- - -.. automodule:: bonobo.examples.tutorials.tut01e02 - :members: - :undoc-members: - :show-inheritance: - -Examples from :doc:`/tutorial/tut02` -:::::::::::::::::::::::::::::::::::: - -Example 1: Read ---------------- - -.. automodule:: bonobo.examples.tutorials.tut02e01_read - :members: - :undoc-members: - :show-inheritance: - -Example 2: Write ----------------- - -.. automodule:: bonobo.examples.tutorials.tut02e02_write - :members: - :undoc-members: - :show-inheritance: - -Example 3: Write as map ------------------------ - -.. automodule:: bonobo.examples.tutorials.tut02e03_writeasmap - :members: - :undoc-members: - :show-inheritance: - -