mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Remove some wildcards from mypy configs (#56645)
Summary: See https://github.com/pytorch/pytorch/pull/56523#issuecomment-823562134 for context. Basically the idea is that people (including myself) keep assuming that the single-asterisk `*` wildcard means "match in this directory and in its subdirectories", which is _not_ true. Removing the wildcards thus reduces confusion. Ideally I would like to remove _all_ of these wildcards and then add a lint to disallow them in the future (and also greatly simplify the pattern-matching logic in `tools/mypy_wrapper.py`; see https://github.com/pytorch/pytorch/issues/55702 for context), but currently this one can't be removed: ``` tools/autograd/*.py, ``` That is because there is a file called `tools/autograd/templates/annotated_fn_args.py` (added in https://github.com/pytorch/pytorch/issues/41575) which is not a valid Python file and thus cannot be checked by `mypy`. ezyang would it be possible to rename that file to use a suffix other than `.py`? Pull Request resolved: https://github.com/pytorch/pytorch/pull/56645 Test Plan: ``` $ mypy Success: no issues found in 1317 source files $ mypy --config=mypy-strict.ini Success: no issues found in 72 source files ``` The numbers of source files should be the same before and after this PR. Reviewed By: ezyang Differential Revision: D27925207 Pulled By: samestep fbshipit-source-id: c17faf73665a75393d3109346a1138c2af023abb
This commit is contained in:
committed by
Facebook GitHub Bot
parent
1f0223d6bb
commit
bdb421895a
@ -44,8 +44,8 @@ files =
|
||||
tools/extract_scripts.py,
|
||||
tools/mypy_wrapper.py,
|
||||
tools/print_test_stats.py,
|
||||
tools/pyi/*.py,
|
||||
tools/stats_utils/*.py,
|
||||
tools/pyi,
|
||||
tools/stats_utils,
|
||||
tools/test_history.py,
|
||||
tools/test/test_extract_scripts.py,
|
||||
tools/test/test_mypy_wrapper.py,
|
||||
@ -59,7 +59,7 @@ files =
|
||||
torch/testing/_internal/framework_utils.py,
|
||||
torch/utils/benchmark/utils/common.py,
|
||||
torch/utils/benchmark/utils/timer.py,
|
||||
torch/utils/benchmark/utils/valgrind_wrapper/*.py,
|
||||
torch/utils/benchmark/utils/valgrind_wrapper,
|
||||
torch/utils/_pytree.py
|
||||
|
||||
# Specifically enable imports of benchmark utils. As more of `torch` becomes
|
||||
|
Reference in New Issue
Block a user