Ë
    u™ãjë6  ã                  óÊ  — d Z ddlmZ ddlmZmZ ddlmZmZm	Z	m
Z
 ddlZddlmZ ddlmZ ddlmZmZ erdd	lmZ  e	d
ee«      Z e	deed«      Z	 	 	 	 	 	 	 	 	 	 dd„Z	 	 	 	 	 	 	 	 dd„Z	 	 	 	 	 	 	 	 	 	 dd„Z	 	 	 	 	 	 	 	 dd„Z	 	 	 	 	 	 	 	 dd„Z	 	 	 	 	 	 	 	 	 	 	 	 dd„Z	 	 d 	 	 	 	 	 	 	 	 	 d!d„Z d"d„Z!d#d„Z"e
d$d„«       Z#e
d%d„«       Z#	 	 	 	 d&d„Z#d'd„Z$d(d„Z%d)d„Z&d*d„Z'y)+zV
Module that contains many useful utilities
for validating data or function arguments
é    )Úannotations)ÚIterableÚSequence)ÚTYPE_CHECKINGÚAnyÚTypeVarÚoverloadN)Úlib)ÚNA)Úis_boolÚ
is_integer)ÚDtypeBackendÚBoolishTÚBoolishNoneTc           
     óÊ   — |dk  rt        d«      ‚t        |«      t        |«      kD  r<t        |«      |z   }t        |«      |z   }|dk(  rdnd}t        | › d|› d|› d|› d	�«      ‚y
)zÀ
    Checks whether 'args' has length of at most 'compat_args'. Raises
    a TypeError if that is not the case, similar to in Python when a
    function is called with too many arguments.
    r   z*'max_fname_arg_count' must be non-negativeé   ÚargumentÚ	argumentsz() takes at most ú z (z given)N)Ú
