ó
    ®œ‘hÜ7  ã                  ó`  • S r SSKJr  SSKJrJr  SSKJrJr  SSK	r
SSKJr  SSKJrJr  \" S\\5      r\" S	\\S5      rSS
 jrSS jrSS jrSS jrSS jr  SS jr  S         SS jjrSSS jjrSS jr\S S j5       r\S!S j5       r    S"S jrS#S jrS$S jrS%S jr SS jr!g)&zV
Module that contains many useful utilities
for validating data or function arguments
é    )Úannotations)ÚIterableÚSequence)ÚTypeVarÚoverloadN)Úlib)Úis_boolÚ
is_integerÚBoolishTÚBoolishNoneTc           
     óÐ   • US:  a  [        S5      e[        U5      [        U5      :”  a=  [        U5      U-   n[        U5      U-   nUS:X  a  SOSn[        U  SU SU SU S	35      eg
)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          Ú[C:\Users\psant\Downloads\Noiseback\school\venv\Lib\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                óè   • U HT  n X   nX#   nUb  Ub  Uc  Ub  SnOXE:H  n[        U5      (       d  [        S5      e U(       a  MD  [        SU SU  S35      e   g! [         a    X   X#   L n N2f = f)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())r	   r   )r   Úarg_val_dictr   ÚkeyÚv1Úv2Úmatchs          r   Ú_check_for_default_valuesr$   1   s©   € ó ˆð	:ØÑ"ˆBØÑ!ˆBð ‘ 2¡:°2±:À"Á.Ø‘à™�ä˜5—>‘>Ü Ð!;Ó<Ð<ð "÷ ˆuÜØ˜�uð 0Ø05¨w°bð:óð ò1 øô( ó 	:Ø Ñ%¨Ñ)9Ð9ŠEð	:ús   ‡6AÁA1Á0A1c                ó\   • [        XX#5        [        [        X15      5      n[        XU5        g)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`
N)r   ÚdictÚzipr$   )r   r   r   r   Úkwargss        r   Úvalidate_argsr)   W   s+   € ô@ �eÐ#6ÔDô
 ”#�kÓ(Ó)€FÜ˜e¨[Õ9r   c                óŠ   • [        U5      [        U5      -
  nU(       a%  [        [        U5      5      n[        U  SU S35      eg)zq
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_keysr1   €   sG   € ô ˆv‹;œ˜[Ó)Ñ)€DæÜ”t˜D“zÓ"ˆÜ˜5˜'Ð!HÈÈ	ÐQRÐSÓTÐTð r   c                óT   • UR                  5       n[        XU5        [        XU5        g)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)Úcopyr1   r$   )r   r(   r   Úkwdss       r   Úvalidate_kwargsr5   �   s#   € ð, �;‰;‹=€DÜ˜E¨;Ô7Ü˜e¨;Õ7r   c                óð   • [        X[        UR                  5       5      -   X45        [        [	        XA5      5      nU H  nXb;   d  M
  [        U  SU S35      e   UR                  U5        [        XU5        g)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.

z-() got multiple values for keyword argument 'r+   N)r   ÚtupleÚvaluesr&   r'   r   Úupdater5   )r   r   r(   r   r   Ú	args_dictr    s          r   Úvalidate_args_and_kwargsr;   ¨   sy   € ôP Ø”e˜FŸM™M›OÓ,Ñ,Ð.Aôô ”S˜Ó+Ó,€IãˆØ�=ÜØ�'ÐFÀsÀeÈ1ÐMóð ñ ð ‡M�M�)ÔÜ�E ;Õ/r   c                óÜ   • [        U 5      nU(       a  U=(       d    U SL nU(       a  U=(       d    [        U [        5      nU(       d%  [        SU S[	        U 5      R
                   S35      eU $ )a  
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_kwargrG   â   sl   € ô< ˜“€JÞØ×2 E¨T Mˆ
æØ×9¤:¨e´SÓ#9ˆ
æÜØ˜X˜Jð 'Ü˜“K×(Ñ(Ð)¨ð,ó
ð 	
ð €Lr   c                ó  • SSK Jn  U c  Uc  [        S5      eU c  Ub  U" U5      nX4$ U bJ  UcG  U(       a=  [        U [        [
        45      (       a"  [        S[        U 5      R                   S35      eX4$ U b  Ub  [        S5      eX4$ )aì  
Validate the keyword arguments to 'fillna'.

This checks that exactly one of 'value' and 'method' is specified.
If 'method' is specified, this validates that it's a valid method.

Parameters
----------
value, method : object
    The 'value' and 'method' keyword arguments for 'fillna'.
validate_scalar_dict_value : bool, default True
    Whether to validate that 'value' is a scalar or dict. Specifically,
    validate that it is not a list or tuple.

Returns
-------
value, method : object
r   )Úclean_fill_methodz(Must specify a fill 'value' or 'method'.z>"value" parameter must be a scalar or dict, but you passed a "Ú"z)Cannot specify both 'value' and 'method'.)	Úpandas.core.missingrI   r   r>   Úlistr7   r   r@   rA   )rB   ÚmethodÚvalidate_scalar_dict_valuerI   s       r   Úvalidate_fillna_kwargsrO     s­   € õ& 6à�}˜™ÜÐCÓDÐDØ�}˜Ñ+Ù" 6Ó*ˆð ˆ=Ðð 
Ñ	˜v™~Þ%¬*°U¼TÄ5¸M×*JÑ*JÜð!Ü!% e£×!5Ñ!5Ð 6°að9óð ð ˆ=Ðð 
Ñ	˜vÑ1ÜÐDÓEÐEàˆ=Ðr   c                óÔ   • [         R                  " U 5      nSnUR                  S:X  a  SUs=::  a  S::  d  O  [        U5      e U$ [	        S U 5       5      (       d  [        U5      eU$ )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  óL   #   • U  H  nS Us=:*  =(       a    S:*  Os  v •  M     g7f)r   r   N© )Ú.0Úqss     r   Ú	<genexpr>Ú&validate_percentile.<locals>.<genexpr>S  s   é € Ð0ª% B�1˜—<“<˜a—<‘<ª%ùs   ‚"$)ÚnpÚasarrayÚndimr   Úall)ÚqÚq_arrÚmsgs      r   Úvalidate_percentiler^   6  sf   € ô* �JŠJ�q‹M€Eð =€CØ‡z�z�QƒØ�E�˜Q�Ü˜S“/Ð!ð ð
 €Lô Ñ0©%Ó0×0Ñ0Ü˜S“/Ð!Ø€Lr   c                ó   • g ©NrR   ©Ú	ascendings    r   Úvalidate_ascendingrc   X  ó   € àr   c                ó   • g r`   rR   ra   s    r   rc   rc   ]  rd   r   c                ó–   • SSS.n[        U [        5      (       d  [        U S40 UD6$ U  Vs/ s H  n[        US40 UD6PM     sn$ s  snf )z8Validate ``ascending`` kwargs for ``sort_index`` method.FT)rD   rE   rb   )r>   r   rG   )rb   r(   Úitems      r   rc   rc   b  sR   € ð $°DÑ9€FÜ�i¤×*Ñ*Ü" 9¨kÑD¸VÑDÐDáIRÓSÊÀÔ  kÑ<°VÔ<ÉÑSÐSùÒSs   ¬Ac                ó`   • SnSnU c  SnSnX4$ U S:X  a  SnX4$ U S:X  a  SnX4$ [        S5      e)zõ
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_endpointsrn   m  sj   € ð" €KØ€Là�~ØˆØˆð Ð$Ð$ð 
�6Ó	Øˆð Ð$Ð$ð 
�7Ó	Øˆð Ð$Ð$ô ÐJÓKÐKr   c                ó|   • Sn[        U [        5      (       a  SSSSS.R                  U 5      nUc  [        S5      eU$ )a  
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)Úbothri   rj   Úneitherz?Inclusive has to be either 'both', 'neither', 'left' or 'right')r>   ÚstrÚgetr   )Ú	inclusiveÚleft_right_inclusives     r   Úvalidate_inclusiverw   Ž  sX   € ð  6:Ðä�)œS×!Ñ!à Ø!Ø"Ø%ñ	 
÷
 ‰#ˆi‹.ð 	ð Ñ#ÜØMó
