Default service configuration in directory or file (#38).

This commit is contained in:
Romain Dorgueil
2017-04-28 07:37:15 +02:00
parent c801131190
commit 357683bd02
12 changed files with 92 additions and 51 deletions

View File

@ -0,0 +1,9 @@
from os.path import dirname
import bonobo
def get_services():
return {
'fs': bonobo.open_fs(dirname(__file__))
}

View File

@ -1,4 +1,5 @@
import bonobo
from bonobo.commands.run import get_default_services
from bonobo.ext.opendatasoft import OpenDataSoftAPI
filename = 'coffeeshops.txt'
@ -9,13 +10,5 @@ graph = bonobo.Graph(
bonobo.FileWriter(path=filename),
)
def get_services():
from os.path import dirname
return {
'fs': bonobo.open_fs(dirname(__file__))
}
if __name__ == '__main__':
bonobo.run(graph, services=get_services())
bonobo.run(graph, services=get_default_services(__file__))

View File

@ -3,6 +3,7 @@ import json
from colorama import Fore, Style
import bonobo
from bonobo.commands.run import get_default_services
from bonobo.ext.opendatasoft import OpenDataSoftAPI
try:
@ -57,16 +58,8 @@ graph = bonobo.Graph(
normalize,
filter_france,
bonobo.Tee(display),
bonobo.JsonWriter(path='datasets/fablabs.txt'),
bonobo.JsonWriter(path='fablabs.txt'),
)
def get_services():
from os.path import dirname
return {
'fs': bonobo.open_fs(dirname(__file__))
}
if __name__ == '__main__':
bonobo.run(graph, services=get_services())
bonobo.run(graph, services=get_default_services(__file__))