def deprecated(removal_version, hint_message=None):
  validate_removal_semver(removal_version)
  def decorator(func):
    if not inspect.isfunction(func):
      raise BadDecoratorNestingError('The @deprecated decorator must be applied innermost of all '
                                     'decorators.')

    func_full_name = '{}.{}'.format(func.__module__, func.__name__)

    @wraps(func)
    def wrapper(*args, **kwargs):
      warn_or_error(removal_version, func_full_name, hint_message)
      return func(*args, **kwargs)
    return wrapper
  return decorator
Marks a function or method as deprecated.
dataset/ETHPy150Open pantsbuild/pants/src/python/pants/base/deprecated.py/deprecated