Skip to main content

deprecate_posargs

Function/method decorator to deprecate some or all positional arguments.

def deprecate_posargs(
deprecation_warning: Warning,
remappable_names: list
) - > function

Function/method decorator to deprecate some or all positional arguments. The decorated function will map any positional arguments after the * to the corresponding keyword arguments and issue a deprecation warning.

Parameters

NameTypeDescription
deprecation_warningWarningThe warning category class (e.g., RemovedInDjangoXXWarning) to be issued when deprecated positional arguments are used.
remappable_nameslistA list of parameter names, in their original positional order, that have been converted from positional-or-keyword to keyword-only.

Returns

TypeDescription
functionA decorator function that wraps the target function or method to handle positional-to-keyword argument remapping and warning issuance.