You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried checking my project and got lots of field-related warnings, most about extra parameters, duplicate parameters, etc.
I've narrowed issue down to Field signature and it's inherited classes.
Current signature is: def __init__(self, **kwargs: Any): ...
And as example CharField: def __init__(self, max_length: int = ..., **kwargs: Any): ...
Real Field signature has to accept all arguments as positional, and to do it's inherited classes. It might be not practical to supply more than 1-2 arguments as positional, but it's possible:
So CharField's max_length is just one of Field parameters.
Please advise - should it be fixed directly, or is it an issue in automated code annotator ?
If it should be fixed manually - should all inherited fields duplicate Field signature and add new params, or will (new_param: Type, **kwargs) work fine ? I'm not sure if mypy will check Field signature in this case.
The text was updated successfully, but these errors were encountered:
Hi,
I've tried checking my project and got lots of field-related warnings, most about extra parameters, duplicate parameters, etc.
I've narrowed issue down to
Field
signature and it's inherited classes.Current signature is:
def __init__(self, **kwargs: Any): ...
And as example
CharField
:def __init__(self, max_length: int = ..., **kwargs: Any): ...
Real
Field
signature has to accept all arguments as positional, and to do it's inherited classes. It might be not practical to supply more than 1-2 arguments as positional, but it's possible:So
CharField
'smax_length
is just one ofField
parameters.Please advise - should it be fixed directly, or is it an issue in automated code annotator ?
If it should be fixed manually - should all inherited fields duplicate
Field
signature and add new params, or will(new_param: Type, **kwargs)
work fine ? I'm not sure if mypy will checkField
signature in this case.The text was updated successfully, but these errors were encountered: