hyb
2025-12-30 5e753a15ff53faab2261a53367e44d38caf87041
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
Ë
oñúhÜ7ãó<—dZddlmZddlmZmZddlmZmZddl    Z
ddl m Z ddl mZmZedee«Zed    eed«Zdd
„Zdd „Zdd „Zdd „Zdd„Z        dd„Z        d                                    dd„Zddd„Zdd„Zed d„«Zed!d„«Z                d"d„Zd#d„Zd$d„Zd%d„Z dd„Z!y)&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
óʗ|dkr td«‚t|«t|«kDr<t|«|z}t|«|z}|dk(rdnd}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.
    rz*'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_countrs       úJH:\Change_password\venv_build\Lib\site-packages\pandas/util/_validators.pyÚ_check_arg_lengthrsŽ€ð ˜QÒÜÐEÓFÐFä
ˆ4ƒy”3{Ó#Ò#ܘKÓ(Ð+>Ñ>ˆ ܘt›9Ð':Ñ:ÐØ!.°!Ò!3‘:¸ˆä؈gÐ& } o°Q°x°jðAØ Ð! ð *ó
ð    
ð $ócóЗ|D]H}    ||}||}|||€|d}n||k(}t|«s td«‚    |rŒ8td|›d|›d«‚y#t$r ||||u}YŒ,wxYw)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 booleanzthe '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$1s´€ðòˆð    :ؘcÑ"ˆBؘSÑ!ˆBð 2 :°2°:À"À.Ø‘à˜b™ä˜5”>Ü Ð!;Ó<Ð<ð"òÜØ˜uð0Ø05¨w°bð:óð ñ1øô(ò    :Ø  Ñ%¨°SÑ)9Ð9ŠEð    :ús‡0AÁA%Á$A%cód—t||||«tt||««}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`
    N)rÚdictÚzipr$)rrrrÚkwargss     rÚ validate_argsr)Ws3€ô@e˜TÐ#6¸ ÔDô
