xref: /aosp_15_r20/external/pytorch/mypy.ini (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1*da0073e9SAndroid Build Coastguard Worker# This is the PyTorch mypy.ini file (note: don't change this line! -
2*da0073e9SAndroid Build Coastguard Worker# test_run_mypy in test/test_type_hints.py uses this string)
3*da0073e9SAndroid Build Coastguard Worker
4*da0073e9SAndroid Build Coastguard Worker[mypy]
5*da0073e9SAndroid Build Coastguard Workerplugins = mypy_plugins/check_mypy_version.py, mypy_plugins/sympy_mypy_plugin.py, numpy.typing.mypy_plugin
6*da0073e9SAndroid Build Coastguard Worker
7*da0073e9SAndroid Build Coastguard Workercache_dir = .mypy_cache/normal
8*da0073e9SAndroid Build Coastguard Workerallow_redefinition = True
9*da0073e9SAndroid Build Coastguard Workerwarn_unused_configs = True
10*da0073e9SAndroid Build Coastguard Workerwarn_redundant_casts = True
11*da0073e9SAndroid Build Coastguard Workershow_error_codes = True
12*da0073e9SAndroid Build Coastguard Workershow_column_numbers = True
13*da0073e9SAndroid Build Coastguard Workercheck_untyped_defs = True
14*da0073e9SAndroid Build Coastguard Workerdisallow_untyped_defs = True
15*da0073e9SAndroid Build Coastguard Workerdisallow_untyped_decorators = True
16*da0073e9SAndroid Build Coastguard Workerfollow_imports = normal
17*da0073e9SAndroid Build Coastguard Workerlocal_partial_types = True
18*da0073e9SAndroid Build Coastguard Workerenable_error_code = possibly-undefined
19*da0073e9SAndroid Build Coastguard Worker
20*da0073e9SAndroid Build Coastguard Worker# do not reenable this:
21*da0073e9SAndroid Build Coastguard Worker# https://github.com/pytorch/pytorch/pull/60006#issuecomment-866130657
22*da0073e9SAndroid Build Coastguard Workerwarn_unused_ignores = False
23*da0073e9SAndroid Build Coastguard Worker
24*da0073e9SAndroid Build Coastguard Worker#
25*da0073e9SAndroid Build Coastguard Worker# Note: test/ still has syntax errors so can't be added
26*da0073e9SAndroid Build Coastguard Worker#
27*da0073e9SAndroid Build Coastguard Worker# Typing tests is low priority, but enabling type checking on the
28*da0073e9SAndroid Build Coastguard Worker# untyped test functions (using `--check-untyped-defs`) is still
29*da0073e9SAndroid Build Coastguard Worker# high-value because it helps test the typing.
30*da0073e9SAndroid Build Coastguard Worker#
31*da0073e9SAndroid Build Coastguard Worker
32*da0073e9SAndroid Build Coastguard Workerfiles =
33*da0073e9SAndroid Build Coastguard Worker    torch,
34*da0073e9SAndroid Build Coastguard Worker    caffe2,
35*da0073e9SAndroid Build Coastguard Worker    test/test_bundled_images.py,
36*da0073e9SAndroid Build Coastguard Worker    test/test_bundled_inputs.py,
37*da0073e9SAndroid Build Coastguard Worker    test/test_complex.py,
38*da0073e9SAndroid Build Coastguard Worker    test/test_datapipe.py,
39*da0073e9SAndroid Build Coastguard Worker    test/test_futures.py,
40*da0073e9SAndroid Build Coastguard Worker    test/test_numpy_interop.py,
41*da0073e9SAndroid Build Coastguard Worker    test/test_torch.py,
42*da0073e9SAndroid Build Coastguard Worker    test/test_type_hints.py,
43*da0073e9SAndroid Build Coastguard Worker    test/test_type_info.py,
44*da0073e9SAndroid Build Coastguard Worker    test/test_utils.py
45*da0073e9SAndroid Build Coastguard Worker
46*da0073e9SAndroid Build Coastguard Worker#
47*da0073e9SAndroid Build Coastguard Worker# `exclude` is a regex, not a list of paths like `files` (sigh)
48*da0073e9SAndroid Build Coastguard Worker#
49*da0073e9SAndroid Build Coastguard Workerexclude = torch/include/|torch/csrc/|torch/distributed/elastic/agent/server/api.py|torch/testing/_internal|torch/distributed/fsdp/fully_sharded_data_parallel.py
50*da0073e9SAndroid Build Coastguard Worker
51*da0073e9SAndroid Build Coastguard Workerpython_version = 3.11
52*da0073e9SAndroid Build Coastguard Worker
53*da0073e9SAndroid Build Coastguard Worker
54*da0073e9SAndroid Build Coastguard Worker#
55*da0073e9SAndroid Build Coastguard Worker# Extension modules without stubs.
56*da0073e9SAndroid Build Coastguard Worker#
57*da0073e9SAndroid Build Coastguard Worker
58*da0073e9SAndroid Build Coastguard Worker[mypy-torch._C._jit_tree_views]
59*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
60*da0073e9SAndroid Build Coastguard Worker
61*da0073e9SAndroid Build Coastguard Worker[mypy-torch.for_onnx.onnx]
62*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
63*da0073e9SAndroid Build Coastguard Worker
64*da0073e9SAndroid Build Coastguard Worker[mypy-torch.ao.quantization.experimental.apot_utils]
65*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
66*da0073e9SAndroid Build Coastguard Worker
67*da0073e9SAndroid Build Coastguard Worker[mypy-torch.ao.quantization.experimental.quantizer]
68*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
69*da0073e9SAndroid Build Coastguard Worker
70*da0073e9SAndroid Build Coastguard Worker[mypy-torch.ao.quantization.experimental.observer]
71*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
72*da0073e9SAndroid Build Coastguard Worker
73*da0073e9SAndroid Build Coastguard Worker[mypy-torch.ao.quantization.experimental.APoT_tensor]
74*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
75*da0073e9SAndroid Build Coastguard Worker
76*da0073e9SAndroid Build Coastguard Worker[mypy-torch.ao.quantization.experimental.fake_quantize_function]
77*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
78*da0073e9SAndroid Build Coastguard Worker
79*da0073e9SAndroid Build Coastguard Worker[mypy-torch.ao.quantization.experimental.fake_quantize]
80*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
81*da0073e9SAndroid Build Coastguard Worker
82*da0073e9SAndroid Build Coastguard Worker#
83*da0073e9SAndroid Build Coastguard Worker# Files with various errors. Mostly real errors, possibly some false
84*da0073e9SAndroid Build Coastguard Worker# positives as well.
85*da0073e9SAndroid Build Coastguard Worker#
86*da0073e9SAndroid Build Coastguard Worker
87*da0073e9SAndroid Build Coastguard Worker[mypy-test_torch]
88*da0073e9SAndroid Build Coastguard Workercheck_untyped_defs = False
89*da0073e9SAndroid Build Coastguard Worker
90*da0073e9SAndroid Build Coastguard Worker# Excluded from mypy due to OpInfos being annoying to type
91*da0073e9SAndroid Build Coastguard Worker[mypy-torch.testing._internal.common_methods_invocations.*]
92*da0073e9SAndroid Build Coastguard Workerignore_errors = True
93*da0073e9SAndroid Build Coastguard Worker
94*da0073e9SAndroid Build Coastguard Worker[mypy-torch.testing._internal.hypothesis_utils.*]
95*da0073e9SAndroid Build Coastguard Workerignore_errors = True
96*da0073e9SAndroid Build Coastguard Worker
97*da0073e9SAndroid Build Coastguard Worker[mypy-torch.testing._internal.common_quantization.*]
98*da0073e9SAndroid Build Coastguard Workerignore_errors = True
99*da0073e9SAndroid Build Coastguard Worker
100*da0073e9SAndroid Build Coastguard Worker[mypy-torch.testing._internal.generated.*]
101*da0073e9SAndroid Build Coastguard Workerignore_errors = True
102*da0073e9SAndroid Build Coastguard Worker
103*da0073e9SAndroid Build Coastguard Worker[mypy-torch.testing._internal.distributed.*]
104*da0073e9SAndroid Build Coastguard Workerignore_errors = True
105*da0073e9SAndroid Build Coastguard Worker
106*da0073e9SAndroid Build Coastguard Worker[mypy-torch.nn.modules.pooling]
107*da0073e9SAndroid Build Coastguard Workerignore_errors = True
108*da0073e9SAndroid Build Coastguard Worker
109*da0073e9SAndroid Build Coastguard Worker[mypy-torch.nn.parallel._functions]
110*da0073e9SAndroid Build Coastguard Workerignore_errors = True
111*da0073e9SAndroid Build Coastguard Worker
112*da0073e9SAndroid Build Coastguard Worker[mypy-torch._appdirs]
113*da0073e9SAndroid Build Coastguard Workerignore_errors = True
114*da0073e9SAndroid Build Coastguard Worker
115*da0073e9SAndroid Build Coastguard Worker[mypy-torch.multiprocessing.pool]
116*da0073e9SAndroid Build Coastguard Workerignore_errors = True
117*da0073e9SAndroid Build Coastguard Worker
118*da0073e9SAndroid Build Coastguard Worker[mypy-torch.overrides]
119*da0073e9SAndroid Build Coastguard Workerignore_errors = True
120*da0073e9SAndroid Build Coastguard Worker
121*da0073e9SAndroid Build Coastguard Worker#
122*da0073e9SAndroid Build Coastguard Worker# Files with 'type: ignore' comments that are needed if checked with mypy-strict.ini
123*da0073e9SAndroid Build Coastguard Worker#
124*da0073e9SAndroid Build Coastguard Worker
125*da0073e9SAndroid Build Coastguard Worker[mypy-tools.render_junit]
126*da0073e9SAndroid Build Coastguard Workerwarn_unused_ignores = False
127*da0073e9SAndroid Build Coastguard Worker
128*da0073e9SAndroid Build Coastguard Worker[mypy-tools.generate_torch_version]
129*da0073e9SAndroid Build Coastguard Workerwarn_unused_ignores = False
130*da0073e9SAndroid Build Coastguard Worker
131*da0073e9SAndroid Build Coastguard Worker#
132*da0073e9SAndroid Build Coastguard Worker# Adding type annotations to caffe2 is probably not worth the effort
133*da0073e9SAndroid Build Coastguard Worker# only work on this if you have a specific reason for it, otherwise
134*da0073e9SAndroid Build Coastguard Worker# leave these ignores as they are.
135*da0073e9SAndroid Build Coastguard Worker#
136*da0073e9SAndroid Build Coastguard Worker
137*da0073e9SAndroid Build Coastguard Worker[mypy-caffe2.python.*]
138*da0073e9SAndroid Build Coastguard Workerignore_errors = True
139*da0073e9SAndroid Build Coastguard Worker
140*da0073e9SAndroid Build Coastguard Worker[mypy-caffe2.proto.*]
141*da0073e9SAndroid Build Coastguard Workerignore_errors = True
142*da0073e9SAndroid Build Coastguard Worker
143*da0073e9SAndroid Build Coastguard Worker[mypy-caffe2.distributed.store_ops_test_util]
144*da0073e9SAndroid Build Coastguard Workerignore_errors = True
145*da0073e9SAndroid Build Coastguard Worker
146*da0073e9SAndroid Build Coastguard Worker[mypy-caffe2.experiments.*]
147*da0073e9SAndroid Build Coastguard Workerignore_errors = True
148*da0073e9SAndroid Build Coastguard Worker
149*da0073e9SAndroid Build Coastguard Worker[mypy-caffe2.contrib.*]
150*da0073e9SAndroid Build Coastguard Workerignore_errors = True
151*da0073e9SAndroid Build Coastguard Worker
152*da0073e9SAndroid Build Coastguard Worker[mypy-caffe2.quantization.server.*]
153*da0073e9SAndroid Build Coastguard Workerignore_errors = True
154*da0073e9SAndroid Build Coastguard Worker
155*da0073e9SAndroid Build Coastguard Worker#
156*da0073e9SAndroid Build Coastguard Worker# Third party dependencies that don't have types.
157*da0073e9SAndroid Build Coastguard Worker#
158*da0073e9SAndroid Build Coastguard Worker
159*da0073e9SAndroid Build Coastguard Worker[mypy-triton.*]
160*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
161*da0073e9SAndroid Build Coastguard Worker
162*da0073e9SAndroid Build Coastguard Worker[mypy-tensorflow.*]
163*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
164*da0073e9SAndroid Build Coastguard Worker
165*da0073e9SAndroid Build Coastguard Worker[mypy-tensorboard.*]
166*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
167*da0073e9SAndroid Build Coastguard Worker
168*da0073e9SAndroid Build Coastguard Worker[mypy-matplotlib.*]
169*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
170*da0073e9SAndroid Build Coastguard Worker
171*da0073e9SAndroid Build Coastguard Worker[mypy-numpy.*]
172*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
173*da0073e9SAndroid Build Coastguard Worker
174*da0073e9SAndroid Build Coastguard Worker[mypy-sympy]
175*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
176*da0073e9SAndroid Build Coastguard Worker
177*da0073e9SAndroid Build Coastguard Worker[mypy-sympy.*]
178*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
179*da0073e9SAndroid Build Coastguard Worker
180*da0073e9SAndroid Build Coastguard Worker[mypy-hypothesis.*]
181*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
182*da0073e9SAndroid Build Coastguard Worker
183*da0073e9SAndroid Build Coastguard Worker[mypy-tqdm.*]
184*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
185*da0073e9SAndroid Build Coastguard Worker
186*da0073e9SAndroid Build Coastguard Worker[mypy-multiprocessing.*]
187*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
188*da0073e9SAndroid Build Coastguard Worker
189*da0073e9SAndroid Build Coastguard Worker[mypy-setuptools.*]
190*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
191*da0073e9SAndroid Build Coastguard Worker
192*da0073e9SAndroid Build Coastguard Worker[mypy-distutils.*]
193*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
194*da0073e9SAndroid Build Coastguard Worker
195*da0073e9SAndroid Build Coastguard Worker[mypy-nvd3.*]
196*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
197*da0073e9SAndroid Build Coastguard Worker
198*da0073e9SAndroid Build Coastguard Worker[mypy-future.utils]
199*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
200*da0073e9SAndroid Build Coastguard Worker
201*da0073e9SAndroid Build Coastguard Worker[mypy-past.builtins]
202*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
203*da0073e9SAndroid Build Coastguard Worker
204*da0073e9SAndroid Build Coastguard Worker[mypy-numba.*]
205*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
206*da0073e9SAndroid Build Coastguard Worker
207*da0073e9SAndroid Build Coastguard Worker[mypy-PIL.*]
208*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
209*da0073e9SAndroid Build Coastguard Worker
210*da0073e9SAndroid Build Coastguard Worker[mypy-moviepy.*]
211*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
212*da0073e9SAndroid Build Coastguard Worker
213*da0073e9SAndroid Build Coastguard Worker[mypy-cv2.*]
214*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
215*da0073e9SAndroid Build Coastguard Worker
216*da0073e9SAndroid Build Coastguard Worker[mypy-torchvision.*]
217*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
218*da0073e9SAndroid Build Coastguard Worker
219*da0073e9SAndroid Build Coastguard Worker[mypy-pycuda.*]
220*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
221*da0073e9SAndroid Build Coastguard Worker
222*da0073e9SAndroid Build Coastguard Worker[mypy-tensorrt.*]
223*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
224*da0073e9SAndroid Build Coastguard Worker
225*da0073e9SAndroid Build Coastguard Worker[mypy-tornado.*]
226*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
227*da0073e9SAndroid Build Coastguard Worker
228*da0073e9SAndroid Build Coastguard Worker[mypy-pydot.*]
229*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
230*da0073e9SAndroid Build Coastguard Worker
231*da0073e9SAndroid Build Coastguard Worker[mypy-networkx.*]
232*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
233*da0073e9SAndroid Build Coastguard Worker
234*da0073e9SAndroid Build Coastguard Worker[mypy-scipy.*]
235*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
236*da0073e9SAndroid Build Coastguard Worker
237*da0073e9SAndroid Build Coastguard Worker[mypy-IPython.*]
238*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
239*da0073e9SAndroid Build Coastguard Worker
240*da0073e9SAndroid Build Coastguard Worker[mypy-google.protobuf.textformat]
241*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
242*da0073e9SAndroid Build Coastguard Worker
243*da0073e9SAndroid Build Coastguard Worker[mypy-lmdb.*]
244*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
245*da0073e9SAndroid Build Coastguard Worker
246*da0073e9SAndroid Build Coastguard Worker[mypy-mpi4py.*]
247*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
248*da0073e9SAndroid Build Coastguard Worker
249*da0073e9SAndroid Build Coastguard Worker[mypy-skimage.*]
250*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
251*da0073e9SAndroid Build Coastguard Worker
252*da0073e9SAndroid Build Coastguard Worker[mypy-librosa.*]
253*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
254*da0073e9SAndroid Build Coastguard Worker
255*da0073e9SAndroid Build Coastguard Worker[mypy-mypy.*]
256*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
257*da0073e9SAndroid Build Coastguard Worker
258*da0073e9SAndroid Build Coastguard Worker[mypy-xml.*]
259*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
260*da0073e9SAndroid Build Coastguard Worker
261*da0073e9SAndroid Build Coastguard Worker[mypy-boto3.*]
262*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
263*da0073e9SAndroid Build Coastguard Worker
264*da0073e9SAndroid Build Coastguard Worker[mypy-dill.*]
265*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
266*da0073e9SAndroid Build Coastguard Worker
267*da0073e9SAndroid Build Coastguard Worker[mypy-usort.*]
268*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
269*da0073e9SAndroid Build Coastguard Worker
270*da0073e9SAndroid Build Coastguard Worker[mypy-torch._inductor.*]
271*da0073e9SAndroid Build Coastguard Workerdisallow_any_generics = True
272*da0073e9SAndroid Build Coastguard Worker
273*da0073e9SAndroid Build Coastguard Worker[mypy-torch._dynamo.*]
274*da0073e9SAndroid Build Coastguard Workerdisallow_any_generics = True
275*da0073e9SAndroid Build Coastguard Worker
276*da0073e9SAndroid Build Coastguard Worker[mypy-cutlass_library.*]
277*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
278*da0073e9SAndroid Build Coastguard Worker
279*da0073e9SAndroid Build Coastguard Worker[mypy-deeplearning.*]
280*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
281*da0073e9SAndroid Build Coastguard Worker
282*da0073e9SAndroid Build Coastguard Worker[mypy-einops.*]
283*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
284*da0073e9SAndroid Build Coastguard Worker
285*da0073e9SAndroid Build Coastguard Worker[mypy-libfb.*]
286*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
287*da0073e9SAndroid Build Coastguard Worker
288*da0073e9SAndroid Build Coastguard Worker[mypy-torch.*.fb.*]
289*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
290*da0073e9SAndroid Build Coastguard Worker
291*da0073e9SAndroid Build Coastguard Worker[mypy-torch.fb.*]
292*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
293*da0073e9SAndroid Build Coastguard Worker
294*da0073e9SAndroid Build Coastguard Worker[mypy-torch_xla.*]
295*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
296*da0073e9SAndroid Build Coastguard Worker
297*da0073e9SAndroid Build Coastguard Worker#
298*da0073e9SAndroid Build Coastguard Worker# Third party dependencies that are optional.
299*da0073e9SAndroid Build Coastguard Worker#
300*da0073e9SAndroid Build Coastguard Worker
301*da0073e9SAndroid Build Coastguard Worker[mypy-onnx.*]
302*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
303*da0073e9SAndroid Build Coastguard Worker
304*da0073e9SAndroid Build Coastguard Worker[mypy-onnxruntime.*]
305*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
306*da0073e9SAndroid Build Coastguard Worker
307*da0073e9SAndroid Build Coastguard Worker[mypy-onnxscript.*]
308*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True
309*da0073e9SAndroid Build Coastguard Worker
310*da0073e9SAndroid Build Coastguard Worker[mypy-redis]
311*da0073e9SAndroid Build Coastguard Workerignore_missing_imports = True