From 12fcb4fbd1719a16a636964a492bc37161d8c8b8 Mon Sep 17 00:00:00 2001 From: Ivan Levkivskyi Date: Sun, 25 Jun 2023 23:47:04 +0100 Subject: [PATCH] Add docs for new flag --- docs/source/command_line.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/source/command_line.rst b/docs/source/command_line.rst index 2809294092ab..d9de5cd8f9bd 100644 --- a/docs/source/command_line.rst +++ b/docs/source/command_line.rst @@ -612,6 +612,34 @@ of the above sections. assert text is not None # OK, check against None is allowed as a special case. +.. option:: --extra-checks + + This flag enables additional checks that are technically correct but may be + impractical in real code. In particular, it prohibits partial overlap in + ``TypedDict`` updates, and makes arguments prepended via ``Concatenate`` + positional-only. For example: + + .. code-block:: python + + from typing import TypedDict + + class Foo(TypedDict): + a: int + + class Bar(TypedDict): + a: int + b: int + + def test(foo: Foo, bar: Bar) -> None: + # This is technically unsafe since foo can have a subtype of Foo at + # runtime, where type of key "b" is incompatible with int, see below + bar.update(foo) + + class Bad(Foo): + b: str + bad: Bad = {"a": 0, "b": "no"} + test(bad, bar) + .. option:: --strict This flag mode enables all optional error checking flags. You can see the