ValueErrorÚlenÚ	TypeError)ÚfnameÚargsÚmax_fname_arg_countÚcompat_argsÚmax_arg_countÚactual_arg_countr   s          úb/var/www/html/python-recuperauto-other/env/lib/python3.12/site-packages/pandas/util/_validators.pyÚ_check_arg_lengthr    $   sŽ   € ð ˜QÒÜÐEÓFÐFä
ˆ4ƒy”3�{Ó#Ò#Ü˜KÓ(Ð+>Ñ>ˆÜ˜t›9Ð':Ñ:ÐØ!.°!Ò!3‘:¸ˆäØˆgÐ& } o°Q°x°jð AØ Ð! ð*ó
ð 	
ð $ó    c                óÜ   — |j                  «       D ]F  \  }}||   }	 |�|�|€|�d}n||k(  }t        |«      st        d«      ‚	 |rŒ6t        d|› d| › d�«      ‚ y# t        $ r ||u }Y Œ&w xY w)zø
    Check that the keys in `arg_val_dict` are mapped to their
    default values as specified in `compat_args`.

    Note that this function is to be called only when it has been
    checked that arg_val_dict.keys() is a subset of compat_args
    NFz'match' is not a booleanzthe 'z=' parameter is not supported in the pandas implementation of z())Úitemsr   r   )r   Úarg_val_dictr   ÚkeyÚv1Úv2Úmatchs          r   Ú_check_for_default_valuesr)   =   s¬   € ð  ×%Ñ%Ó'ò ‰ˆˆRØ˜Ñˆð	ð � 2 :°2°:À"À.Ø‘à˜b™�ä˜5”>Ü Ð!;Ó<Ð<ð "ò ÜØ˜�uð 0Ø05¨w°bð:óð ñ-øô$ ò 	Ø˜"�HŠEð	ús   �&AÁA+Á*A+c                óh   — t        | |||«       t        t        ||d¬«      «      }t        | ||«       y)a  
    Checks whether the length of the `*args` argument passed into a function
    has at most `len(compat_args)` arguments and whether or not all of these
    elements in `args` are set to their default values.

    Parameters
    ----------
    fname : str
        The name of the function being passed the `*args` parameter
    args : tuple
        The `*args` parameter passed into a function
    max_fname_arg_count : int
        The maximum number of arguments that the function `fname`
        can accept, excluding those in `args`. Used for displaying
        appropriate error messages. Must be non-negative.
    compat_args : dict
        A dictionary of keys and their associated default values.
        In order to accommodate buggy behaviour in some versions of `numpy`,
        where a signature displayed keyword arguments but then passed those
        arguments **positionally** internally when calling downstream
        implementations, a dict ensures that the original
        order of the keyword arguments is enforced.

    Raises
    ------
    TypeError
        If `args` contains more values than there are `compat_args`
    ValueError
        If `args` contains values that do not correspond to those
        of the default values specified in `compat_args`
    F©ÚstrictN)r    ÚdictÚzipr)   )r   r   r   r   Úkwargss        r   Úvalidate_argsr0   e   s5   € ôJ �e˜TÐ#6¸ÔDô
 ”#�k 4°Ô6Ó7€FÜ˜e V¨[Õ9r!   c                ó€   — t        |«      t        |«      z
  }|r%t        t        |«      «      }t        | › d|› d�«      ‚y)z}
    Checks whether 'kwargs' contains any keys that are not
    in 'compat_args' and raises a TypeError if there is one.
    z'() got an unexpected keyword argument 'ú'N)ÚsetÚnextÚiterr   )r   r/   r   ÚdiffÚbad_args        r   Ú_check_for_invalid_keysr8   “   sG   € ô ˆv‹;œ˜[Ó)Ñ)€DáÜ”t˜D“zÓ"ˆÜ˜5˜'Ð!HÈÈ	ÐQRÐSÓTÐTð r!   c                óX   — |j                  «       }t        | ||«       t        | ||«       y)aÞ  
    Checks whether parameters passed to the **kwargs argument in a
    function `fname` are valid parameters as specified in `*compat_args`
    and whether or not they are set to their default values.

    Parameters
    ----------
    fname : str
        The name of the function being passed the `**kwargs` parameter
    kwargs : dict
        The `**kwargs` parameter passed into `fname`
    compat_args: dict
        A dictionary of keys that `kwargs` is allowed to have and their
        associated default values

    Raises
    ------
    TypeError if `kwargs` contains keys not in `compat_args`
    ValueError if `kwargs` contains keys in `compat_args` that do not
    map to the default values specified in `compat_args`
    N)Úcopyr8   r)   )r   r/   r   Úkwdss       r   Úvalidate_kwargsr<   ¤   s'   € ð4 �;‰;‹=€DÜ˜E 6¨;Ô7Ü˜e T¨;Õ7r!   c                óö   — t        | |t        |j                  «       «      z   ||«       t        t	        ||d¬«      «      }|D ]  }||v sŒt        | › d|› d�«      ‚ |j                  |«       t        | ||«       y)aý  
    Checks whether parameters passed to the *args and **kwargs argument in a
    function `fname` are valid parameters as specified in `*compat_args`
    and whether or not they are set to their default values.

    Parameters
    ----------
    fname: str
        The name of the function being passed the `**kwargs` parameter
    args: tuple
        The `*args` parameter passed into a function
    kwargs: dict
        The `**kwargs` parameter passed into `fname`
    max_fname_arg_count: int
        The minimum number of arguments that the function `fname`
        requires, excluding those in `args`. Used for displaying
        appropriate error messages. Must be non-negative.
    compat_args: dict
        A dictionary of keys that `kwargs` is allowed to
        have and their associated default values.

    Raises
    ------
    TypeError if `args` contains more values than there are
    `compat_args` OR `kwargs` contains keys not in `compat_args`
    ValueError if `args` contains values not at the default value (`None`)
    `kwargs` contains keys in `compat_args` that do not map to the default
    value as specified in `compat_args`

    See Also
    --------
    validate_args : Purely args validation.
    validate_kwargs : Purely kwargs validation.

    Fr+   z-() got multiple values for keyword argument 'r2   N)r    ÚtupleÚvaluesr-   r.   r   Úupdater<   )r   r   r/   r   r   Ú	args_dictr%   s          r   Úvalidate_args_and_kwargsrB   Ã   sŠ   € ôX Øˆt”e˜FŸM™M›OÓ,Ñ,Ð.AÀ;ôô ”S˜ d°5Ô9Ó:€Iàò ˆØ�&Š=ÜØ�'ÐFÀsÀeÈ1ÐMóð ðð ‡M�M�)ÔÜ�E˜6 ;Õ/r!   c                óª   — t        | «      }|r|xs | du }|r|xs t        | t        «      }|s%t        d|› dt	        | «      j
                  › d�«      ‚| S )aR  
    Ensure that argument passed in arg_name can be interpreted as boolean.

    Parameters
    ----------
    value : bool
        Value to be validated.
    arg_name : str
        Name of the argument. To be reflected in the error message.
    none_allowed : bool, default True
        Whether to consider None to be a valid boolean.
    int_allowed : bool, default False
        Whether to consider integer value to be a valid boolean.

    Returns
    -------
    value
        The same value as input.

    Raises
    ------
    ValueError
        If the value is not a valid boolean.
    NzFor argument "z$" expected type bool, received type ú.)r   Ú
