Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35516 merge code_check_fix into master Fix pyrefly\set_linter\stabel_shim_version_linter error Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 1. pyrefly的检查目录调整, 2. 修复set_linter检查报错。 3. 修复stable_shim_version_linter.py检查的分支。 # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 pyrefly功能:  set_linter功能:  stable_shim_version功能:  # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [ ] 代码注释完备,正确记录错误日志 - [ ] 代码实现进行了返回值、空指针等校验 - [ ] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [ ] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35516
164 lines
5.1 KiB
TOML
164 lines
5.1 KiB
TOML
# A Pyrefly configuration for PyTorch
|
|
# Based on https://github.com/pytorch/pytorch/blob/main/mypy.ini
|
|
python-version = "3.12"
|
|
|
|
project-includes = [
|
|
"torch_npu",
|
|
"torchnpugen",
|
|
"test",
|
|
"caffe2",
|
|
"test/test_bundled_images.py",
|
|
"test/test_bundled_inputs.py",
|
|
"test/test_complex.py",
|
|
"test/test_datapipe.py",
|
|
"test/test_futures.py",
|
|
"test/test_numpy_interop.py",
|
|
# 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",
|
|
"test/test_type_hints.py",
|
|
"test/test_type_info.py",
|
|
"test/test_utils.py",
|
|
]
|
|
project-excludes = [
|
|
"tools/**",
|
|
"torch_npu/_inductor/runtime/triton_heuristics.py",
|
|
"torch_npu/_inductor/runtime/triton_helpers.py",
|
|
"torch_npu/_inductor/runtime/halide_helpers.py",
|
|
"torch_npu/utils/data/typing.ipynb",
|
|
"torch_npu/utils/data/dataframes_pipes.ipynb",
|
|
"torch_npu/utils/data/standard_pipes.ipynb",
|
|
"torch_npu/onnx/_internal/exporter/_torchlib/ops/nn.py",
|
|
"torch_npu/include/**",
|
|
"torch_npu/csrc/**",
|
|
"torch_npu/distributed/elastic/agent/server/api.py",
|
|
"torch_npu/testing/_internal/**",
|
|
"torch_npu/distributed/fsdp/fully_sharded_data_parallel.py",
|
|
"torch_npu/ao/quantization/pt2e/_affine_quantization.py",
|
|
"torch_npu/nn/modules/pooling.py",
|
|
"torch_npu/nn/parallel/_functions.py",
|
|
"torch_npu/_appdirs.py",
|
|
"torch_npu/multiprocessing/pool.py",
|
|
"torch_npu/overrides.py",
|
|
"*/__pycache__/**",
|
|
"*/.*",
|
|
"torch_npu/_inductor/kernel/vendored_templates/cutedsl/kernels/**",
|
|
"torch_npu/_inductor/kernel/vendored_templates/cutedsl/dense_blockscaled_gemm_persistent.py",
|
|
]
|
|
ignore-missing-imports = [
|
|
# XPU memory symbols not present for builds without XPU support
|
|
"torch_npu._C._xpu_beginAllocateCurrentThreadToPool",
|
|
"torch_npu._C._xpu_endAllocateToPool",
|
|
"torch_npu._C._xpu_releasePool",
|
|
"torch_npu._C._xpu_XPUAllocator",
|
|
"torch_npu._C._XPUMemPool",
|
|
"torch_npu._C._StaticXpuLauncher",
|
|
"torch_npu._C._jit_tree_views.*",
|
|
"torch_npu.for_onnx.onnx.*",
|
|
"torch_npu.ao.quantization.experimental.apot_utils.*",
|
|
"torch_npu.ao.quantization.experimental.quantizer.*",
|
|
"torch_npu.ao.quantization.experimental.observer.*",
|
|
"torch_npu.ao.quantization.experimental.APoT_tensor.*",
|
|
"torch_npu.ao.quantization.experimental.fake_quantize_function.*",
|
|
"torch_npu.ao.quantization.experimental.fake_quantize.*",
|
|
"triton.*",
|
|
"tensorflow.*",
|
|
"tensorboard.*",
|
|
"matplotlib.*",
|
|
"numpy.*",
|
|
"sympy.*",
|
|
"hypothesis.*",
|
|
"tqdm.*",
|
|
"multiprocessing.*",
|
|
"setuptools.*",
|
|
"distutils.*",
|
|
"nvd3.*",
|
|
"future.utils.*",
|
|
"past.builtins.*",
|
|
"numba.*",
|
|
"nvMatmulHeuristics",
|
|
"PIL.*",
|
|
"moviepy.*",
|
|
"cv2.*",
|
|
"torchvision.*",
|
|
"pycuda.*",
|
|
"tensorrt.*",
|
|
"tornado.*",
|
|
"pydot.*",
|
|
"networkx.*",
|
|
"scipy.*",
|
|
"IPython.*",
|
|
"google.protobuf.textformat.*",
|
|
"lmdb.*",
|
|
"mpi4py.*",
|
|
"skimage.*",
|
|
"librosa.*",
|
|
"mypy.*",
|
|
"xml.*",
|
|
"boto3.*",
|
|
"dill.*",
|
|
"usort.*",
|
|
"cutlass.*",
|
|
"cutlass_library.*",
|
|
"cutlass_api.*",
|
|
"deeplearning.*",
|
|
"einops.*",
|
|
"libfb.*",
|
|
"torch_npu.fb.*",
|
|
"torch_npu.*.fb.*",
|
|
"torch_xla.*",
|
|
"onnx.*",
|
|
"onnxruntime.*",
|
|
"onnxscript.*",
|
|
"redis.*",
|
|
]
|
|
# By default, mypy does not check untyped definitions.
|
|
# However, mypy has a configuration called check_untyped_defs which is used
|
|
# to typecheck the interior of untyped functions.
|
|
untyped-def-behavior = "check-and-infer-return-any"
|
|
# In lots of places they define their attributes in `_init` or similar.
|
|
# https://github.com/pytorch/pytorch/blob/75f3e5a88df60caef27fd9c9df3fd51161378fcc/torch/fx/experimental/symbolic_shapes.py#L3632C1-L3633C1
|
|
errors.implicitly-defined-attribute = false
|
|
errors.missing-import = false
|
|
# In many methods that are overridden, parameters are renamed.
|
|
# We can come up with a codemod for this in the future
|
|
errors.bad-param-name-override = false
|
|
# Mypy doesn't require that imports are explicitly imported, so be compatible with that.
|
|
# Might be a good idea to turn this on in future.
|
|
errors.implicit-import = false
|
|
errors.deprecated = false # re-enable after we've fix import formatting
|
|
|
|
permissive-ignores = true
|
|
replace-imports-with-any = ["!sympy.printing.*", "sympy.*", "onnxscript.onnx_opset.*", "networkx.*"]
|
|
search-path = ["tools/experimental"]
|
|
|
|
# Dynamo sub-config - note, we experiment with stricter typing here
|
|
[[sub-config]]
|
|
matches = "torch_npu/_dynamo/**"
|
|
[sub-config.errors]
|
|
implicit-import = false
|
|
implicit-any = true
|
|
# TODO: Turn on in later version
|
|
# unannotated-attribute=true
|
|
# unannotated-parameter=true
|
|
# unannotated-return=true
|
|
|
|
[[sub-config]]
|
|
matches = "torch_npu/_dispatch/**"
|
|
[sub-config.errors]
|
|
implicit-import = false
|
|
implicit-any = true
|
|
|
|
[[sub-config]]
|
|
matches = "torch_npu/_subclasses/**"
|
|
[sub-config.errors]
|
|
implicit-import = false
|
|
implicit-any = true
|
|
|
|
[[sub-config]]
|
|
matches = "torch_npu/_functorch/**"
|
|
[sub-config.errors]
|
|
implicit-import = false
|
|
implicit-any = true
|