wumpus mentioned on IRC that we don’t currently run mypy
over the contrib/devtools
directory, and that it would likely be worthwhile given #20434. This just adds that dir to the linter, as well as some missing annotations to fix existing errors. Note that now we require Python 3.6 we can make use of variable annotations.
master (patched to check contrib devtools):
0test/lint/lint-python.sh
1contrib/devtools/symbol-check.py:154: error: Incompatible types in assignment (expression has type "List[str]", variable has type "str")
2contrib/devtools/circular-dependencies.py:35: error: Need type annotation for 'deps' (hint: "deps: Dict[<type>, <type>] = ...")
3contrib/devtools/circular-dependencies.py:67: error: Need type annotation for 'closure' (hint: "closure: Dict[<type>, <type>] = ...")
4Found 4 errors in 3 files (checked 187 source files)
I haven’t quite gone as far as to add annotations like
0CHECKS: Dict[str, List[Tuple[str, Callable[[Any], bool]]]] = {...
to symbol-check.py
.