zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
U
®ý°d“Dã
@s8ddlmZddlmZddlZddlmZddlmZm    Z    m
Z
m Z ddl Z ddl mZddlmZmZddlmZd/d
d d
d d dd ddœdd„Zd0d
d ddddœdd„Zdd
dœdd„Zd d
dœdd„Zd1d dd ddœd d!„Zd"dd#œd$d%„ZGd&d'„d'ƒZGd(d)„d)ƒZd2d dd
d+œd,d-„Zd)d.ddd!d%dd'gZdS)3é)Ú annotations)ÚwrapsN)Údedent)ÚAnyÚCallableÚMappingÚcast)Úcache_readonly)ÚFÚT)Úfind_stack_leveléÚstrúCallable[..., Any]ú
str | Noneztype[Warning] | NoneÚintzCallable[[F], F])ÚnameÚ alternativeÚversionÚalt_nameÚklassÚ
stacklevelÚmsgÚreturnc
sØ|pˆj}ˆpt‰|p$|›d|›d‰tˆƒddœ‡‡‡‡fdd„ ƒ}|pTd|›d}d    ˆj›}ˆjrԈj d
¡d kr€t|ƒ‚ˆj d
d ¡\}    }
} } |    s¢| rª|
sªt|ƒ‚td |
 ¡›d |›d|›dt| ƒ›ƒ|_|S)a
    Return a new function that emits a deprecation warning on use.
 
    To use this method for a deprecated function, another function
    `alternative` with the same signature must exist. The deprecated
    function will emit a deprecation warning, and in the docstring
    it will contain the deprecation directive with the provided version
    so it can be detected for future removal.
 
    Parameters
    ----------
    name : str
        Name of function to deprecate.
    alternative : func
        Function to use instead.
    version : str
        Version of pandas in which the method has been deprecated.
    alt_name : str, optional
        Name to use in preference of alternative.__name__.
    klass : Warning, default FutureWarning
    stacklevel : int, default 2
    msg : str
        The message to display in the warning.
        Default is '{name} is deprecated. Use {alt_name} instead.'
    z is deprecated, use ú     instead.r©rcstjˆˆˆdˆ||ŽS)N©r)ÚwarningsÚwarn©ÚargsÚkwargs©rrrZ warning_msg©úNd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/util/_decorators.pyÚwrapper<szdeprecate.<locals>.wrapperzUse `z
` instead.z§deprecate needs a correctly formatted docstring in the target function (should have a one liner short summary, and opening quotes should be in their own line). Found:
Ú
éz    
        z
 
        .. deprecated:: z
            z
 
 
        )    Ú__name__Ú FutureWarningrÚ__doc__ÚcountÚAssertionErrorÚsplitrÚstrip) rrrrrrrr%Z doc_error_msgZempty1ÚsummaryZempty2Z
doc_stringr#r"r$Ú    deprecates4"
 
