Deprecation-land cleanup, before 0.3.
This commit is contained in:
@ -20,7 +20,7 @@ def register_api_group(*args):
|
|||||||
|
|
||||||
|
|
||||||
@register_api
|
@register_api
|
||||||
def run(graph, *chain, strategy=None, plugins=None, services=None):
|
def run(graph, strategy=None, plugins=None, services=None):
|
||||||
"""
|
"""
|
||||||
Main entry point of bonobo. It takes a graph and creates all the necessary plumbery around to execute it.
|
Main entry point of bonobo. It takes a graph and creates all the necessary plumbery around to execute it.
|
||||||
|
|
||||||
@ -40,21 +40,16 @@ def run(graph, *chain, strategy=None, plugins=None, services=None):
|
|||||||
:param dict services: The implementations of services this graph will use.
|
:param dict services: The implementations of services this graph will use.
|
||||||
:return bonobo.execution.graph.GraphExecutionContext:
|
:return bonobo.execution.graph.GraphExecutionContext:
|
||||||
"""
|
"""
|
||||||
if len(chain):
|
|
||||||
warnings.warn('DEPRECATED. You should pass a Graph instance instead of a chain.')
|
|
||||||
from bonobo import Graph
|
|
||||||
graph = Graph(graph, *chain)
|
|
||||||
|
|
||||||
strategy = create_strategy(strategy)
|
strategy = create_strategy(strategy)
|
||||||
|
|
||||||
plugins = plugins or []
|
plugins = plugins or []
|
||||||
|
|
||||||
if _is_interactive_console():
|
if _is_interactive_console(): # pragma: no cover
|
||||||
from bonobo.ext.console import ConsoleOutputPlugin
|
from bonobo.ext.console import ConsoleOutputPlugin
|
||||||
if ConsoleOutputPlugin not in plugins:
|
if ConsoleOutputPlugin not in plugins:
|
||||||
plugins.append(ConsoleOutputPlugin)
|
plugins.append(ConsoleOutputPlugin)
|
||||||
|
|
||||||
if _is_jupyter_notebook():
|
if _is_jupyter_notebook(): # pragma: no cover
|
||||||
from bonobo.ext.jupyter import JupyterOutputPlugin
|
from bonobo.ext.jupyter import JupyterOutputPlugin
|
||||||
if JupyterOutputPlugin not in plugins:
|
if JupyterOutputPlugin not in plugins:
|
||||||
plugins.append(JupyterOutputPlugin)
|
plugins.append(JupyterOutputPlugin)
|
||||||
|
|||||||
@ -85,41 +85,6 @@ class ContextCurrifier:
|
|||||||
raise RuntimeError('Context processors should not yield more than once.')
|
raise RuntimeError('Context processors should not yield more than once.')
|
||||||
|
|
||||||
|
|
||||||
@deprecated
|
|
||||||
def add_context_processor(cls_or_func, context_processor):
|
|
||||||
getattr(cls_or_func, _CONTEXT_PROCESSORS_ATTR).append(context_processor)
|
|
||||||
|
|
||||||
|
|
||||||
@deprecated
|
|
||||||
def contextual(cls_or_func):
|
|
||||||
"""
|
|
||||||
Make sure an element has the context processors collection.
|
|
||||||
|
|
||||||
:param cls_or_func:
|
|
||||||
"""
|
|
||||||
if not add_context_processor.__name__ in cls_or_func.__dict__:
|
|
||||||
setattr(cls_or_func, add_context_processor.__name__, functools.partial(add_context_processor, cls_or_func))
|
|
||||||
|
|
||||||
if isinstance(cls_or_func, types.FunctionType):
|
|
||||||
try:
|
|
||||||
getattr(cls_or_func, _CONTEXT_PROCESSORS_ATTR)
|
|
||||||
except AttributeError:
|
|
||||||
setattr(cls_or_func, _CONTEXT_PROCESSORS_ATTR, [])
|
|
||||||
return cls_or_func
|
|
||||||
|
|
||||||
if not _CONTEXT_PROCESSORS_ATTR in cls_or_func.__dict__:
|
|
||||||
setattr(cls_or_func, _CONTEXT_PROCESSORS_ATTR, [])
|
|
||||||
|
|
||||||
_processors = getattr(cls_or_func, _CONTEXT_PROCESSORS_ATTR)
|
|
||||||
for processor in cls_or_func.__dict__.values():
|
|
||||||
if isinstance(processor, ContextProcessor):
|
|
||||||
_processors.append(processor)
|
|
||||||
|
|
||||||
# This is needed for python 3.5, python 3.6 should be fine, but it's considered an implementation detail.
|
|
||||||
_processors.sort(key=lambda proc: proc._creation_counter)
|
|
||||||
return cls_or_func
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_processors(mixed):
|
def resolve_processors(mixed):
|
||||||
try:
|
try:
|
||||||
yield from mixed.__processors__
|
yield from mixed.__processors__
|
||||||
|
|||||||
@ -3,7 +3,7 @@ from urllib.parse import urlencode
|
|||||||
import requests # todo: make this a service so we can substitute it ?
|
import requests # todo: make this a service so we can substitute it ?
|
||||||
|
|
||||||
from bonobo.config import Option
|
from bonobo.config import Option
|
||||||
from bonobo.config.processors import ContextProcessor, contextual
|
from bonobo.config.processors import ContextProcessor
|
||||||
from bonobo.config.configurables import Configurable
|
from bonobo.config.configurables import Configurable
|
||||||
from bonobo.util.compat import deprecated
|
from bonobo.util.compat import deprecated
|
||||||
from bonobo.util.objects import ValueHolder
|
from bonobo.util.objects import ValueHolder
|
||||||
@ -50,11 +50,6 @@ class OpenDataSoftAPI(Configurable):
|
|||||||
start.value += self.rows
|
start.value += self.rows
|
||||||
|
|
||||||
|
|
||||||
@deprecated
|
|
||||||
def from_opendatasoft_api(dataset, **kwargs):
|
|
||||||
return OpenDataSoftAPI(dataset=dataset, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'OpenDataSoftAPI',
|
'OpenDataSoftAPI',
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import csv
|
import csv
|
||||||
|
|
||||||
from bonobo.config import Option
|
from bonobo.config import Option
|
||||||
from bonobo.config.processors import ContextProcessor, contextual
|
from bonobo.config.processors import ContextProcessor
|
||||||
from bonobo.constants import NOT_MODIFIED
|
from bonobo.constants import NOT_MODIFIED
|
||||||
from bonobo.util.objects import ValueHolder
|
from bonobo.util.objects import ValueHolder
|
||||||
from .file import FileHandler, FileReader, FileWriter
|
from .file import FileHandler, FileReader, FileWriter
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
from bonobo.config import Option, Service
|
from bonobo.config import Option, Service
|
||||||
from bonobo.config.configurables import Configurable
|
from bonobo.config.configurables import Configurable
|
||||||
from bonobo.config.processors import ContextProcessor, contextual
|
from bonobo.config.processors import ContextProcessor
|
||||||
from bonobo.constants import NOT_MODIFIED
|
from bonobo.constants import NOT_MODIFIED
|
||||||
from bonobo.util.objects import ValueHolder
|
from bonobo.util.objects import ValueHolder
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
from bonobo.config.processors import ContextProcessor, contextual
|
from bonobo.config.processors import ContextProcessor
|
||||||
from .file import FileWriter, FileReader
|
from .file import FileWriter, FileReader
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
|||||||
Reference in New Issue
Block a user