8.2.8.23.42. __doc__ΒΆ

SubDispatchPipe.__doc__ = "\n    It converts a :class:`~schedula.dispatcher.Dispatcher` into a function.\n\n    This function takes a sequence of arguments as input of the dispatch.\n\n    :return:\n        A function that executes the pipe of the given `dsp`.\n    :rtype: callable\n\n    .. seealso:: :func:`~schedula.dispatcher.Dispatcher.dispatch`,\n       :func:`~schedula.dispatcher.Dispatcher.shrink_dsp`\n\n    **Example**:\n\n    A dispatcher with two functions `max` and `min` and an unresolved cycle\n    (i.e., `a` --> `max` --> `c` --> `min` --> `a`):\n\n    .. dispatcher:: dsp\n       :opt: graph_attr={'ratio': '1'}\n\n        >>> from schedula import Dispatcher\n        >>> dsp = Dispatcher(name='Dispatcher')\n        >>> dsp.add_function('max', max, inputs=['a', 'b'], outputs=['c'])\n        'max'\n        >>> def func(x):\n        ...     return x - 1\n        >>> dsp.add_function('x - 1', func, inputs=['c'], outputs=['a'])\n        'x - 1'\n\n    Extract a static function node, i.e. the inputs `a` and `b` and the\n    output `a` are fixed::\n\n        >>> fun = SubDispatchPipe(dsp, 'myF', ['a', 'b'], ['a'])\n        >>> fun.__name__\n        'myF'\n        >>> fun(2, 1)\n        1\n\n    .. dispatcher:: fun\n       :opt: workflow=True, graph_attr={'ratio': '1'}\n\n        >>> fun.dsp.name = 'Created function internal'\n\n    The created function raises a ValueError if un-valid inputs are\n    provided:\n\n    .. dispatcher:: fun\n       :opt: workflow=True, graph_attr={'ratio': '1'}\n       :code:\n\n        >>> fun(1, 0)\n        0\n    "