ÿ
 ÿýüúÿ r0z/Mapping[Any, Any] | Callable[[Any], Any] | None)Ú old_arg_nameÚ new_arg_nameÚmappingrrcs@ˆdk    r"tˆdƒs"tˆƒs"tdƒ‚dddœ‡‡‡‡fdd„ }|S)a¶
    Decorator to deprecate a keyword argument of a function.
 
    Parameters
    ----------
    old_arg_name : str
        Name of argument in function to deprecate
    new_arg_name : str or None
        Name of preferred argument in function. Use None to raise warning that
        ``old_arg_name`` keyword is deprecated.
    mapping : dict or callable
        If mapping is present, use it to translate old arguments to
        new arguments. A callable must do its own value checking;
        values not found in a dict will be forwarded unchanged.
 
    Examples
    --------
    The following deprecates 'cols', using 'columns' instead
 
    >>> @deprecate_kwarg(old_arg_name='cols', new_arg_name='columns')
    ... def f(columns=''):
    ...     print(columns)
    ...
    >>> f(columns='should work ok')
    should work ok
 
    >>> f(cols='should raise warning')  # doctest: +SKIP
    FutureWarning: cols is deprecated, use columns instead
      warnings.warn(msg, FutureWarning)
    should raise warning
 
    >>> f(cols='should error', columns="can't pass do both")  # doctest: +SKIP
    TypeError: Can only specify 'cols' or 'columns', not both
 
    >>> @deprecate_kwarg('old', 'new', {'yes': True, 'no': False})
    ... def f(new=False):
    ...     print('yes!' if new else 'no!')
    ...
    >>> f(old='yes')  # doctest: +SKIP
    FutureWarning: old='yes' is deprecated, use new=True instead
      warnings.warn(msg, FutureWarning)
    yes!
 
    To raise a warning that a keyword will be removed entirely in the future
 
    >>> @deprecate_kwarg(old_arg_name='cols', new_arg_name=None)
    ... def f(cols='', another_param=''):
    ...     print(cols)
    ...
    >>> f(cols='should raise warning')  # doctest: +SKIP
    FutureWarning: the 'cols' keyword is deprecated and will be removed in a
    future version please takes steps to stop use of 'cols'
    should raise warning
    >>> f(another_param='should not raise warning')  # doctest: +SKIP
    should not raise warning
 
    >>> f(cols='should raise warning', another_param='')  # doctest: +SKIP
    FutureWarning: the 'cols' keyword is deprecated and will be removed in a
    future version please takes steps to stop use of 'cols'
    should raise warning
    NÚgetzAmapping from old to new argument values must be dict or callable!r
©Úfuncrcs,tˆƒddœ‡‡‡‡‡fdd„ ƒ}tt|ƒS)Nrrc    s| ˆd¡}|dk    rˆdkrXdtˆƒ›dtˆƒ›}tj|tˆd||ˆ<ˆ||ŽSˆdk    r¦tˆƒrrˆ|ƒ}n ˆ ||¡}dˆ›dt|ƒ›dˆ›dt|ƒ›d    }n|}dtˆƒ›dtˆƒ›d}tj|tˆd| ˆ¡dk    rdtˆƒ›d    tˆƒ›d
}t|ƒ‚||ˆ<ˆ||ŽS) Nzthe ze keyword is deprecated and will be removed in a future version. Please take steps to stop the use of rú=z keyword is deprecated, use rz' keyword is deprecated, use zCan only specify z or z , not both.)ÚpopÚreprrrr)Úcallabler4Ú    TypeError)r r!Z old_arg_valuerZ new_arg_value)r6r3r2r1rr#r$r%ªs0 
ÿ
 
 $ÿÿÿz:deprecate_kwarg.<locals>._deprecate_kwarg.<locals>.wrapper)rrr
)r6r%©r3r2r1r)r6r$Ú_deprecate_kwarg©s)z)deprecate_kwarg.<locals>._deprecate_kwarg)Úhasattrr:r;)r1r2r3rr=r#r<r$Údeprecate_kwargas Cÿ-r?z    list[str])Ú
allow_argsrcCspd|kr| d¡|sdSt|ƒdkr6d|d›dS|d}d d    d
„|d d…Dƒ¡}d |›d |›dSd S)a5
    Convert the allow_args argument (either string or integer) of
    `deprecate_nonkeyword_arguments` function to a string describing
    it to be inserted into warning message.
 
    Parameters
    ----------
    allowed_args : list, tuple or int
        The `allowed_args` argument for `deprecate_nonkeyword_arguments`,
        but None value is not allowed.
 
    Returns
    -------
    str
        The substring describing the argument list in best way to be
        inserted to the warning message.
 
    Examples
    --------
    `format_argument_list([])` -> ''
    `format_argument_list(['a'])` -> "except for the arguments 'a'"
    `format_argument_list(['a', 'b'])` -> "except for the arguments 'a' and 'b'"
    `format_argument_list(['a', 'b', 'c'])` ->
        "except for the arguments 'a', 'b' and 'c'"
    ÚselfÚéz except for the argument 'rú'éÿÿÿÿz, cSsg|]}d|d‘qS)rDr#)Ú.0Úxr#r#r$Ú
