Japanese
言語
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

qiskit.utils.deprecate_arg

deprecate_arg(name, *, since, additional_msg=None, deprecation_description=None, pending=False, package_name='qiskit-terra', new_alias=None, predicate=None, removal_timeline='no earlier than 3 months after the release date')[ソース]

Decorator to indicate an argument has been deprecated in some way.

This decorator may be used multiple times on the same function, once per deprecated argument. It should be placed beneath other decorators like @staticmethod and property decorators.

パラメータ
  • name (str) – The name of the deprecated argument.

  • since (str) – The version the deprecation started at. If the deprecation is pending, set the version to when that started; but later, when switching from pending to deprecated, update since to the new version.

  • deprecation_description (Optional[str]) – What is being deprecated? E.g. 「Setting my_func()』s my_arg argument to None.」 If not set, will default to 「{func_name}』s argument {name}」.

  • additional_msg (Optional[str]) – Put here any additional information, such as what to use instead (if new_alias is not set). For example, 「Instead, use the argument new_arg, which is similar but does not impact the circuit’s setup.」

  • pending (bool) – Set to True if the deprecation is still pending.

  • package_name (str) – The PyPI package name, e.g. 「qiskit-nature」.

  • new_alias (Optional[str]) – If the arg has simply been renamed, set this to the new name. The decorator will dynamically update the kwargs so that when the user sets the old arg, it will be passed in as the new_alias arg.

  • predicate (Optional[Callable[[Any], bool]]) – Only log the runtime warning if the predicate returns True. This is useful to deprecate certain values or types for an argument, e.g. lambda my_arg: isinstance(my_arg, dict). Regardless of if a predicate is set, the runtime warning will only log when the user specifies the argument.

  • removal_timeline (str) – How soon can this deprecation be removed? Expects a value like 「no sooner than 6 months after the latest release」 or 「in release 9.99」.

戻り値

The decorated callable.

戻り値の型

Callable