Fish Trophy

chipx86 got a fish trophy!

Fish Trophy

Add @deprecate_non_keyword_only_args for moving to keyword-only args.

Review Request #12721 — Created Nov. 10, 2022 and submitted

Information

Djblets
release-3.x

Reviewers

This decorator allows us to move functions over to keyword-only
arguments without breaking callers that may be passing arguments as
position-only. It takes care of converting calls (using keyword
arguments or positional arguments) to the right format expected by the
function, emitting a deprecation warning if any keyword-only arguments
are passed as positional arguments.

This is a copy of the same method used in RBTools.

The deprecation warning classes have also been given a version
attribute, to help with generating suitable error messages.

Made use of this extensively with some in-progress work, with functions
using keyword-only arguments and taking *args and **kwargs, passing
them down to other methods using the decorator.

Summary ID
Add @deprecate_non_keyword_only_args for moving to keyword-only args.
This decorator allows us to move functions over to keyword-only arguments without breaking callers that may be passing arguments as position-only. It takes care of converting calls (using keyword arguments or positional arguments) to the right format expected by the function, emitting a deprecation warning if any keyword-only arguments are passed as positional arguments. This is a copy of the same method used in RBTools. The deprecation warning classes have also been given a `version` attribute, to help with generating suitable error messages.
de298304cfa5eb254507950dba57c18eb4ea9804
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-3.x (a0ebaec)
Loading...