贬低#

astropy.utils.decorators.deprecated(since, message='', name='', alternative='', pending=False, obj_type=None, warning_type=<class 'astropy.utils.exceptions.AstropyDeprecationWarning'>, *, pending_warning_type=<class 'astropy.utils.exceptions.AstropyPendingDeprecationWarning'>)[源代码]#

用于将函数或类标记为已弃用。

要将属性标记为已弃用,请使用 deprecated_attribute .

参数:
since : strPython :字符串

此API被弃用的版本。这是必需的。

message : str ,可选Python:字符串,可选

重写默认的弃用消息。格式说明符 func 可用于函数的名称,以及 alternative 可在否决消息中使用,以插入已弃用函数的替代名称。 obj_type 可用于为不推荐使用的对象类型插入友好名称。

name : str ,可选Python:字符串,可选

不推荐使用的函数或类的名称;如果未提供,则根据传入的函数或类自动确定名称,但这在重命名函数的情况下很有用,其中新函数只被指定给不推荐使用的函数的名称。例如::

def new_function():
    ...
oldFunction = new_function
alternative : str ,可选Python:字符串,可选

用户可以使用的替代函数或类名来代替不推荐使用的对象。如果提供了此替代方案,则不推荐警告将告诉用户。

pending : bool ,可选可选的布尔

如果为True,则使用 pending_warning_type 而不是 warning_type .

obj_type : str ,可选Python:字符串,可选

此对象的类型(如果需要重写自动确定的对象)。

warning_type : Warning警告

发出警告。默认为 AstropyDeprecationWarning .

pending_warning_type : Warning警告

等待发布警告。只有在以下情况下才有效 pending 设置为True。默认值为 AstropyPendingDeprecationWarning .