
    Kh+                         S r SSKrSSKrSSKJr  SSKJr  SSKJrJ	r	J
r
  \" 5       rSrSS jrS	 r\" \
S
5        \" \	S5        \R                   " SS5      rS r  SS jr SS jrg)z;Implementation of __array_function__ overrides from NEP-18.    N   )
set_module)
getargspec)add_docstring_get_implementing_args_ArrayFunctionDispatcherar  like : array_like, optional
        Reference object to allow the creation of arrays which are not
        NumPy arrays. If an array-like passed in as ``like`` supports
        the ``__array_function__`` protocol, the result will be defined
        by it. In this case, it ensures the creation of an array object
        compatible with that passed in via this argument.c                     [         R                  U 5        U R                  =(       d    UnUR                  S[        5      $ )Nz${ARRAY_FUNCTION_LIKE})ARRAY_FUNCTIONSadd__doc__replacearray_function_like_doc)
public_apidocstring_template	docstrings      G/var/www/html/env/lib/python3.13/site-packages/numpy/_core/overrides.pyget_array_function_like_docr      s6    
#""8&8I57NOO    c                 &    [        U 5      U l        U $ N)r   r   )r   s    r   finalize_array_function_liker      s    4Z@Jr   a  
    Class to wrap functions with checks for __array_function__ overrides.

    All arguments are required, and can only be passed by position.

    Parameters
    ----------
    dispatcher : function or None
        The dispatcher function that returns a single sequence-like object
        of all arguments relevant.  It must have the same signature (except
        the default values) as the actual implementation.
        If ``None``, this is a ``like=`` dispatcher and the
        ``_ArrayFunctionDispatcher`` must be called with ``like`` as the
        first (additional and positional) argument.
    implementation : function
        Function that implements the operation on NumPy arrays without
        overrides.  Arguments passed calling the ``_ArrayFunctionDispatcher``
        will be forwarded to this (and the ``dispatcher``) as if using
        ``*args, **kwargs``.

    Attributes
    ----------
    _implementation : function
        The original implementation passed in.
    ar  
    Collect arguments on which to call __array_function__.

    Parameters
    ----------
    relevant_args : iterable of array-like
        Iterable of possibly array-like arguments to check for
        __array_function__ methods.

    Returns
    -------
    Sequence of arguments with __array_function__ methods, in the order in
    which they should be called.
    ArgSpeczargs varargs keywords defaultsc                 H   [        [        U 5      6 n[        [        U5      6 nUR                  UR                  :w  d  UR                  UR                  :w  d  UR                  UR                  :w  de  [        UR                  5      [        UR                  5      :w  d9  UR                  b:  [        UR                  5      [        UR                  5      :w  a  [        SU -  5      eUR                  b2  UR                  S[        UR                  5      -  :w  a  [        S5      egg)z:Verify that a dispatcher function has the right signature.NzGimplementation and dispatcher for %s have different function signaturesr   zBdispatcher functions can only use None for default argument values)	r   r   argsvarargskeywordsbooldefaultslenRuntimeError)implementation
dispatcherimplementation_specdispatcher_specs       r   verify_matching_signaturesr%   S   s   !:n#=>z*56O  O$8$88''?+B+BB((O,D,DD%..//**+, ))5$--.))*+ ;=KL M 	M ##/##w_5M5M1N'NN  9 : : O 0r   c                     ^ ^^^ U UUU4S jnU$ )a  Decorator for adding dispatch with the __array_function__ protocol.

See NEP-18 for example usage.

Parameters
----------
dispatcher : callable or None
    Function that when called like ``dispatcher(*args, **kwargs)`` with
    arguments from the NumPy function call returns an iterable of
    array-like arguments to check for ``__array_function__``.

    If `None`, the first argument is used as the single `like=` argument
    and not passed on.  A function implementing `like=` must call its
    dispatcher with `like` as the first non-keyword argument.
module : str, optional
    __module__ attribute to set on new function, e.g., ``module='numpy'``.
    By default, module is copied from the decorated function.
verify : bool, optional
    If True, verify the that the signature of the dispatcher and decorated
    function signatures match exactly: all required and optional arguments
    should appear in order with the same names, but the default values for
    all optional arguments should be ``None``. Only disable verification
    if the dispatcher's signature needs to deviate for some particular
    reason, e.g., because the function has a signature like
    ``func(*args, **kwargs)``.
docs_from_dispatcher : bool, optional
    If True, copy docs from the dispatcher function onto the dispatched
    function, rather than from the implementation. This is useful for
    functions defined in C, which otherwise don't have docstrings.

Returns
-------
Function suitable for decorating the implementation of a NumPy function.

c                   > T(       al  Tb  [        U T5        O\U R                  nUR                  UR                  -   S-
  nUR                  U   nUS:w  d  UR                  S:X  a  [        SU  S35      eT(       a  [        U TR                  5        [        TU 5      n[        R                  " U 5      " U5      nTb  TUl        [        R                  U5        U$ )N   liker   zX__array_function__ expects `like=` to be the last argument and a keyword-only argument. z does not seem to comply.)r%   __code__co_argcountco_kwonlyargcountco_varnamesr    r   r   r   	functoolswraps
__module__r
   r   )r!   colast_argr   r"   docs_from_dispatchermoduleverifys       r   	decorator*array_function_dispatch.<locals>.decorator   s    %*>:F $,,>>B,@,@@1D>>(3v%)=)=)B&A)**CEF F
  .**<*<=-j.I
__^4Z@
$*J!J'r    )r"   r4   r5   r3   r6   s   ```` r   array_function_dispatchr9   i   s    J 8 r   c                     ^ ^^^ UU UU4S jnU$ )zDLike array_function_dispatcher, but with function arguments flipped.c                 (   > [        U TTTS9" T5      $ )N)r5   r3   )r9   )r"   r3   r!   r4   r5   s    r   r6   1array_function_from_dispatcher.<locals>.decorator   s$    &v!577EG 	Gr   r8   )r!   r4   r5   r3   r6   s   ```` r   array_function_from_dispatcherr=      s    G G r   ) )NNTF)NTT)r   collectionsr.   _utilsr   _utils._inspectr   numpy._core._multiarray_umathr   r   r   setr
   r   r   r   
namedtupler   r%   r9   r=   r8   r   r   <module>rE      s    A    (F F %= P

 	< 	$ 
 
 ,L
M:, BF16AJ HLr   