forked from python-bonobo/bonobo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Default service configuration in directory or file (python-bonobo#38).
- Loading branch information
Showing
12 changed files
with
92 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from os.path import dirname | ||
|
||
import bonobo | ||
|
||
|
||
def get_services(): | ||
return { | ||
'fs': bonobo.open_fs(dirname(__file__)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from bonobo import get_examples_path, open_fs | ||
|
||
|
||
def get_services(): | ||
return { | ||
'fs': open_fs(get_examples_path()) | ||
} |
5 changes: 2 additions & 3 deletions
5
bonobo/examples/files/csv.py → bonobo/examples/files/csv_handlers.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
import bonobo | ||
|
||
from ._services import get_services | ||
from bonobo.commands.run import get_default_services | ||
|
||
graph = bonobo.Graph( | ||
bonobo.CsvReader(path='datasets/coffeeshops.txt'), | ||
print, | ||
) | ||
|
||
if __name__ == '__main__': | ||
bonobo.run(graph, services=get_services()) | ||
bonobo.run(graph, services=get_default_services(__file__)) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import bonobo | ||
from bonobo.commands.run import get_default_services | ||
|
||
|
||
def skip_comments(line): | ||
if not line.startswith('#'): | ||
yield line | ||
|
||
|
||
graph = bonobo.Graph( | ||
bonobo.FileReader(path='datasets/passwd.txt'), | ||
skip_comments, | ||
lambda s: s.split(':'), | ||
lambda l: l[0], | ||
print, | ||
) | ||
|
||
if __name__ == '__main__': | ||
bonobo.run(graph, services=get_default_services(__file__)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
import bonobo | ||
from bonobo.commands.run import get_default_services | ||
|
||
graph = bonobo.Graph( | ||
bonobo.FileReader(path=bonobo.get_examples_path('datasets/coffeeshops.txt')), | ||
bonobo.FileReader(path='datasets/coffeeshops.txt'), | ||
print, | ||
) | ||
|
||
|
||
def get_services(): | ||
return { | ||
'fs': bonobo.open_fs(bonobo.get_examples_path()) | ||
} | ||
|
||
if __name__ == '__main__': | ||
bonobo.run(graph) | ||
bonobo.run(graph, services=get_default_services(__file__, get_services())) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters