@@ -285,16 +285,22 @@ If you are getting this error, try to obtain type hints for the library you're u
285
285
You can do this via setting the
286
286
:option: `--follow-untyped-imports <mypy --follow-untyped-imports> `
287
287
command line flag or :confval: `follow_untyped_imports ` config file option to True.
288
- This option can be specified on a per-module basis as well::
288
+ This option can be specified on a per-module basis as well:
289
289
290
- # mypy.ini
291
- [mypy-untyped_package.*]
292
- follow_untyped_imports = True
290
+ .. tab :: mypy.ini
293
291
294
- # pyproject.toml
295
- [[tool.mypy.overrides]]
296
- module = ["untyped_package.*"]
297
- follow_untyped_imports = true
292
+ .. code-block :: ini
293
+
294
+ [mypy-untyped_package.*]
295
+ follow_untyped_imports = True
296
+
297
+ .. tab :: pyproject.toml
298
+
299
+ .. code-block :: toml
300
+
301
+ [[tool.mypy.overrides]]
302
+ module = ["untyped_package.*"]
303
+ follow_untyped_imports = true
298
304
299
305
If you are unable to find any existing type hints nor have time to write your
300
306
own, you can instead *suppress * the errors.
@@ -312,16 +318,22 @@ not catch errors in its use.
312
318
suppose your codebase
313
319
makes heavy use of an (untyped) library named ``foobar ``. You can silence
314
320
all import errors associated with that library and that library alone by
315
- adding the following section to your config file::
321
+ adding the following section to your config file:
322
+
323
+ .. tab :: mypy.ini
324
+
325
+ .. code-block :: ini
316
326
317
- # mypy.ini
318
- [mypy-foobar.*]
319
- ignore_missing_imports = True
327
+ [mypy-foobar.*]
328
+ ignore_missing_imports = True
320
329
321
- # pyproject.toml
322
- [[tool.mypy.overrides]]
323
- module = ["foobar.*"]
324
- ignore_missing_imports = true
330
+ .. tab :: pyproject.toml
331
+
332
+ .. code-block :: toml
333
+
334
+ [[tool.mypy.overrides]]
335
+ module = ["foobar.*"]
336
+ ignore_missing_imports = true
325
337
326
338
Note: this option is equivalent to adding a ``# type: ignore `` to every
327
339
import of ``foobar `` in your codebase. For more information, see the
@@ -334,15 +346,21 @@ not catch errors in its use.
334
346
in your codebase, use :option: `--disable-error-code=import-untyped <mypy --ignore-missing-imports> `.
335
347
See :ref: `code-import-untyped ` for more details on this error code.
336
348
337
- You can also set :confval: `disable_error_code `, like so::
349
+ You can also set :confval: `disable_error_code `, like so:
350
+
351
+ .. tab :: mypy.ini
352
+
353
+ .. code-block :: ini
354
+
355
+ [mypy]
356
+ disable_error_code = import-untyped
357
+
358
+ .. tab :: pyproject.toml
338
359
339
- # mypy.ini
340
- [mypy]
341
- disable_error_code = import-untyped
360
+ .. code-block :: ini
342
361
343
- # pyproject.toml
344
- [tool.mypy]
345
- disable_error_code = ["import-untyped"]
362
+ [tool.mypy]
363
+ disable_error_code = [" import-untyped" ]
346
364
347
365
You can also set the :option: `--ignore-missing-imports <mypy --ignore-missing-imports> `
348
366
command line flag or set the :confval: `ignore_missing_imports ` config file
0 commit comments