# scipy 1.18.1 (BSD-3-Clause), harvested by tools/harvest_corpus.py
=== input

    Generates a multimethod.

    Parameters
    ----------
    argument_extractor : ArgumentExtractorType
        A callable which extracts the dispatchable arguments. Extracted arguments
        should be marked by the :obj:`Dispatchable` class. It has the same signature
        as the desired multimethod.
    argument_replacer : ArgumentReplacerType
        A callable with the signature (args, kwargs, dispatchables), which should also
        return an (args, kwargs) pair with the dispatchables replaced inside the
        args/kwargs.
    domain : str
        A string value indicating the domain of this multimethod.
    default: Optional[Callable], optional
        The default implementation of this multimethod, where ``None`` (the default)
        specifies there is no default implementation.

    Examples
    --------
    In this example, ``a`` is to be dispatched over, so we return it, while marking it
    as an ``int``.
    The trailing comma is needed because the args have to be returned as an iterable.

    >>> def override_me(a, b):
    ...   return Dispatchable(a, int),

    Next, we define the argument replacer that replaces the dispatchables inside
    args/kwargs with the supplied ones.

    >>> def override_replacer(args, kwargs, dispatchables):
    ...     return (dispatchables[0], args[1]), {}

    Next, we define the multimethod.

    >>> overridden_me = generate_multimethod(
    ...     override_me, override_replacer, "ua_examples"
    ... )

    Notice that there's no default implementation, unless you supply one.

    >>> overridden_me(1, "a")
    Traceback (most recent call last):
        ...
    uarray.BackendNotImplementedError: ...

    >>> overridden_me2 = generate_multimethod(
    ...     override_me, override_replacer, "ua_examples", default=lambda x, y: (x, y)
    ... )
    >>> overridden_me2(1, "a")
    (1, 'a')

    See Also
    --------
    uarray
        See the module documentation for how to override the method by creating
        backends.
    
=== parse numpydoc
short_description: 'Generates a multimethod.'
blank_after_short_description: True
blank_after_long_description: False
style: numpydoc
- DocstringParam
  description: |
    A callable which extracts the dispatchable arguments. Extracted arguments
    should be marked by the :obj:`Dispatchable` class. It has the same signature
    as the desired multimethod.
  kind: param
  key: 'param'
  arg_name: 'argument_extractor'
  type_name: 'ArgumentExtractorType'
  is_optional: False
- DocstringParam
  description: |
    A callable with the signature (args, kwargs, dispatchables), which should also
    return an (args, kwargs) pair with the dispatchables replaced inside the
    args/kwargs.
  kind: param
  key: 'param'
  arg_name: 'argument_replacer'
  type_name: 'ArgumentReplacerType'
  is_optional: False
- DocstringParam
  description: 'A string value indicating the domain of this multimethod.'
  kind: param
  key: 'param'
  arg_name: 'domain'
  type_name: 'str'
  is_optional: False
- DocstringParam
  description: |
    The default implementation of this multimethod, where ``None`` (the default)
    specifies there is no default implementation.
  kind: param
  key: 'param'
  arg_name: 'default'
  type_name: 'Optional[Callable]'
  is_optional: True
  raw_type_name: 'Optional[Callable], optional'
- DocstringExample
  description: |
    In this example, ``a`` is to be dispatched over, so we return it, while marking it
    as an ``int``.
    The trailing comma is needed because the args have to be returned as an iterable.
  kind: examples
  key: 'examples'
  snippet: |
    >>> def override_me(a, b):
    ...   return Dispatchable(a, int),
- DocstringExample
  description: |
    Next, we define the argument replacer that replaces the dispatchables inside
    args/kwargs with the supplied ones.
  kind: examples
  key: 'examples'
  snippet: |
    >>> def override_replacer(args, kwargs, dispatchables):
    ...     return (dispatchables[0], args[1]), {}
- DocstringExample
  description: 'Next, we define the multimethod.'
  kind: examples
  key: 'examples'
  snippet: |
    >>> overridden_me = generate_multimethod(
    ...     override_me, override_replacer, "ua_examples"
    ... )
- DocstringExample
  description: "Notice that there's no default implementation, unless you supply one."
  kind: examples
  key: 'examples'
  snippet: |
    >>> overridden_me(1, "a")
    Traceback (most recent call last):
        ...
    uarray.BackendNotImplementedError: ...
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: |
    >>> overridden_me2 = generate_multimethod(
    ...     override_me, override_replacer, "ua_examples", default=lambda x, y: (x, y)
    ... )
- DocstringExample
  kind: examples
  key: 'examples'
  snippet: |
    >>> overridden_me2(1, "a")
    (1, 'a')
- DocstringMeta
  description: |
    uarray
        See the module documentation for how to override the method by creating
        backends.
  kind: text
  key: 'see_also'
  title: 'See Also'
=== detect
numpydoc
=== compose numpydoc
Generates a multimethod.

Parameters
----------
argument_extractor : ArgumentExtractorType
    A callable which extracts the dispatchable arguments. Extracted arguments
    should be marked by the :obj:`Dispatchable` class. It has the same signature
    as the desired multimethod.
argument_replacer : ArgumentReplacerType
    A callable with the signature (args, kwargs, dispatchables), which should also
    return an (args, kwargs) pair with the dispatchables replaced inside the
    args/kwargs.
domain : str
    A string value indicating the domain of this multimethod.
default : Optional[Callable], optional
    The default implementation of this multimethod, where ``None`` (the default)
    specifies there is no default implementation.

Examples
--------
In this example, ``a`` is to be dispatched over, so we return it, while marking it
as an ``int``.
The trailing comma is needed because the args have to be returned as an iterable.

>>> def override_me(a, b):
...   return Dispatchable(a, int),

Next, we define the argument replacer that replaces the dispatchables inside
args/kwargs with the supplied ones.

>>> def override_replacer(args, kwargs, dispatchables):
...     return (dispatchables[0], args[1]), {}

Next, we define the multimethod.

>>> overridden_me = generate_multimethod(
...     override_me, override_replacer, "ua_examples"
... )

Notice that there's no default implementation, unless you supply one.

>>> overridden_me(1, "a")
Traceback (most recent call last):
    ...
uarray.BackendNotImplementedError: ...
>>> overridden_me2 = generate_multimethod(
...     override_me, override_replacer, "ua_examples", default=lambda x, y: (x, y)
... )
>>> overridden_me2(1, "a")
(1, 'a')

See Also
--------
uarray
    See the module documentation for how to override the method by creating
    backends.
