forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathpyrefly.toml
More file actions
242 lines (228 loc) · 6.71 KB
/
Copy pathpyrefly.toml
File metadata and controls
242 lines (228 loc) · 6.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# A Pyrefly configuration for PyTorch
# Based on https://github.com/pytorch/pytorch/blob/main/mypy.ini
python-version = "3.12"
project-includes = [
"torch",
"caffe2",
"tools",
"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 = [
"torch/_inductor/runtime/triton_heuristics.py",
"torch/_inductor/runtime/triton_helpers.py",
"torch/_inductor/runtime/halide_helpers.py",
"torch/utils/data/typing.ipynb",
"torch/utils/data/dataframes_pipes.ipynb",
"torch/utils/data/standard_pipes.ipynb",
"torch/onnx/_internal/exporter/_torchlib/ops/nn.py",
"torch/include/**",
"torch/csrc/**",
"torch/distributed/elastic/agent/server/api.py",
"torch/testing/_internal/**",
"torch/distributed/fsdp/fully_sharded_data_parallel.py",
"torch/ao/quantization/pt2e/_affine_quantization.py",
"torch/nn/modules/pooling.py",
"torch/nn/parallel/_functions.py",
"torch/_appdirs.py",
"torch/multiprocessing/pool.py",
"torch/overrides.py",
"*/__pycache__/**",
"*/.*",
"torch/_inductor/kernel/vendored_templates/cutedsl/kernels/**",
"torch/_inductor/kernel/vendored_templates/cutedsl/dense_blockscaled_gemm_persistent.py",
"torch/_vendor/quack/**",
]
ignore-missing-imports = [
# XPU memory symbols not present for builds without XPU support
"torch._C._xpu_beginAllocateCurrentThreadToPool",
"torch._C._xpu_endAllocateToPool",
"torch._C._xpu_releasePool",
"torch._C._xpu_XPUAllocator",
"torch._C._XPUMemPool",
"torch._C._StaticXpuLauncher",
"torch._C._jit_tree_views.*",
"torch.for_onnx.onnx.*",
"torch.ao.quantization.experimental.apot_utils.*",
"torch.ao.quantization.experimental.quantizer.*",
"torch.ao.quantization.experimental.observer.*",
"torch.ao.quantization.experimental.APoT_tensor.*",
"torch.ao.quantization.experimental.fake_quantize_function.*",
"torch.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.fb.*",
"torch.*.fb.*",
"torch_xla.*",
"onnx.*",
"onnxruntime.*",
"onnxscript.*",
"redis.*",
"tabulate.*",
]
# 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
# 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"]
enable-fallback-search-path = true
# Dynamo sub-config - note, we experiment with stricter typing here
[[sub-config]]
matches = "torch/_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/_dispatch/**"
[sub-config.errors]
implicit-import = false
implicit-any = true
[[sub-config]]
matches = "torch/_subclasses/**"
[sub-config.errors]
implicit-import = false
implicit-any = true
[[sub-config]]
matches = "torch/_functorch/**"
[sub-config.errors]
implicit-import = false
implicit-any = true
[[sub-config]]
matches = "torch/fx/**"
[sub-config.errors]
implicit-import = false
implicit-any = true
bad-param-name-override = false
unannotated-return = true
unannotated-parameter = true
unannotated-attribute = true
[[sub-config]]
matches = "torch/__init__.py"
[sub-config.errors]
implicit-import = false
implicit-any = true
bad-param-name-override = false
unannotated-return = true
unannotated-parameter = true
[[sub-config]]
matches = "torch/_numpy/linalg.py"
[sub-config.errors]
implicit-import = false
implicit-any = true
bad-param-name-override = false
unannotated-return = true
unannotated-parameter = true
unannotated-attribute = true
[[sub-config]]
matches = "torch/_numpy/_reductions_impl.py"
[sub-config.errors]
implicit-import = false
implicit-any = true
bad-param-name-override = false
unannotated-return = true
unannotated-parameter = true
unannotated-attribute = true
[[sub-config]]
matches = "torch/_numpy/fft.py"
[sub-config.errors]
implicit-import = false
implicit-any = true
bad-param-name-override = false
unannotated-return = true
unannotated-parameter = true
unannotated-attribute = true
[[sub-config]]
matches = "torch/_numpy/_dtypes.py"
[sub-config.errors]
implicit-import = false
implicit-any = true
bad-param-name-override = false
unannotated-return = true
unannotated-parameter = true
unannotated-attribute = true
[[sub-config]]
matches = "torch/_numpy/_normalizations.py"
[sub-config.errors]
implicit-import = false
implicit-any = true
bad-param-name-override = false
unannotated-return = true
unannotated-parameter = true
unannotated-attribute = true
[[sub-config]]
matches = "torch/_numpy/_util.py"
[sub-config.errors]
implicit-import = false
implicit-any = true
bad-param-name-override = false
unannotated-return = true
unannotated-parameter = true
unannotated-attribute = true