@@ -294,7 +294,7 @@ is obvious from the context:
294294 ``__slots__ ``.
295295
296296Examples of known and unknown types
297- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
297+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
298298
299299.. code :: python
300300
@@ -402,7 +402,7 @@ Best Practices for Inlined Types
402402================================
403403
404404Wide vs. Narrow Types
405- ~~~~~~~~~~~~~~~~~~~~~
405+ ---------------------
406406
407407In type theory, when comparing two types that are related to each other,
408408the “wider” type is the one that is more general, and the “narrower”
@@ -433,7 +433,7 @@ parameter typed as ``List[Union[str, int]]`` is much more restrictive
433433and accepts only a ``List[Union[str, int]] ``.
434434
435435Overloads
436- ~~~~~~~~~
436+ ---------
437437
438438If a function or method can return multiple different types and those
439439types can be determined based on the presence or types of certain
@@ -443,7 +443,7 @@ are used within a “.py” file, they must appear prior to the function
443443implementation, which should not have an ``@overload `` decorator.
444444
445445Keyword-only Parameters
446- ~~~~~~~~~~~~~~~~~~~~~~~
446+ -----------------------
447447
448448If a function or method is intended to take parameters that are
449449specified only by name, use the keyword-only separator (``* ``).
@@ -454,7 +454,7 @@ specified only by name, use the keyword-only separator (``*``).
454454 ...
455455
456456 Annotating Decorators
457- ~~~~~~~~~~~~~~~~~~~~~
457+ ---------------------
458458
459459Decorators modify the behavior of a class or a function. Providing
460460annotations for decorators is straightforward if the decorator retains
@@ -491,7 +491,7 @@ provide signature assistance. As such, library authors are discouraged
491491from creating decorators that mutate function signatures in this manner.
492492
493493Generic Classes and Functions
494- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
494+ -----------------------------
495495
496496Classes and functions that can operate in a generic manner on various
497497types should declare themselves as generic using the mechanisms
@@ -501,7 +501,7 @@ should be private to the file that declares it, and should therefore
501501begin with an underscore.
502502
503503Type Aliases
504- ~~~~~~~~~~~~
504+ ------------
505505
506506Type aliases are symbols that refer to other types. Generic type aliases
507507(those that refer to unspecialized generic classes) are supported by
@@ -526,7 +526,7 @@ annotation.
526526 StrOrInt: TypeAlias = Union[str , int ]
527527
528528 Abstract Classes and Methods
529- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
529+ ----------------------------
530530
531531Classes that must be subclassed should derive from ``ABC ``, and methods
532532or properties that must be overridden should be decorated with the
@@ -553,7 +553,7 @@ exception.
553553 raise NotImplementedError ()
554554
555555 Final Classes and Methods
556- ~~~~~~~~~~~~~~~~~~~~~~~~~
556+ -------------------------
557557
558558Classes that are not intended to be subclassed should be decorated as
559559``@final `` as described in `PEP
@@ -562,15 +562,15 @@ can also be used to specify methods that cannot be overridden by
562562subclasses.
563563
564564Literals
565- ~~~~~~~~
565+ --------
566566
567567Type annotations should make use of the Literal type where appropriate,
568568as described in `PEP 586 <https://www.python.org/dev/peps/pep-0586/ >`__.
569569Literals allow for more type specificity than their non-literal
570570counterparts.
571571
572572Constants
573- ~~~~~~~~~
573+ ---------
574574
575575Constant values (those that are read-only) can be specified using the
576576Final annotation as described in `PEP
@@ -601,7 +601,7 @@ type annotation would be redundant.
601601 LATEST_VERSION : Final[Tuple[int , int ]] = (4 , 5 )
602602
603603 Typed Dictionaries, Data Classes, and Named Tuples
604- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
604+ --------------------------------------------------
605605
606606If your library runs only on newer versions of Python, you are
607607encouraged to use some of the new type-friendly classes.
@@ -628,7 +628,7 @@ section documents several techniques that can be used to add types while
628628maintaining backward compatibility.
629629
630630Quoted Annotations
631- ~~~~~~~~~~~~~~~~~~
631+ ------------------
632632
633633Type annotations for variables, parameters, and return types can be
634634placed in quotes. The Python interpreter will then ignore them, whereas
@@ -643,7 +643,7 @@ a type checker will interpret them as type annotations.
643643 return self ._config
644644
645645 Type Comment Annotations
646- ~~~~~~~~~~~~~~~~~~~~~~~~
646+ ------------------------
647647
648648Python 3.0 introduced syntax for parameter and return type annotations,
649649as specified in `PEP 484 <https://www.python.org/dev/peps/pep-0484/ >`__.
@@ -678,15 +678,15 @@ type: .
678678 ...
679679
680680 typing_extensions
681- ~~~~~~~~~~~~~~~~~
681+ -----------------
682682
683683New type features that require runtime support are typically included in
684684the stdlib ``typing `` module. Where possible, these new features are
685685back-ported to a runtime library called ``typing_extensions `` that works
686686with older Python runtimes.
687687
688688TYPE_CHECKING
689- ~~~~~~~~~~~~~
689+ -------------
690690
691691The ``typing `` module exposes a variable called ``TYPE_CHECKING `` which
692692has a value of False within the Python runtime but a value of True when
0 commit comments