+
    xȇiF:                    x   R t ^ RIHt ^ RIHtHt ^ RIHtHt ^ RI	t
^ RIHt ^ RIHt ^ RIHtHt ]! R]]4      t]! R	]]R4      tR
 R ltR R ltR R ltR R ltR R ltR R ltR,R R lltR R ltR-R R lltR R lt]R R l4       t ]R  R! l4       t R" R# lt R$ R% lt!R& R' lt"R( R) lt#R* R+ lt$R# ).zV
Module that contains many useful utilities
for validating data or function arguments
)annotations)IterableSequence)TypeVaroverloadN)lib)NA)is_bool
is_integerBoolishTBoolishNoneTc                   V ^8  d   QhRR/#    returnNone )formats   "g/Users/max/.openclaw/workspace/postharvest/venv/lib/python3.14/site-packages/pandas/util/_validators.py__annotate__r      s     
 
 
    c           
         V^ 8  d   \        R4      h\        V4      \        V4      8  dG   \        V4      V,           p\        V4      V,           pV^8X  d   RMRp\        V  RV RV RV R24      hR# )	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.
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   &&&&   r   _check_arg_lengthr$      s     QEFF
4y3{##K(+>>t9'::!.!!3:g&}oQxj A !*
 	
 $r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   3   s     # #4 #r   c                   V Fb  p W,          pW#,          pVe   Ve	   Vf   Ve   RpMWE8H  p\        V4      '       g   \        R4      h V'       d   KR  \        RV RV  R24      h	  R#   \         d    Y,          Y#,          J p L=i ; i)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,   3   s     	:"B!B 2:2:".5>> !;<< " uu 005wb: 1 (  	: %)99E	:s   AA++B	B	c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   Y   s     &: &:D &:r   c                b    \        WW#4       \        \        W1RR7      4      p\        WV4       R# )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_argsr4   Y   s-    @ e#6D
 #k67Fe[9r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r      s     
U 
U4 
Ur   c                    \        V4      \        V4      ,
          pV'       d&   \        \        V4      4      p\        V  RV R24      hR# )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   r3   r!   diffbad_args   &&&  r   _check_for_invalid_keysr=      sG     v;[))DtDz"5'!H	QRSTT r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r      s     8 84 8r   c                V    VP                  4       p\        WV4       \        WV4       R# )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)copyr=   r,   )r   r3   r!   kwdss   &&& r   validate_kwargsrB      s#    , ;;=DE;7e;7r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r      s     70 70	70r   c                    \        W\        VP                  4       4      ,           W44       \        \	        WARR7      4      pV F  pWb9   g   K  \        V  RV R24      h	  VP                  V4       \        WV4       R# )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 'r7   N)r$   tuplevaluesr1   r2   r   updaterB   )r   r   r3   r    r!   	args_dictr(   s   &&&&&  r   validate_args_and_kwargsrI      s{    P eFMMO,,.A S59:I='Fse1M   MM)E;/r   c          
     ,    V ^8  d   QhRRRRRRRRRR/# )	r   valuer   arg_namestrnone_allowedboolint_allowedr   r   )r   s   "r   r   r      s:     * *** * 	*
 *r   c                    \        V 4      pV'       d   T;'       g    V RJ pV'       d   T;'       g    \        V \        4      pV'       g&   \        RV R\	        V 4      P
                   R24      hV # )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__)rK   rL   rN   rP   
good_values   &&&& r   validate_bool_kwargrX      sr    < J22ETM
99:eS#9
XJ 'K((),
 	
 Lr   c                   V ^8  d   QhRR/# )r   namerM   r   )r   s   "r   r   r     s     Y Y Yr   c                   V \         P                  J g]   \        V \        4      '       gG   V eC   V \        J g9   \         P
                  ! V 4      '       d   \        P                  ! V 4      '       d   R# \        V RV  24      h)z
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_defaultrS   rO   r   is_floatnpisnanr   )rK   rZ   s   &&r   validate_na_argr`     s_    " 	eT""=B;LLBHHUOO
vOPUwW
XXr   c                   V ^8  d   QhRR/# )r   validate_scalar_dict_valuerO   r   )r   s   "r   r   r   ,  s     $ $d $r   c                (   ^ RI Hp V f   Vf   \        R4      hV f   Ve   V! V4      pW3# V eN   VfJ   V'       d?   \        V \        \
        34      '       d#   \        R\        V 4      P                   R24      hW3# V e   Ve   \        R4      hW3# )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
)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.missingrd   r   rS   listrE   r   rU   rV   )rK   methodrb   rd   s   &&& r   validate_fillna_kwargsri   ,  s    & 6}CDD}+"6* = 
	v~%*UT5M*J*J!!%e!5!5 6a9  = 
	v1DEE=r   c                    V ^8  d   QhRRRR/# )r   qzfloat | Iterable[float]r   z
np.ndarrayr   )r   s   "r   r   r   S  s      2 z r   c                    \         P                  ! V 4      pRpVP                  ^ 8X  d    ^ Tu;8:  d   ^8:  g   M \        V4      h V# \        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       g   \        V4      hV# )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]c              3  N   "   T F  p^ Tu;8*  ;'       d    ^8*  Mu x  K  	  R# 5i)    Nr   ).0qss   & r   	<genexpr>&validate_percentile.<locals>.<genexpr>o  s     ."bAs   %%FT)r^   asarrayndimr   all)rk   q_arrmsgs   &  r   validate_percentilerx   S  sv    * JJqME =CzzQEQS/!  L S..SSS....oLr   c                    V ^8  d   QhRRRR/# )r   	ascendingr   r   r   )r   s   "r   r   r   u  s     < <( <x <r   c                    R # Nr   rz   s   &r   validate_ascendingr~   t  s    9<r   c                    V ^8  d   QhRRRR/# )r   rz   zSequence[BoolishT]r   zlist[BoolishT]r   )r   s   "r   r   r   y  s     L L"4 L Lr   c                    R # r|   r   r}   s   &r   r~   r~   x  s    ILr   c                    V ^8  d   QhRRRR/# )r   rz   zbool | int | Sequence[BoolishT]r   zbool | int | list[BoolishT]r   )r   s   "r   r   r   |  s      T T.T Tr   c                    RRRR/p\        V \        4      '       g   \        V R3/ VB # V  Uu. uF  p\        VR3/ VB NK  	  up# u upi )z8Validate ``ascending`` kwargs for ``sort_index`` method.rN   FrP   Trz   )rS   r   rX   )rz   r3   items   &  r   r~   r~   |  sV     e]D9Fi**"9kDVDDIRSk<V<SSSs   Ac                    V ^8  d   QhRRRR/# )r   closed
str | Noner   tuple[bool, bool]r   )r   s   "r   r   r     s     % %z %.? %r   c                f    RpRpV f   RpRpW3# V R8X  d   RpW3# V R8X  d   RpW3# \        R4      h)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   )r   left_closedright_closeds   &  r   validate_endpointsr     sj    " KL~ $$ 
6	 $$ 
7	 $$ JKKr   c                    V ^8  d   QhRRRR/# )r   	inclusiver   r   r   r   )r   s   "r   r   r     s        *  1B  r   c                    Rp\        V \        4      '       d   RRRRRR	RR
/P                  V 4      pVf   \        R4      hV# )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bothr   r   neitherz?Inclusive has to be either 'both', 'neither', 'left' or 'right')TTTF)FT)FF)rS   rM   getr   )r   left_right_inclusives   & r   validate_inclusiver     s`      6:)S!!LM]~	 

 #i. 	 #M
 	
  r   c               $    V ^8  d   QhRRRRRR/# )r   locrT   lengthr   r   )r   s   "r   r   r     s!      S # # r   c                    \        V 4      '       g   \        RV RV 24      hV ^ 8  d	   W,          p ^ T u;8:  d   V8:  g   M \        RV RV 24      hV # )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   
IndexError)r   r   s   &&r   validate_insert_locr     s_     c??:6(%xPQQ
Qwv;F85QRRJr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r     s      $ r   c                ^    V \         P                  Jd   V R9  d   \        RV  R24      hR# R# )numpy_nullablezdtype_backend z= is invalid, only 'numpy_nullable' and 'pyarrow' are allowed.N)r   pyarrow)r   r\   r   )dtype_backends   &r   check_dtype_backendr     s?    CNN* ==  0) *  > +r   r   )T)%__doc__
__future__r   collections.abcr   r   typingr   r   numpyr^   pandas._libsr   pandas._libs.missingr   pandas.core.dtypes.commonr	   r
   rO   rT   r   r   r$   r,   r4   r=   rB   rI   rX   r`   ri   rx   r~   r   r   r   r   r   r   r   <module>r      s   
 #
   #
 :tS)~tS$7
(#L&:R
U8670t*ZY6$NB 
 < 
 < 
 L 
 LT%B D$r   