Update pyrefly config for better codenav (#161200)

This fixes behavior in codenav by switching from `replace_imports_with_any` to `ignore-missing-imports`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/161200
Approved by: https://github.com/aorenste, https://github.com/albanD
This commit is contained in:
Aaron Pollack 2025-08-22 23:05:07 +00:00 committed by PyTorch MergeBot
parent bcfe1b2d71
commit f521e82a4e

View File

@ -1,4 +1,4 @@
project_includes = [ project-includes = [
"torch", "torch",
"caffe2", "caffe2",
"test/test_bundled_images.py", "test/test_bundled_images.py",
@ -7,12 +7,11 @@ project_includes = [
"test/test_datapipe.py", "test/test_datapipe.py",
"test/test_futures.py", "test/test_futures.py",
"test/test_numpy_interop.py", "test/test_numpy_interop.py",
"test/test_torch.py",
"test/test_type_hints.py", "test/test_type_hints.py",
"test/test_type_info.py", "test/test_type_info.py",
"test/test_utils.py", "test/test_utils.py",
] ]
project_excludes = [ project-excludes = [
"torch/include/**", "torch/include/**",
"torch/csrc/**", "torch/csrc/**",
"torch/distributed/elastic/agent/server/api.py", "torch/distributed/elastic/agent/server/api.py",
@ -27,7 +26,7 @@ project_excludes = [
"*/__pycache__/**", "*/__pycache__/**",
"*/.*", "*/.*",
] ]
replace_imports_with_any = [ ignore-missing-imports = [
"torch._C._jit_tree_views.*", "torch._C._jit_tree_views.*",
"torch.for_onnx.onnx.*", "torch.for_onnx.onnx.*",
"torch.ao.quantization.experimental.apot_utils.*", "torch.ao.quantization.experimental.apot_utils.*",
@ -85,4 +84,16 @@ replace_imports_with_any = [
"redis.*" "redis.*"
] ]
untyped_def_behavior = "check-and-infer-return-any" untyped_def_behavior = "check-and-infer-return-any"
# Shut off noisy errors
errors.implicit-import = false
# We exclude test_torch.py because it is full of errors, but most functions lack type signatures,
# and mypy.ini specifies `check_untyped_defs = False` for this file.
# If you check even the unannotated stuff mypy produces 322 errors.
# "test/test_torch.py",
# Uncomment this file to check
# [[tool.pyrefly.sub-config]]
# matches = "test/test_torch.py"
# untyped-def-behavior = "skip-and-infer-return-any"