<listcomp>ûsz)_format_argument_list.<locals>.<listcomp>Nz except for the arguments z and ')ÚremoveÚlenÚjoin)r@Úlastr r#r#r$Ú_format_argument_listÙs
 rM)rrcCs|dkr dSd|›SdS)zCSpecify which version of pandas the deprecation will take place in.NzIn a future version of pandaszStarting with pandas version r#)rr#r#r$Úfuture_version_msgÿsrNzlist[str] | None)rÚ allowed_argsrrcs‡‡‡fdd„}|S)a
    Decorator to deprecate a use of non-keyword arguments of a function.
 
    Parameters
    ----------
    version : str, optional
        The version in which positional arguments will become
        keyword-only. If None, then the warning message won't
        specify any particular version.
 
    allowed_args : list, optional
        In case of list, it must be the list of names of some
        first arguments of the decorated functions that are
        OK to be given as positional arguments. In case of None value,
        defaults to list of all arguments not having the
        default value.
 
    name : str, optional
        The specific name of the function to show in the warning
        message. If None, then the Qualified name of the function
        is used.
    cs¦t ˆ¡}ˆdk    rˆ‰ndd„|j ¡Dƒ‰‡fdd„|j ¡Dƒ}|jdd„d|j|d}tˆƒ‰tˆƒ›dˆpzˆj›d    ‰t    ˆƒ‡‡‡‡fd
