ó
    ¨ñ:ie  ã                   ój  • S r SSKrSSKrSSKrSSKrSSKrSSKrSSKJ	r	  SSK
JrJr  \	" \R                  5      r\	" \R                  5      rSS jr\\	" S5      :¼  a  SSKJr  O	SS	KJr  S
 r\\	" S5      :  a  S rOSSKJr  \\	" S5      :  a  S\4S jrOSSKJr   SSKJr  g! \ a    S r gf = f)zÀCompatibility fixes for older version of python, numpy, scipy, and
scikit-learn.

If you add content to this file, please give the version of the package at
which the fix is no longer needed.
é    N)Úparse_versioné   )Úconfig_contextÚ
get_configc                 óž   • [         [        S5      :¼  a  [        R                  R	                  XSS9$ [        R                  R	                  XS9$ )Nz1.9.0T)ÚaxisÚkeepdims)r   )Ú
sp_versionr   ÚscipyÚstatsÚmode)Úar   s     ÚW/srv/projetos/modelo_ml_acdoc/venv/lib/python3.13/site-packages/imblearn/utils/fixes.pyÚ_moder      sA   € Ü”] 7Ó+Ó+Ü�{‰{×Ñ °tÐÐ<Ð<Ü�;‰;×Ñ˜AÐÐ)Ð)ó    z1.1)Ú_is_arraylike_not_scalar)Ú_is_arraylikec                 ó\   • [        U 5      =(       a    [        R                  " U 5      (       + $ )z3Return True if array is array-like and not a scalar)r   ÚnpÚisscalar)Úarrays    r   r   r   #   s   € ä˜UÓ#×>¬B¯KªK¸Ó,>Ô(>Ð>r   z1.3c                 ó   ^ • U 4S jnU$ )aÿ  Decorator to run the fit methods of estimators within context managers.

Parameters
----------
prefer_skip_nested_validation : bool
    If True, the validation of parameters of inner estimators or functions
    called during fit will be skipped.

    This is useful to avoid validating many times the parameters passed by the
    user from the public facing API. It's also useful to avoid validating
    parameters that we pass internally to inner functions that are guaranteed to
    be valid by the test suite.

    It should be set to True for most estimators, except for those that receive
    non-validated objects as parameters, such as meta-estimators that are given
    estimator objects.

Returns
-------
decorated_fit : method
    The decorated fit method.
c                 óJ   >^ • [         R                  " T 5      U U4S j5       nU$ )Nc                 ó  >• [        5       S   nTR                  S:H  =(       a    [        U 5      nU(       d  U(       d  U R                  5         [	        T=(       d    US9   T" U /UQ70 UD6sS S S 5        $ ! , (       d  f       g = f)NÚskip_parameter_validationÚpartial_fit)r   )r   Ú__name__Ú
_is_fittedÚ_validate_paramsr   )Ú	estimatorÚargsÚkwargsÚglobal_skip_validationÚpartial_fit_and_fittedÚ
fit_methodÚprefer_skip_nested_validations        €€r   ÚwrapperÚ0_fit_context.<locals>.decorator.<locals>.wrapperD   sy   ø€ ä)3«Ð6QÑ)RÐ&ð ×'Ñ'¨=Ñ8×R¼ZÈ	Ó=Rð 'ö .Ö6LØ×.Ñ.Ô0ä#à5×OÐ9Oóñ
 & iÐA°$ÒA¸&ÑA÷÷ ÷ ús   Á A6Á6
B)Ú	functoolsÚwraps)r%   r'   r&   s   ` €r   Ú	decoratorÚ_fit_context.<locals>.decoratorC   s'   ù€ Ü�_Š_˜ZÓ(õBó )ðBð$ ˆNr   © )r&   r+   s   ` r   Ú_fit_contextr.   +   s   ø€ õ0	ð, Ðr   )r.   c           	      óŽ  • Ub@  [        U[        [        45      (       d  U/nU" U Vs/ s H  n[        X5      PM     sn5      $ [        U S5      (       a  U R	                  5       $ [        U 5       Vs/ s H4  oDR                  S5      (       d  M  UR                  S5      (       a  M2  UPM6     nn[        U5      S:„  $ s  snf s  snf )a�  Determine if an estimator is fitted

Parameters
----------
estimator : estimator instance
    Estimator instance for which the check is performed.

attributes : str, list or tuple of str, default=None
    Attribute name(s) given as string or a list/tuple of strings
    Eg.: ``["coef_", "estimator_", ...], "coef_"``

    If `None`, `estimator` is considered fitted if there exist an
    attribute that ends with a underscore and does not start with double
    underscore.

all_or_any : callable, {all, any}, default=all
    Specify whether all or any of the given attributes must exist.

Returns
-------
fitted : bool
    Whether the estimator is fitted.
Ú__sklearn_is_fitted__Ú_Ú__r   )	Ú
isinstanceÚlistÚtupleÚhasattrr0   ÚvarsÚendswithÚ
startswithÚlen)r    Ú
attributesÚ
all_or_anyÚattrÚvÚfitted_attrss         r   r   r   a   s²   € ð0 Ñ!Ü˜j¬4´¨-×8Ñ8Ø(˜\�
ÙÁJÓOÂJ¸Dœw yÖ7ÁJÑOÓPÐPä�9Ð5×6Ñ6Ø×2Ñ2Ó4Ð4ô ˜I”ó
Ú&�!¯*©*°S¯/‹AÀ!Ç,Á,Èt×BT�A‘ð 	ð 
ô �<Ó  1Ñ$Ð$ùò Pùò

s   ¨B=Á2CÂCÂ'C)r   )Ú_is_pandas_dfc                 óº   • [        U S5      (       a:  [        U S5      (       a)   [        R                  S   n[	        XR
                  5      $ g! [         a     gf = f)z+Return True if the X is a pandas dataframe.ÚcolumnsÚilocÚpandasF)r6   ÚsysÚmodulesÚKeyErrorr3   Ú	DataFrame)ÚXÚpds     r   r@   r@   �   sV   € ä�1�i× Ñ ¤W¨Q°×%7Ñ%7ðÜ—[‘[ Ñ*�ô ˜a§¡Ó.Ð.Øøô ó Ùðús   ¤A Á
AÁA)r   )Ú__doc__r)   rE   Únumpyr   r   Úscipy.statsÚsklearnÚsklearn.utils.fixesr   Ú_configr   r   Ú__version__r
   Úsklearn_versionr   Úsklearn.utils.validationr   r   r.   Úsklearn.baseÚallr   r@   ÚImportErrorr-   r   r   Ú<module>rW      s¸   ðñó Û 
ã Û Û Û Ý -ç 0á˜5×,Ñ,Ó-€
Ù × 3Ñ 3Ó4€ô*ð ‘m EÓ*Ó*ÞAå6ò?ð ‘] 5Ó)Ó)ó.õb *ð ‘] 5Ó)Ó)à)-¸#õ #%õL 4ðÞ6øØó ô	ðús   ÂB& Â&	B2Â1B2