[examples] comments.
This commit is contained in:
@ -1,26 +1,26 @@
|
|||||||
|
"""
|
||||||
|
This transformation extracts the environment and prints it, sorted alphabetically, one item per line.
|
||||||
|
|
||||||
|
Used in the bonobo tests around environment management.
|
||||||
|
|
||||||
|
"""
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import bonobo
|
import bonobo
|
||||||
|
|
||||||
|
|
||||||
def extract_environ():
|
def extract_environ():
|
||||||
|
"""Yield all the system environment."""
|
||||||
yield from sorted(os.environ.items())
|
yield from sorted(os.environ.items())
|
||||||
|
|
||||||
|
|
||||||
def get_graph():
|
def get_graph():
|
||||||
"""
|
|
||||||
This function builds the graph that needs to be executed.
|
|
||||||
|
|
||||||
:return: bonobo.Graph
|
|
||||||
|
|
||||||
"""
|
|
||||||
graph = bonobo.Graph()
|
graph = bonobo.Graph()
|
||||||
graph.add_chain(extract_environ, print)
|
graph.add_chain(extract_environ, print)
|
||||||
|
|
||||||
return graph
|
return graph
|
||||||
|
|
||||||
|
|
||||||
# The __main__ block actually execute the graph.
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
parser = bonobo.get_argument_parser()
|
parser = bonobo.get_argument_parser()
|
||||||
with bonobo.parse_args(parser):
|
with bonobo.parse_args(parser):
|
||||||
|
|||||||
Reference in New Issue
Block a user