@@ -158,6 +158,58 @@ reportOverlappingOverload = false
158
158
reportImportCycles = false
159
159
reportPrivateUsage = false
160
160
161
+ [tool .mypy ]
162
+ pretty = true
163
+ show_error_codes = true
164
+
165
+ # Exclude _files.py because mypy isn't smart enough to apply
166
+ # the correct type narrowing and as this is an internal module
167
+ # it's fine to just use Pyright.
168
+ #
169
+ # We also exclude our `tests` as mypy doesn't always infer
170
+ # types correctly and Pyright will still catch any type errors.
171
+ exclude = [' src/cloudflare/_files.py' , ' _dev/.*.py' , ' tests/.*' , ' src/cloudflare/resources/zero_trust/identity_providers\.py' , ' src/cloudflare/resources/zero_trust/access/applications/applications\.py' , ' src/cloudflare/resources/workers/ai\.py' , ' src/cloudflare/resources/magic_transit/apps\.py' ]
172
+
173
+ strict_equality = true
174
+ implicit_reexport = true
175
+ check_untyped_defs = true
176
+ no_implicit_optional = true
177
+
178
+ warn_return_any = true
179
+ warn_unreachable = true
180
+ warn_unused_configs = true
181
+
182
+ # Turn these options off as it could cause conflicts
183
+ # with the Pyright options.
184
+ warn_unused_ignores = false
185
+ warn_redundant_casts = false
186
+
187
+ disallow_any_generics = true
188
+ disallow_untyped_defs = true
189
+ disallow_untyped_calls = true
190
+ disallow_subclassing_any = true
191
+ disallow_incomplete_defs = true
192
+ disallow_untyped_decorators = true
193
+ cache_fine_grained = true
194
+
195
+ # By default, mypy reports an error if you assign a value to the result
196
+ # of a function call that doesn't return anything. We do this in our test
197
+ # cases:
198
+ # ```
199
+ # result = ...
200
+ # assert result is None
201
+ # ```
202
+ # Changing this codegen to make mypy happy would increase complexity
203
+ # and would not be worth it.
204
+ disable_error_code = " func-returns-value,overload-cannot-match"
205
+
206
+ # https://github.com/python/mypy/issues/12162
207
+ [[tool .mypy .overrides ]]
208
+ module = " black.files.*"
209
+ ignore_errors = true
210
+ ignore_missing_imports = true
211
+
212
+
161
213
[tool .ruff ]
162
214
line-length = 120
163
215
output-format = " grouped"
0 commit comments