ð 	
ð  Ðr   c                óœ   • [        U 5      (       d  [        SU SU 35      eU S:  a  X-  n SU s=::  a  U::  d  O  [        SU SU 35      eU $ )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ÕÜÐ;¸F¸8À5ÈÈÐQÓRÐRØ€Jr   c                óV   • U [         R                  La  U S;  a  [        SU  S35      eg g )N)Únumpy_nullableÚpyarrowzdtype_backend z= is invalid, only 'numpy_nullable' and 'pyarrow' are allowed.)r   Ú
no_defaultr   )Údtype_backends    r   Úcheck_dtype_backendr‚   Â  s?   € ØœCŸN™NÒ*ØÐ =Ó=ÜØ   ð 0)ð *óð ð >ð +r   )ÚreturnÚNonerp   )
rB   r   rC   rs   rD   ÚboolrE   r…   rƒ   r   )T)rN   r…   )r[   zfloat | Iterable[float]rƒ   z
np.ndarray)rb   r   rƒ   r   )rb   zSequence[BoolishT]rƒ   zlist[BoolishT])rb   zbool | int | Sequence[BoolishT]rƒ   zbool | int | list[BoolishT])rk   ú
str | Nonerƒ   útuple[bool, bool])ru   r†   rƒ   r‡   )rz   r?   r{   r?   rƒ   r?   )"Ú__doc__Ú
__future__r   Úcollections.abcr   r   Útypingr   r   ÚnumpyrW   Úpandas._libsr   Úpandas.core.dtypes.commonr	   r
   r…   r?   r   r   r   r$   r)   r1   r5   r;   rG   rO   r^   rc   rn   rw   r|   r‚   rR   r   r   Ú<module>r�      s  ðñõ #÷÷ó
 å ÷ñ
 �:˜t SÓ)€Ù�~ t¨S°$Ó7€ô
ô(#ôL&:ôR
Uô8ð670à	ô70ðz Øð	*Øð*àð*ð ð*ð ð	*ð
 õ*öZ$ôNðD 
óó 
ðð 
óó 
ððTØ.ðTà ôTô%ôB ôDõ$r   