isinstanceÚintr   ÚtypeÚ__name__)ÚvalueÚarg_nameÚnone_allowedÚint_allowedÚ
good_values        r   Úvalidate_bool_kwargrN     sl   € ô< ˜“€JÙØÒ2 E¨T Mˆ
áØÒ9¤:¨e´SÓ#9ˆ
áÜØ˜X˜Jð 'Ü˜“K×(Ñ(Ð)¨ð,ó
ð 	
ð €Lr!   c                óÐ   — | t         j                  u sDt        | t        «      s4| �2| t        u s*t        j
                  | «      rt        j                  | «      ryt        |› d| › �«      ‚)a   
    Validate na arguments.

    Parameters
    ----------
    value : object
        Value to validate.
    name : str
        Name of the argument, used to raise an informative error message.

    Raises
    ------
    ValueError
        When ``value`` is determined to be invalid.
    Nz2 must be None, pd.NA, np.nan, True, or False; got )	r
   Ú
no_defaultrE   Úboolr   Úis_floatÚnpÚisnanr   )rI   Únames     r   Úvalidate_na_argrV   .  sW   € ð" 	”—‘ÑÜ�eœTÔ"Øˆ=Ø”B‰;Ü�L‰L˜Ô¤B§H¡H¨U¤OàÜ
˜�vÐOÐPUÈwÐWÓ
XÐXr!   c                óÔ   — t        j                  | «      }d}|j                  dk(  r$d|cxk  rdk  st        |«      ‚ t        |«      ‚|S t	        d„ |D «       «      st        |«      ‚|S )aå  
    Validate percentiles (used by describe and quantile).

    This function checks if the given float or iterable of floats is a valid percentile
    otherwise raises a ValueError.

    Parameters
    ----------
    q: float or iterable of floats
        A single percentile or an iterable of percentiles.

    Returns
    -------
    ndarray
        An ndarray of the percentiles if valid.

    Raises
    ------
    ValueError if percentiles are not in given interval([0, 1]).
    z0percentiles should all be in the interval [0, 1]r   r   c              3  ó<   K  — | ]  }d |cxk  xr dk  nc –— Œ y­w)r   r   N© )Ú.0Úqss     r   ú	<genexpr>z&validate_percentile.<locals>.<genexpr>e  s   è ø€ Ò. "��b–˜A—�Ñ.ùs   ‚)rS   ÚasarrayÚndimr   Úall)ÚqÚq_arrÚmsgs      r   Úvalidate_percentilerc   I  sm   € ô* �J‰J�q‹M€Eð =€CØ‡z�z�Q‚Ø�EŒ˜QŠÜ˜S“/Ð!ð Ü˜S“/Ð!ð €Lô Ñ.¨Ô.Ô.Ü˜‹oÐØ€Lr!   c                 ó   — y ©NrY   ©Ú	ascendings    r   Úvalidate_ascendingrh   j  s   € Ø9<r!   c                 ó   — y re   rY   rf   s    r   rh   rh   n  s   € ØILr!   c                ó†   — dddœ}t        | t        «      st        | dfi |¤ŽS | D �cg c]  }t        |dfi |¤Ž‘Œ c}S c c}w )z8Validate ``ascending`` kwargs for ``sort_index`` method.FT)rK   rL   rg   )rE   r   rN   )rg   r/   Úitems      r   rh   rh   r  sK   € ð $°DÑ9€FÜ�i¤Ô*Ü" 9¨kÑD¸VÑDÐDàIRÖSÀÔ  kÑ<°VÓ<ÒSÐSùÒSs   §>c                ó`   — d}d}| €d}d}||fS | dk(  rd}||fS | dk(  rd}||fS t        d«      ‚)a%  
    Check that the `closed` argument is among [None, "left", "right"]

    Parameters
    ----------
    closed : {None, "left", "right"}

    Returns
    -------
    left_closed : bool
    right_closed : bool

    Raises
    ------
    ValueError : if argument is not among valid values
    FTÚleftÚrightz/Closed has to be either 'left', 'right' or None)r   )ÚclosedÚleft_closedÚright_closeds      r   Úvalidate_endpointsrr   }  sp   € ð" €KØ€Là€~ØˆØˆð ˜Ð$Ð$ð 
�6Ò	Øˆð ˜Ð$Ð$ð 
�7Ò	Øˆð ˜Ð$Ð$ô ÐJÓKÐKr!   c                óp   — d}t        | t        «      rdddddœj                  | «      }|€t        d«      ‚|S )aD  
    Check that the `inclusive` argument is among {"both", "neither", "left", "right"}.

    Parameters
    ----------
    inclusive : {"both", "neither", "left", "right"}

    Returns
    -------
    left_right_inclusive : tuple[bool, bool]

    Raises
    ------
    ValueError : if argument is not among valid values
    N)TT©TF)FT)FF)Úbothrm   rn   Úneitherz?Inclusive has to be either 'both', 'neither', 'left' or 'right')rE   ÚstrÚgetr   )Ú	inclusiveÚleft_right_inclusives     r   Úvalidate_inclusiver{   ž  sU   € ð  6:Ðä�)œSÔ!à Ø!Ø"Ø%ñ	 
÷
 ‰#ˆi‹.ð 	ð Ð#ÜØMó
ð 	
ð  Ðr!   c                óŽ   — t        | «      st        d|› d|› �«      ‚| dk  r| |z  } d| cxk  r|k  sn t        d|› d|› �«      ‚| S )z¼
    Check that we have an integer between -length and length, inclusive.

    Standardize negative loc to within [0, length].

    The exceptions we raise on failure match np.insert.
    z loc must be an integer between -z and r   )r   r   Ú
IndexError)ÚlocÚlengths     r   Úvalidate_insert_locr€   À  s_   € ô �cŒ?ÜÐ:¸6¸(À%ÈÀxÐPÓQÐQà
ˆQ‚wØˆv‰ˆØ�Ô�vÔÜÐ;¸F¸8À5ÈÈÐQÓRÐRØ€Jr!   c                óP   — | t         j                  ur| dvrt        d| › d�«      ‚y y )N)Únumpy_nullableÚpyarrowzdtype_backend z= is invalid, only 'numpy_nullable' and 'pyarrow' are allowed.)r
   rP   r   )Údtype_backends    r   Úcheck_dtype_backendr…   Ò  s?   € ØœCŸN™NÑ*ØÐ =Ñ=ÜØ   ð 0)ð *óð ð >ð +r!   )
r   ú
str | Noner   útuple[Any, ...]r   rF   r   údict[str, Any]ÚreturnÚNone)r   r†   r$   rˆ   r   rˆ   r‰   rŠ   )r   r†   r/   rˆ   r   rˆ   r‰   rŠ   )r   r†   r   r‡   r/   rˆ   r   rF   r   rˆ   r‰   rŠ   rt   )
rI   r   rJ   rw   rK   rQ   rL   rQ   r‰   r   )rI   ÚobjectrU   rw   r‰   rŠ   )r`   zfloat | Iterable[float]r‰   z
np.ndarray)rg   r   r‰   r   )rg   zSequence[BoolishT]r‰   zlist[BoolishT])rg   zbool | int | Sequence[BoolishT]r‰   zbool | int | list[BoolishT])ro   r†   r‰   útuple[bool, bool])ry   r†   r‰   rŒ   )r~   rF   r   rF   r‰   rF   )r„   zDtypeBackend | lib.NoDefaultr‰   rŠ   )(Ú__doc__Ú
__future__r   Úcollections.abcr   r   Útypingr   r   r   r	   ÚnumpyrS   Úpandas._libsr
   Úpandas._libs.missingr   Úpandas.core.dtypes.commonr   r   Úpandas._typingr   rQ   rF   r   r   r    r)   r0   r8   r<   rB   rN   rV   rc   rh   rr   r{   r€   r…   rY   r!   r   ú<module>r–      s  ðñõ
 #÷÷ó ó å Ý #÷ñ
 Ý+á�:˜t SÓ)€Ù�~ t¨S°$Ó7€ð
Øð
à
ð
ð ð
ð  ð	
ð
 
ó
ð2%Øð%à ð%ð  ð%ð 
ó	%ðP+:Øð+:à
ð+:ð ð+:ð  ð	+:ð
 
ó+:ð\UØðUàðUð  ðUð 
ó	Uð"8Øð8àð8ð  ð8ð 
ó	8ð>;0Øð;0à
ð;0ð ð;0ð ð	;0ð
  ð;0ð 
ó;0ðB Øð	*Øð*àð*ð ð*ð ð	*ð
 ó*óZYó6ðB 
Ú <ó 
Ø <ð 
Ú Ló 
Ø LðTØ.ðTà óTó%óB óDô$r!   