`L i >ddlZddlmZdZdddZd dZddd Zy) N) get_namespacec0t|tjs|S d|jjvr|S tj|}tj|jd|i}|j|S#t t f$rY[wxYw)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) isinstancenpndarrayrrAttributeError TypeErrorrview)yr unique_dtypes [/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/sklearn/utils/_unique.py_attach_uniquer s a $ qww'' 'H ( YYq\F88AGGx.@AL 66 6 %% I &   sBBBF) return_tuplecTtd|D}t|dk(r|s|dS|S)aAttach 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. c32K|]}t|ywN)r).0rs r z attach_unique..8s.aq!.srtuplelen)rysress r attach_uniquers/8 .2. .C 3x1}\1v Jc |jj1d|jjvr|jjdSt||\}}|j |S#t$rY,wxYw)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. rxp)rrr r unique_values)rr"_s r_cached_uniquer%>st 77   'H8H8H,H77##H- - ! #EB  A     sAA** A65A6r!cVtfd|D}t|dk(r|dS|S)aReturn 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. c38K|]}t|yw)r!N)r%)rrr"s rrz cached_unique..is5QqR((5srrr)r"rrs` r cached_uniquer(Qs.0 5"5 5C 3x1}1v Jrr)numpyr sklearn.utils._array_apirrrr%r(rrr,s,2&&%*D&r