Merge branch 'develop' of github.com:hartym/bonobo into develop

This commit is contained in:
Romain Dorgueil
2019-05-08 11:56:51 +02:00
5 changed files with 13 additions and 8 deletions

6
.isort.cfg Normal file
View File

@ -0,0 +1,6 @@
[settings]
line_length=120
indent=' '
multi_line_output=5
known_first_party=bonobo
known_third_party=mondrian,whistle

View File

@ -196,4 +196,3 @@ def open_examples_fs(*pathsegments):
api.register_group(get_argument_parser, parse_args)

View File

@ -23,5 +23,6 @@ class partial(functools.partial):
@property
def __name__(self):
return get_name(self.func)
def using(self, *service_names):
return use(*service_names)(self)

View File

@ -60,14 +60,13 @@ class ETLCommand(BaseCommand):
for i, graph in enumerate(graph_coll):
if not isinstance(graph, bonobo.Graph):
raise ValueError('Expected a Graph instance, got {!r}.'.format(graph))
print(term.lightwhite('{}. {}'.format(i + 1, graph.name or repr(graph).strip('<>'))))
raise ValueError("Expected a Graph instance, got {!r}.".format(graph))
print(term.lightwhite("{}. {}".format(i + 1, graph.name or repr(graph).strip("<>"))))
result = bonobo.run(graph, services=services, strategy=strategy)
results.append(result)
for node in result.nodes:
print(node.get_statistics_as_string(), node.get_flags_as_string())
print(term.lightblack(" ... return value: " + str(result)))
print()
return results
@ -78,6 +77,6 @@ class ETLCommand(BaseCommand):
self.stderr = OutputWrapper(ConsoleOutputPlugin._stderr, ending=CLEAR_EOL + "\n")
self.stderr.style_func = lambda x: Fore.LIGHTRED_EX + Back.RED + "!" + Style.RESET_ALL + " " + x
self.run(*args, **options)
results = self.run(*args, **options)
self.stdout, self.stderr = _stdout_backup, _stderr_backup

View File

@ -18,9 +18,9 @@ class ApiHelper:
assert (
len(parameters) > 0 and parameters[0] == "graph"
), 'First parameter of a graph api function must be "graph".'
assert required_parameters.intersection(parameters) == required_parameters, (
"Graph api functions must define the following parameters: " + ", ".join(sorted(required_parameters))
)
assert (
required_parameters.intersection(parameters) == required_parameters
), "Graph api functions must define the following parameters: " + ", ".join(sorted(required_parameters))
self.__all__.append(get_name(x))
return x