1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #35175 -- Made migraton writer preserve keyword-only arguments.

Thanks Gerald Goh for the report.
This commit is contained in:
David Sanders
2024-02-08 19:57:14 +11:00
committed by Mariusz Felisiak
parent 8b7ddd1b62
commit 06264258dc
4 changed files with 53 additions and 5 deletions

View File

@@ -16,13 +16,18 @@ def _get_callable_parameters(meth_or_func):
return _get_func_parameters(func, remove_first=is_method)
ARG_KINDS = frozenset(
{
inspect.Parameter.POSITIONAL_ONLY,
inspect.Parameter.KEYWORD_ONLY,
inspect.Parameter.POSITIONAL_OR_KEYWORD,
}
)
def get_func_args(func):
params = _get_callable_parameters(func)
return [
param.name
for param in params
if param.kind == inspect.Parameter.POSITIONAL_OR_KEYWORD
]
return [param.name for param in params if param.kind in ARG_KINDS]
def get_func_full_args(func):