+
    ei   c                   sH    R t R.tR tR tR tR tR tR t ! R R4      tR	# )
zG
Mixin classes for custom array types that don't inherit from ndarray.
NDArrayOperatorsMixinc                sD     V P                   RJ #   \         d     R# i ; i)z)True when __array_ufunc__ is set to None.NF)Z__array_ufunc__ZAttributeError)Zobjs   &7/usr/lib64/python3.14/site-packages/numpy/lib/mixins.py_disables_array_ufuncr      s*    ""d** s    c                *   a  V 3R lpRV R2Vn         V# )z>Implement a forward binary method with a ufunc, e.g., __add__.c                 sB   < \        V4      '       d   \        # S! W4      # Nr   ZNotImplementedselfZotherufunc   &&r   funcZ_binary_method.<locals>.func   s     ''!!T!!    ____name__r   namer
      f& r   _binary_methodr      s    " bMDMKr   c                *   a  V 3R lpRV R2Vn         V# )zAImplement a reflected binary method with a ufunc, e.g., __radd__.c                 sB   < \        V4      '       d   \        # S! W4      # r   r   r   r	   r   r
   Z&_reflected_binary_method.<locals>.func   s     ''!!U!!r   Z__rr   r   r   r   r   _reflected_binary_methodr      s    " $rNDMKr   c                r   )zAImplement an in-place binary method with a ufunc, e.g., __iadd__.c                 s   < S! WV 3R 7      # ))Zout r   r	   r   r
   Z$_inplace_binary_method.<locals>.func&   s    Ttg..r   Z__ir   r   r   r   r   _inplace_binary_methodr   $   s    /$rNDMKr   c                sB    \        W4      \        W4      \        W4      3# )zEImplement forward, reflected and inplace binary methods with a ufunc.)r   r   r   )r   r   s   &&r   _numeric_methodsr   ,   s$    5'$U1"5/1 1r   c                r   )z.Implement a unary special method with a ufunc.c                 s   < S! V 4      # r   r   )r   r   s   &r   r
   Z_unary_method.<locals>.func5   s    T{r   r   r   r   r   r   _unary_methodr   3   s    bMDMKr   c                   sH   ] tR t^;tRt^ RIHt Rt]	! ]P                  R4      t]	! ]P                  R4      t]	! ]P                  R4      t]	! ]P                   R4      t]	! ]P$                  R4      t]	! ]P(                  R4      t]! ]P.                  R	4      w  ttt]! ]P6                  R
4      w  ttt]! ]P>                  R4      w  t t!t"]! ]PF                  R4      w  t$t%t&]! ]PN                  R4      w  t(t)t*]! ]PV                  R4      w  t,t-t.]! ]P^                  R4      w  t0t1t2]	! ]Pf                  R4      t4]5! ]Pf                  R4      t6]! ]Pn                  R4      w  t8t9t:]! ]Pv                  R4      w  t<t=t>]! ]P~                  R4      w  t@tAtB]! ]P                  R4      w  tDtEtF]! ]P                  R4      w  tHtItJ]! ]P                  R4      w  tLtMtN]O! ]P                  R4      tQ]O! ]P                  R4      tS]O! ]P                  R4      tU]O! ]P                  R4      tWRtXR# )r    a  Mixin defining all operator special methods using __array_ufunc__.

This class implements the special methods for almost all of Python's
builtin operators defined in the `operator` module, including comparisons
(``==``, ``>``, etc.) and arithmetic (``+``, ``*``, ``-``, etc.), by
deferring to the ``__array_ufunc__`` method, which subclasses must
implement.

It is useful for writing classes that do not inherit from `numpy.ndarray`,
but that should support arithmetic and numpy universal functions like
arrays as described in :external+neps:doc:`nep-0013-ufunc-overrides`.

