-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Closed
Labels
Description
Update: This is blocked on moving to Python 3.
Ideally we could come up with something fast enough that it could run as a part of lint-all, but I think a travis-only solution would still be acceptable (or a version that just runs on the diff locally).
git grep 'def ' | grep '=' | wc
returns 382.
Some implementation ideas:
- For each function that takes kwargs, insert a fake kwarg before the list, and then run mypy. So e.g. the script would turn anything that looked like
def f(a, b=5)
intodef f(a, fake='', b=5)
, adjust thetype:
accordingly, and then runtools/run-mypy
. - Use a simple heuristic like the
git grep
above to find all the functions with kwargs, and thengit grep
for each of those functions in a loop and check how it is called. If we only do this for select files/directories I imagine the 382 could come down to 1-200. - Adapt or find something in pylint. E.g. this was added in 2009: https://lists.logilab.org/pipermail/python-projects/2009-November/002090.html (we need something much simpler than what they are trying to do; all we care is that the number of non-kwargs given = the number of non-kwargs in the function def, since mypy is taking care of the rest)
- Convince Guido to add this as an option to mypy