chipx86 got a fish trophy!
Add @deprecate_non_keyword_only_args for moving to keyword-only args.
Review Request #12721 — Created Nov. 10, 2022 and submitted — Latest diff uploaded
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.