• 
      

    Add helpers for deprecating functions, arguments, and values.

    Review Request #13012 — Created May 4, 2023 and submitted — Latest diff uploaded

    Information

    housekeeping
    master

    Reviewers

    This introduces four functions for helping deprecate function-related
    code:

    • @deprecate_non_keyword_only_args takes a function with keyword-only
      arguments and allows them to be called with positional arguments while
      emitting a deprecation warning. This is a port of the code used in
      RBTools and Djblets today.

    • @func_deprecated takes a function and emits a deprecation warning
      when called.

    • @func_moved takes a function and emits a deprecation warning
      when called, pointing to a new function elsewhere.

    • deprecated_arg_value wraps a value and emits a deprecation warning
      if it's used in any way. It's useful for passing old arguments to
      callbacks. This is a port of the code used in Djblets today.

    Unit tests have been added for all of these functions.

    All unit tests pass for all supported versions of Python.

    Viewed the README in a GitHub-compatible Markdown viewer.

    Commits

    Files