Skip to content

Commit 10aac3e

Browse files
authored
Fixed the header levels in the "Read-only Items". (#1727)
Fixed the header levels in the "Read-only Items". Currently, the "Read-only Items" section is appearing in the top-level Table of Contents, when it's really meant to be a part of the "TypedDict" chapter.
1 parent c62646f commit 10aac3e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/spec/typeddict.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -645,14 +645,14 @@ annotations, which may always want ``Annotated[]`` as the outermost annotation
645645

646646

647647
Read-only Items
648-
===============
648+
---------------
649649

650650
(Originally specified in :pep:`705`.)
651651

652652
.. _`readonly`:
653653

654654
``typing.ReadOnly`` type qualifier
655-
----------------------------------
655+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
656656

657657
The ``typing.ReadOnly`` :term:`type qualifier` is used to indicate that an item declared in a ``TypedDict`` definition may not be mutated (added, modified, or removed)::
658658

@@ -669,7 +669,7 @@ The ``typing.ReadOnly`` :term:`type qualifier` is used to indicate that an item
669669

670670

671671
Interaction with other special types
672-
------------------------------------
672+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
673673

674674
``ReadOnly[]`` can be used with ``Required[]``, ``NotRequired[]`` and ``Annotated[]``, in any nesting order:
675675

@@ -687,7 +687,7 @@ Interaction with other special types
687687

688688

689689
Inheritance
690-
-----------
690+
^^^^^^^^^^^
691691

692692
Subclasses can redeclare read-only items as non-read-only, allowing them to be mutated::
693693

@@ -740,7 +740,7 @@ Subclasses can combine these rules::
740740
Note that these are just consequences of structural typing, but they are highlighted here as the behavior now differs from the rules specified in :pep:`589`.
741741

742742
Type consistency
743-
----------------
743+
^^^^^^^^^^^^^^^^
744744

745745
*This section updates the type consistency rules described above that were created prior to the introduction of ReadOnly*
746746

@@ -783,7 +783,7 @@ Discussion:
783783
b: B = a # Accepted by type checker
784784

785785
Update method
786-
-------------
786+
^^^^^^^^^^^^^
787787

788788
In addition to existing type checking rules, type checkers should error if a TypedDict with a read-only item is updated with another TypedDict that declares that key::
789789

@@ -807,7 +807,7 @@ Unless the declared value is of bottom type (:data:`~typing.Never`)::
807807
Note: Nothing will ever match the ``Never`` type, so an item annotated with it must be absent.
808808

809809
Keyword argument typing
810-
-----------------------
810+
^^^^^^^^^^^^^^^^^^^^^^^
811811

812812
As discussed in the section :ref:`unpack-kwargs`, an unpacked ``TypedDict`` can be used to annotate ``**kwargs``. Marking one or more of the items of a ``TypedDict`` used in this way as read-only will have no effect on the type signature of the method. However, it *will* prevent the item from being modified in the body of the function::
813813

0 commit comments

Comments
 (0)