As an trivial example, consider this implementation of an ``ArrayLike``
class that simply wraps a NumPy array and ensures that the result of any
arithmetic operation is also an ``ArrayLike`` object:

    >>> import numbers
    >>> class ArrayLike(np.lib.mixins.NDArrayOperatorsMixin):
    ...     def __init__(self, value):
    ...         self.value = np.asarray(value)
    ...
    ...     # One might also consider adding the built-in list type to this
    ...     # list, to support operations like np.add(array_like, list)
    ...     _HANDLED_TYPES = (np.ndarray, numbers.Number)
    ...
    ...     def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
    ...         out = kwargs.get('out', ())
    ...         for x in inputs + out:
    ...             # Only support operations with instances of
    ...             # _HANDLED_TYPES. Use ArrayLike instead of type(self)
    ...             # for isinstance to allow subclasses that don't
    ...             # override __array_ufunc__ to handle ArrayLike objects.
    ...             if not isinstance(
    ...                 x, self._HANDLED_TYPES + (ArrayLike,)
    ...             ):
    ...                 return NotImplemented
    ...
    ...         # Defer to the implementation of the ufunc
    ...         # on unwrapped values.
    ...         inputs = tuple(x.value if isinstance(x, ArrayLike) else x
    ...                     for x in inputs)
    ...         if out:
    ...             kwargs['out'] = tuple(
    ...                 x.value if isinstance(x, ArrayLike) else x
    ...                 for x in out)
    ...         result = getattr(ufunc, method)(*inputs, **kwargs)
    ...
    ...         if type(result) is tuple:
    ...             # multiple return values
    ...             return tuple(type(self)(x) for x in result)
    ...         elif method == 'at':
    ...             # no return value
    ...             return None
    ...         else:
    ...             # one return value
    ...             return type(self)(result)
    ...
    ...     def __repr__(self):
    ...         return '%s(%r)' % (type(self).__name__, self.value)

In interactions between ``ArrayLike`` objects and numbers or numpy arrays,
the result is always another ``ArrayLike``:

    >>> x = ArrayLike([1, 2, 3])
    >>> x - 1
    ArrayLike(array([0, 1, 2]))
    >>> 1 - x
    ArrayLike(array([ 0, -1, -2]))
    >>> np.arange(3) - x
    ArrayLike(array([-1, -1, -1]))
    >>> x - np.arange(3)
    ArrayLike(array([1, 1, 1]))

Note that unlike ``numpy.ndarray``, ``ArrayLike`` does not allow operations
with arbitrary, unrecognized types. This ensures that interactions with
ArrayLike preserve a well-defined casting hierarchy.

)umathZltZleZeqZneZgtZgeaddZsubZmulmatmulZtruedivZfloordivZmoddivmodZpowZlshiftZrshiftZandZxorZorZnegZposZabsinvertr   N)Yr   Z
__module__Z__qualname__Z__firstlineno____doc__Znumpy._corer   ZumZ	__slots__r   ZlessZ__lt__Z
less_equalZ__le__ZequalZ__eq__Z	not_equalZ__ne__ZgreaterZ__gt__Zgreater_equalZ__ge__r   r   Z__add__Z__radd__Z__iadd__ZsubtractZ__sub__Z__rsub__Z__isub__ZmultiplyZ__mul__Z__rmul__Z__imul__r   Z
__matmul__Z__rmatmul__Z__imatmul__Ztrue_divideZ__truediv__Z__rtruediv__Z__itruediv__Zfloor_divideZ__floordiv__Z__rfloordiv__Z__ifloordiv__Z	remainderZ__mod__Z__rmod__Z__imod__r   Z
__divmod__r   Z__rdivmod__ZpowerZ__pow__Z__rpow__Z__ipow__Z
left_shiftZ
__lshift__Z__rlshift__Z__ilshift__Zright_shiftZ
__rshift__Z__rrshift__Z__irshift__Zbitwise_andZ__and__Z__rand__Z__iand__Zbitwise_xorZ__xor__Z__rxor__Z__ixor__Z
bitwise_orZ__or__Z__ror__Z__ior__r   ZnegativeZ__neg__ZpositiveZ__pos__ZabsoluteZ__abs__r   Z
__invert__Z__static_attributes__r   r   r   r    r    ;   s   M\ (I
 BGGT*FBMM40FBHHd+FBLL$/FBJJ-FB,,d3F #32665"AGXx"22;;"FGXx"22;;"FGXx+;
		8,(J[.>
	/#+K|1A
2%.L-"22<<"GGXx		84J*299h?K #3288U"CGXx+;
x,!(J[+;
,"(J["22>>5"IGXx"22>>5"IGXx/tDFGW BKK/GBKK/GBKK/Gryy(3Jr   N)	r   Z__all__r   r   r   r   r   r   r    r   r   r   <module>r      s>    #
#1y4 y4r   