
    -i                     D    S SK rS SKJr  S rSS.S jrS
S jrSS.S	 jrg)    N)get_namespacec                 8   [        U [        R                  5      (       d  U $  SU R                  R                  ;   a  U $  [        R                  " U 5      n[        R                  " U R                  SU0S9nU R                  US9$ ! [
        [        4 a     NXf = f)zAttach unique values of y to y and return the result.

The result is a view of y, and the metadata (unique) is not attached to y.
unique)metadata)dtype)	
isinstancenpndarrayr   r   AttributeError	TypeErrorr   view)yr   unique_dtypes      H/var/www/html/venv/lib/python3.13/site-packages/sklearn/utils/_unique.py_attach_uniquer   	   s    
 a$$qww'''H (
 YYq\F88AGGx.@AL666%% I& s   B BBF)return_tuplec                 `    [        S U 5       5      n[        U5      S:X  a  U (       d  US   $ U$ )a  Attach unique values of ys to ys and return the results.

The result is a view of y, and the metadata (unique) is not attached to y.

IMPORTANT: The output of this function should NEVER be returned in functions.
This is to avoid this pattern:

.. code:: python

    y = np.array([1, 2, 3])
    y = attach_unique(y)
    y[1] = -1
    # now np.unique(y) will be different from cached_unique(y)

Parameters
----------
*ys : sequence of array-like
    Input data arrays.

return_tuple : bool, default=False
    If True, always return a tuple even if there is only one array.

Returns
-------
ys : tuple of array-like or array-like
    Input data with unique values attached.
c              3   8   #    U  H  n[        U5      v   M     g 7fN)r   ).0r   s     r   	<genexpr> attach_unique.<locals>.<genexpr>8   s     .2aq!!2s      r   tuplelen)r   ysress      r   attach_uniquer      s/    8 .2.
.C
3x1}\1vJ    c                      U R                   R                  b3  SU R                   R                  ;   a  U R                   R                  S   $ [        XS9u  pUR	                  U 5      $ ! [         a     N(f = f)zReturn the unique values of y.

Use the cached values from dtype.metadata if present.

This function does NOT cache the values in y, i.e. it doesn't change y.

Call `attach_unique` to attach the unique values to y.
r   xp)r   r   r   r   unique_values)r   r#   _s      r   _cached_uniquer&   >   sp    77'H8H8H,H77##H-- !#EBA	  s   A	A( (
A54A5r"   c                 Z   ^  [        U 4S jU 5       5      n[        U5      S:X  a  US   $ U$ )a@  Return the unique values of ys.

Use the cached values from dtype.metadata if present.

This function does NOT cache the values in y, i.e. it doesn't change y.

Call `attach_unique` to attach the unique values to y.

Parameters
----------
*ys : sequence of array-like
    Input data arrays.

xp : module, default=None
    Precomputed array namespace module. When passed, typically from a caller
    that has already performed inspection of its own inputs, skips array
    namespace inspection.

Returns
-------
res : tuple of array-like or array-like
    Unique values of ys.
c              3   8   >#    U  H  n[        UTS 9v   M     g7f)r"   N)r&   )r   r   r#   s     r   r    cached_unique.<locals>.<genexpr>i   s     5"QqR("s   r   r   r   )r#   r   r   s   `  r   cached_uniquer*   Q   s.    0 5"5
5C
3x1}1vJr    r   )numpyr	   sklearn.utils._array_apir   r   r   r&   r*    r    r   <module>r.      s,     2&& %* D&  r    