Skip to content

Commit a8ce57c

Browse files
committed
Add missing inline config for "Error codes for optional checks" snippets
1 parent b9147fe commit a8ce57c

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

docs/source/error_code_list2.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ Example:
381381

382382
.. code-block:: python
383383
384+
# mypy: enable-error-code="truthy-iterable"
385+
384386
from collections.abc import Iterable
385387
386388
def transform(items: Iterable[int]) -> list[int]:
@@ -457,6 +459,8 @@ silence the error:
457459

458460
.. code-block:: python
459461
462+
# mypy: enable-error-code="unused-awaitable"
463+
460464
async def g() -> None:
461465
_ = asyncio.create_task(f()) # No error
462466
@@ -475,7 +479,7 @@ Example:
475479

476480
.. code-block:: python
477481
478-
# Use "mypy --warn-unused-ignores ..."
482+
# mypy: warn-unused-ignores
479483
480484
def add(a: int, b: int) -> int:
481485
# Error: unused "type: ignore" comment
@@ -490,7 +494,7 @@ Example:
490494

491495
.. code-block:: python
492496
493-
# Use "mypy --warn-unused-ignores ..."
497+
# mypy: warn-unused-ignores
494498
495499
import sys
496500
@@ -557,6 +561,8 @@ flagged when this error code is enabled:
557561

558562
.. code-block:: python
559563
564+
# mypy: enable-error-code="mutable-override"
565+
560566
from typing import Any
561567
562568
class C:
@@ -650,6 +656,8 @@ Example:
650656

651657
.. code-block:: python
652658
659+
# mypy: enable-error-code="exhaustive-match"
660+
653661
import enum
654662
655663
@@ -690,6 +698,8 @@ Example:
690698

691699
.. code-block:: python
692700
701+
# mypy: disallow-untyped-decorators
702+
693703
def printing_decorator(func):
694704
def wrapper(*args, **kwds):
695705
print("Calling", func)

0 commit comments

Comments
 (0)