”#k 4Ó(Ó )€Fܘe V¨[Õ9rcó€—t|«t|«z
}|r%tt|««}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)rr(rÚdiffÚbad_args     rÚ_check_for_invalid_keysr1€sG€ô ˆv‹;œ˜[Ó)Ñ )€Dá Ü”t˜D“zÓ"ˆÜ˜5˜'Ð!HÈÈ    ÐQRÐSÓTÐTð rcó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)Úcopyr1r$)rr(rÚkwdss    rÚvalidate_kwargsr5s'€ð, ;‰;‹=€DܘE 6¨;Ô7ܘe T¨;Õ7rcóò—t||t|j««z||«tt    ||««}|D]}||vsŒ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.
 
    z-() got multiple values for keyword argument 'r+N)rÚtupleÚvaluesr&r'rÚupdater5)rrr(rrÚ    args_dictr s       rÚvalidate_args_and_kwargsr;¨sˆ€ôPØ ˆt”e˜FŸM™M›OÓ,Ñ,Ð.AÀ;ôô ”S˜ dÓ+Ó,€IàòˆØ &Š=ÜØ'ÐFÀsÀeÈ1ÐMóð ðð  ‡MM)ÔܐE˜6 ;Õ/rcóª—t|«}|r|xs|du}|r|xst|t«}|s%td|›dt    |«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.
    NzFor 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×(Ñ(Ð)¨ð ,ó
ð    
ð €Lrcóö—ddlm}|€ |€ td«‚|€| ||«}||fS|@|€>|r8t|tt
f«r"t dt|«j›d«‚||fS| | td«‚||fS)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.missingrIrr>Úlistr7rr@rA)rBÚmethodÚvalidate_scalar_dict_valuerIs    rÚvalidate_fillna_kwargsrOs°€õ&6à €}˜˜ÜÐCÓDÐDØ €}˜Ð+Ù" 6Ó*ˆð &ˆ=Ðð
Р   ˜v˜~Ù %¬*°U¼TÄ5¸MÔ*JÜð!Ü!% e£×!5Ñ!5Р6°að9óð ð &ˆ=Ðð
Р   ˜vÐ1ÜÐDÓEÐEà &ˆ=Ðrcóԗtj|«}d}|jdk(r$d|cxkrdkst|«‚t|«‚|St    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]rrc3ó<K—|]}d|cxkxrdknc–—Œy­w)rrN©)Ú.0Úqss  rú    <genexpr>z&validate_percentile.<locals>.<genexpr>Ssèø€Ò0 B1˜–<˜a—<<Ñ0ùs‚)ÚnpÚasarrayÚndimrÚall)ÚqÚq_arrÚmsgs   rÚvalidate_percentiler]6sm€ô* J‰Jq‹M€Eð =€CØ ‡zzQ‚ؐEŒ˜QŠÜ˜S“/Ð !ðܘS“/Ð !ð €LôÑ0¨%Ô0Ô0ܘS“/Ð !Ø €Lrcó—y©NrR©Ú    ascendings rÚvalidate_ascendingrbXó€àrcó—yr_rRr`s rrbrb]rcrcó†—dddœ}t|t«s t|dfi|¤ŽS|Dcgc]}t|dfi|¤Ž‘Œc}Scc}w)z8Validate ``ascending`` kwargs for ``sort_index`` method.FT)rDrEra)r>rrG)rar(Úitems   rrbrbbsK€ð$°DÑ 9€FÜ i¤Ô *Ü" 9¨kÑD¸VÑDÐDàIRÖ SÀÔ   kÑ <°VÓ <Ò SÐSùÒ Ss§>có`—d}d}|€d}d}||fS|dk(rd}||fS|dk(rd}||fStd«‚)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_endpointsrmmsp€ð"€KØ€Là €~؈ ؈ ð ˜ Ð $Ð$ð
6Ò    Øˆ ð ˜ Ð $Ð$ð
7Ò    Øˆ ð ˜ Ð $Ð$ôÐJÓKÐKrcóp—d}t|t«rdddddœj|«}|€ td«‚|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)ÚbothrhriÚneitherz?Inclusive has to be either 'both', 'neither', 'left' or 'right')r>ÚstrÚgetr)Ú    inclusiveÚleft_right_inclusives  rÚvalidate_inclusivervŽsU€ð 6:Ðä)œSÔ!à Ø!Ø"Ø%ñ     
÷
‰#ˆi‹.ð     ðÐ#ÜØ Mó
ð    
ð  ÐrcóŽ—t|«std|›d|›«‚|dkr||z }d|cxkr|ksntd|›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Ø €JrcóP—|tjur|dvrtd|›d«‚yy)N)Únumpy_nullableÚpyarrowzdtype_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ÚNonero)
rBr rCrrrDÚboolrEr„r‚r )T)rNr„)rZzfloat | Iterable[float]r‚z
np.ndarray)rar r‚r )razSequence[BoolishT]r‚zlist[BoolishT])razbool | int | Sequence[BoolishT]r‚zbool | int | list[BoolishT])rjú
str | Noner‚útuple[bool, bool])rtr…r‚r†)ryr?rzr?r‚r?)"Ú__doc__Ú
__future__rÚcollections.abcrrÚtypingrrÚnumpyrVÚ pandas._libsrÚpandas.core.dtypes.commonr    r
r„r?r r rr$r)r1r5r;rGrOr]rbrmrvr{rrRrrú<module>rŽsðñõ#÷÷ó
å÷ñ
:˜t SÓ )€Ù~ t¨S°$Ó7€ ó
ó(#óL&:óR
Uó8ð670à    ó70ðzØð    *Ø ð*àð*ðð*ðð    *ð
ó *ôZ$óNðD
òó
ðð
òó
ððTØ.ðTà óTó%óB óDô$r