Django command minor enhancements.
This commit is contained in:
6
.isort.cfg
Normal file
6
.isort.cfg
Normal file
@ -0,0 +1,6 @@
|
||||
[settings]
|
||||
line_length=120
|
||||
indent=' '
|
||||
multi_line_output=5
|
||||
known_first_party=bonobo
|
||||
known_third_party=mondrian,whistle
|
||||
@ -195,4 +195,3 @@ def open_examples_fs(*pathsegments):
|
||||
|
||||
|
||||
api.register_group(get_argument_parser, parse_args)
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -61,11 +61,10 @@ 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)))
|
||||
print(term.lightwhite("{}. {}".format(i + 1, graph.name or repr(graph).strip("<>"))))
|
||||
result = bonobo.run(graph, services=services, strategy=strategy)
|
||||
results.append(result)
|
||||
print(term.lightblack(" ... return value: " + str(result)))
|
||||
print()
|
||||
|
||||
return results
|
||||
|
||||
@ -76,6 +75,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
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user