d „ƒ}||_
|S) NcSs0g|](}|j|j|jfkr|j|jkr|j‘qSr#)ÚkindÚPOSITIONAL_ONLYÚPOSITIONAL_OR_KEYWORDÚdefaultÚemptyr©rFÚpr#r#r$rH)s ýzDdeprecate_nonkeyword_arguments.<locals>.decorate.<locals>.<listcomp>cs:g|]2}|j|j|jfkr2|jˆkr2|j|jdn|‘qS)©rP)rPrQrRrÚreplaceÚ KEYWORD_ONLYrU)r@r#r$rH0s üþýcSs|jS©NrW)rVr#r#r$Ú<lambda>9ózBdeprecate_nonkeyword_arguments.<locals>.decorate.<locals>.<lambda>)Úkey)Ú
parametersz all arguments of z!{arguments} will be keyword-only.cs4t|ƒˆkr*tjˆjtˆƒdttƒdˆ||ŽS)N)Ú    argumentsr)rJrrÚformatrMr)r r©r@r6rZnum_allow_argsr#r$r%Bs ýzAdeprecate_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper) ÚinspectÚ    signaturer^ÚvaluesÚsortrXrJrNÚ __qualname__rÚ __signature__)r6Zold_sigÚ
new_paramsZnew_sigr%©rOrrrar$Údecorate#s$
þ
ù     ÿ z0deprecate_nonkeyword_arguments.<locals>.decorater#)rrOrrjr#rir$Údeprecate_nonkeyword_argumentss.rkzNone | str | Callable)Ú
docstringsrcsdddœ‡‡fdd„ }|S)aÏ
    A decorator take docstring templates, concatenate them and perform string
    substitution on it.
 
    This decorator will add a variable "_docstring_components" to the wrapped
    callable to keep track the original docstring template for potential usage.
    If it should be consider as a template, it will be saved as a string.
    Otherwise, it will be saved as callable, and later user __doc__ and dedent
    to get docstring.
 
    Parameters
    ----------
    *docstrings : None, str, or callable
        The string / docstring / docstring template to be appended in order
        after default docstring under callable.
    **params
        The string which would be used to format docstring template.
    r
)Ú    decoratedrcs’g}|jr| t|jƒ¡ˆD]@}|dkr,qt|dƒrD| |j¡qt|tƒsT|jr| |¡q‡fdd„|Dƒ}d dd„|Dƒ¡|_||_|S)NÚ_docstring_componentscs2g|]*}t|tƒr*tˆƒdkr*|jfˆŽn|‘qS)r)Ú
isinstancerrJr`©rFÚ    component)Úparamsr#r$rHxs þÿ
ÿz*doc.<locals>.decorator.<locals>.<listcomp>rBcSs(g|] }t|tƒr|n t|jp dƒ‘qS)rB)rorrr*rpr#r#r$rH€sþÿ)    r*Úappendrr>ÚextendrnrorrK)rmZdocstring_componentsZ    docstringZparams_applied©rlrrr#r$Ú    decoratorhs.
ÿ 
üüÿ ÿzdoc.<locals>.decoratorr#)rlrrrvr#rur$ÚdocTs&rwc@s<eZdZdZddœdd„Zdddœdd    „Zddœd
d „Zd S) Ú Substitutiona/
    A decorator to take a function's docstring and perform string
    substitution on it.
 
    This decorator should be robust even if func.__doc__ is None
    (for example, if -OO was passed to the interpreter)
 
    Usage: construct a docstring.Substitution with a sequence or
    dictionary suitable for performing substitution; then
    decorate a suitable function with the constructed object. e.g.
 
    sub_author_name = Substitution(author='Jason')
 
    @sub_author_name
    def some_function(x):
        "%(author)s wrote this function"
 
    # note that some_function.__doc__ is now "Jason wrote this function"
 
    One can also use positional arguments.
 
    sub_first_last_names = Substitution('Edgar Allen', 'Poe')
 
    @sub_first_last_names
    def some_function(x):
        "%s %s wrote the Raven"
    ÚNonercOs|r|rtdƒ‚|p||_dS)Nz+Only positional or keyword args are allowed)r,rr©rAr r!r#r#r$Ú__init__²szSubstitution.__init__r
r5cCs|jo|j|j|_|SrZ)r*rr)rAr6r#r#r$Ú__call__¸szSubstitution.__call__cOst|jtƒr|jj||ŽdS)z8
        Update self.params with supplied args.
        N)rorrÚdictÚupdaterzr#r#r$r~¼s zSubstitution.updateN)r(Ú
__module__rfr*r{r|r~r#r#r#r$rx•srxc@s@eZdZUdZded<dddddd    œd
d „Zd d d œdd„ZdS)ÚAppenderaf
    A function decorator that will append an addendum to the docstring
    of the target function.
 
    This decorator should be robust even if func.__doc__ is None
    (for example, if -OO was passed to the interpreter).
 
    Usage: construct a docstring.Appender with a string to be joined to
    the original docstring. An optional 'join' parameter may be supplied
    which will be used to join the docstring and addendum. e.g.
 
    add_copyright = Appender("Copyright (c) 2009", join='
')
 
    @add_copyright
    def my_dog(has='fleas'):
        "This docstring will have a copyright below"
        pass
    rÚaddendumrBrrrry)rrKÚindentsrcCs(|dkrt||d|_n||_||_dS)Nr)r‚)ÚindentrrK)rArrKr‚r#r#r$r{ÚszAppender.__init__r r5cCsF|jr |jnd|_|jr|jnd|_|j|jg}t|j |¡ƒ|_|S)NrB)r*rrrK)rAr6Zdocitemsr#r#r$r|ás
 zAppender.__call__N)rBr)r(rrfr*Ú__annotations__r{r|r#r#r#r$r€Äs
r€rC)Útextr‚rcCs8|rt|tƒsdSd dgdg|¡}| | d¡¡S)NrBr&z    )rorrKr-)r…r‚Zjointextr#r#r$rƒésrƒr    )NNr N)Nr )NN)rC)Ú
__future__rÚ    functoolsrrbÚtextwraprÚtypingrrrrrZpandas._libs.propertiesr    Zpandas._typingr
r Zpandas.util._exceptionsr r0r?rMrNrkrwrxr€rƒÚ__all__r#r#r#r$Ú<module>sD     ùNüx&
ýMA/%ø