This is the commit where I admit that having more than one input/output format for readers and writers was complicating the code too much for a very small gain, and that it would be easier to only have one way to do it. So such way is now: - Returning (or yielding) a dict if you have key-value type collections. - Returning (or yielding) a tuple if you have a list-type collection. - Returning (or yielding) something else otherwise, which will continue to work like the old "arg0" format. IOFORMAT options has been removed in favour of a RemovedOption, which will complain if you're still trying to set it to anything else than the one value allowed.
19 lines
631 B
Python
19 lines
631 B
Python
from bonobo.execution.graph import GraphExecutionContext
|
|
|
|
|
|
class Strategy:
|
|
"""
|
|
Base class for execution strategies.
|
|
|
|
"""
|
|
GraphExecutionContextType = GraphExecutionContext
|
|
|
|
def __init__(self, GraphExecutionContextType=None):
|
|
self.GraphExecutionContextType = GraphExecutionContextType or self.GraphExecutionContextType
|
|
|
|
def create_graph_execution_context(self, graph, *args, GraphExecutionContextType=None, **kwargs):
|
|
return (GraphExecutionContextType or self.GraphExecutionContextType)(graph, *args, **kwargs)
|
|
|
|
def execute(self, graph, *args, **kwargs):
|
|
raise NotImplementedError
|