Skip to content

Commit dd4c09b

Browse files
ezio-melottiGlyphack
authored andcommitted
pythongh-110631: Fix reST indentation in Doc/reference (python#110708)
Fix wrong indentation in the Doc/reference dir.
1 parent f009ecf commit dd4c09b

File tree

4 files changed

+79
-77
lines changed

4 files changed

+79
-77
lines changed

Doc/reference/compound_stmts.rst

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -642,14 +642,14 @@ Here's an overview of the logical flow of a match statement:
642642
specified below. **Name bindings made during a successful pattern match
643643
outlive the executed block and can be used after the match statement**.
644644

645-
.. note::
645+
.. note::
646646

647-
During failed pattern matches, some subpatterns may succeed. Do not
648-
rely on bindings being made for a failed match. Conversely, do not
649-
rely on variables remaining unchanged after a failed match. The exact
650-
behavior is dependent on implementation and may vary. This is an
651-
intentional decision made to allow different implementations to add
652-
optimizations.
647+
During failed pattern matches, some subpatterns may succeed. Do not
648+
rely on bindings being made for a failed match. Conversely, do not
649+
rely on variables remaining unchanged after a failed match. The exact
650+
behavior is dependent on implementation and may vary. This is an
651+
intentional decision made to allow different implementations to add
652+
optimizations.
653653

654654
#. If the pattern succeeds, the corresponding guard (if present) is evaluated. In
655655
this case all name bindings are guaranteed to have happened.
@@ -1170,8 +1170,10 @@ In simple terms ``CLS(P1, attr=P2)`` matches only if the following happens:
11701170
* ``isinstance(<subject>, CLS)``
11711171
* convert ``P1`` to a keyword pattern using ``CLS.__match_args__``
11721172
* For each keyword argument ``attr=P2``:
1173-
* ``hasattr(<subject>, "attr")``
1174-
* ``P2`` matches ``<subject>.attr``
1173+
1174+
* ``hasattr(<subject>, "attr")``
1175+
* ``P2`` matches ``<subject>.attr``
1176+
11751177
* ... and so on for the corresponding keyword argument/pattern pair.
11761178

11771179
.. seealso::
@@ -1838,29 +1840,29 @@ like ``TYPE_PARAMS_OF_ListOrSet`` are not actually bound at runtime.
18381840
18391841
.. [#] In pattern matching, a sequence is defined as one of the following:
18401842
1841-
* a class that inherits from :class:`collections.abc.Sequence`
1842-
* a Python class that has been registered as :class:`collections.abc.Sequence`
1843-
* a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_SEQUENCE` bit set
1844-
* a class that inherits from any of the above
1843+
* a class that inherits from :class:`collections.abc.Sequence`
1844+
* a Python class that has been registered as :class:`collections.abc.Sequence`
1845+
* a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_SEQUENCE` bit set
1846+
* a class that inherits from any of the above
18451847
18461848
The following standard library classes are sequences:
18471849
1848-
* :class:`array.array`
1849-
* :class:`collections.deque`
1850-
* :class:`list`
1851-
* :class:`memoryview`
1852-
* :class:`range`
1853-
* :class:`tuple`
1850+
* :class:`array.array`
1851+
* :class:`collections.deque`
1852+
* :class:`list`
1853+
* :class:`memoryview`
1854+
* :class:`range`
1855+
* :class:`tuple`
18541856
18551857
.. note:: Subject values of type ``str``, ``bytes``, and ``bytearray``
18561858
do not match sequence patterns.
18571859
18581860
.. [#] In pattern matching, a mapping is defined as one of the following:
18591861
1860-
* a class that inherits from :class:`collections.abc.Mapping`
1861-
* a Python class that has been registered as :class:`collections.abc.Mapping`
1862-
* a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_MAPPING` bit set
1863-
* a class that inherits from any of the above
1862+
* a class that inherits from :class:`collections.abc.Mapping`
1863+
* a Python class that has been registered as :class:`collections.abc.Mapping`
1864+
* a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_MAPPING` bit set
1865+
* a class that inherits from any of the above
18641866
18651867
The standard library classes :class:`dict` and :class:`types.MappingProxyType`
18661868
are mappings.

Doc/reference/expressions.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,8 @@ the yield expression. It can be either set explicitly when raising
499499
:exc:`StopIteration`, or automatically when the subiterator is a generator
500500
(by returning a value from the subgenerator).
501501

502-
.. versionchanged:: 3.3
503-
Added ``yield from <expr>`` to delegate control flow to a subiterator.
502+
.. versionchanged:: 3.3
503+
Added ``yield from <expr>`` to delegate control flow to a subiterator.
504504

505505
The parentheses may be omitted when the yield expression is the sole expression
506506
on the right hand side of an assignment statement.

Doc/reference/import.rst

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -375,32 +375,32 @@ of what happens during the loading portion of import::
375375

376376
Note the following details:
377377

378-
* If there is an existing module object with the given name in
379-
:data:`sys.modules`, import will have already returned it.
378+
* If there is an existing module object with the given name in
379+
:data:`sys.modules`, import will have already returned it.
380380

381-
* The module will exist in :data:`sys.modules` before the loader
382-
executes the module code. This is crucial because the module code may
383-
(directly or indirectly) import itself; adding it to :data:`sys.modules`
384-
beforehand prevents unbounded recursion in the worst case and multiple
385-
loading in the best.
381+
* The module will exist in :data:`sys.modules` before the loader
382+
executes the module code. This is crucial because the module code may
383+
(directly or indirectly) import itself; adding it to :data:`sys.modules`
384+
beforehand prevents unbounded recursion in the worst case and multiple
385+
loading in the best.
386386

387-
* If loading fails, the failing module -- and only the failing module --
388-
gets removed from :data:`sys.modules`. Any module already in the
389-
:data:`sys.modules` cache, and any module that was successfully loaded
390-
as a side-effect, must remain in the cache. This contrasts with
391-
reloading where even the failing module is left in :data:`sys.modules`.
387+
* If loading fails, the failing module -- and only the failing module --
388+
gets removed from :data:`sys.modules`. Any module already in the
389+
:data:`sys.modules` cache, and any module that was successfully loaded
390+
as a side-effect, must remain in the cache. This contrasts with
391+
reloading where even the failing module is left in :data:`sys.modules`.
392392

393-
* After the module is created but before execution, the import machinery
394-
sets the import-related module attributes ("_init_module_attrs" in
395-
the pseudo-code example above), as summarized in a
396-
:ref:`later section <import-mod-attrs>`.
393+
* After the module is created but before execution, the import machinery
394+
sets the import-related module attributes ("_init_module_attrs" in
395+
the pseudo-code example above), as summarized in a
396+
:ref:`later section <import-mod-attrs>`.
397397

398-
* Module execution is the key moment of loading in which the module's
399-
namespace gets populated. Execution is entirely delegated to the
400-
loader, which gets to decide what gets populated and how.
398+
* Module execution is the key moment of loading in which the module's
399+
namespace gets populated. Execution is entirely delegated to the
400+
loader, which gets to decide what gets populated and how.
401401

402-
* The module created during loading and passed to exec_module() may
403-
not be the one returned at the end of import [#fnlo]_.
402+
* The module created during loading and passed to exec_module() may
403+
not be the one returned at the end of import [#fnlo]_.
404404

405405
.. versionchanged:: 3.4
406406
The import system has taken over the boilerplate responsibilities of
@@ -417,13 +417,13 @@ returned from :meth:`~importlib.abc.Loader.exec_module` is ignored.
417417

418418
Loaders must satisfy the following requirements:
419419

420-
* If the module is a Python module (as opposed to a built-in module or a
421-
dynamically loaded extension), the loader should execute the module's code
422-
in the module's global name space (``module.__dict__``).
420+
* If the module is a Python module (as opposed to a built-in module or a
421+
dynamically loaded extension), the loader should execute the module's code
422+
in the module's global name space (``module.__dict__``).
423423

424-
* If the loader cannot execute the module, it should raise an
425-
:exc:`ImportError`, although any other exception raised during
426-
:meth:`~importlib.abc.Loader.exec_module` will be propagated.
424+
* If the loader cannot execute the module, it should raise an
425+
:exc:`ImportError`, although any other exception raised during
426+
:meth:`~importlib.abc.Loader.exec_module` will be propagated.
427427

428428
In many cases, the finder and loader can be the same object; in such cases the
429429
:meth:`~importlib.abc.MetaPathFinder.find_spec` method would just return a
@@ -453,20 +453,20 @@ import machinery will create the new module itself.
453453
functionality described above in addition to executing the module. All
454454
the same constraints apply, with some additional clarification:
455455

456-
* If there is an existing module object with the given name in
457-
:data:`sys.modules`, the loader must use that existing module.
458-
(Otherwise, :func:`importlib.reload` will not work correctly.) If the
459-
named module does not exist in :data:`sys.modules`, the loader
460-
must create a new module object and add it to :data:`sys.modules`.
456+
* If there is an existing module object with the given name in
457+
:data:`sys.modules`, the loader must use that existing module.
458+
(Otherwise, :func:`importlib.reload` will not work correctly.) If the
459+
named module does not exist in :data:`sys.modules`, the loader
460+
must create a new module object and add it to :data:`sys.modules`.
461461

462-
* The module *must* exist in :data:`sys.modules` before the loader
463-
executes the module code, to prevent unbounded recursion or multiple
464-
loading.
462+
* The module *must* exist in :data:`sys.modules` before the loader
463+
executes the module code, to prevent unbounded recursion or multiple
464+
loading.
465465

466-
* If loading fails, the loader must remove any modules it has inserted
467-
into :data:`sys.modules`, but it must remove **only** the failing
468-
module(s), and only if the loader itself has loaded the module(s)
469-
explicitly.
466+
* If loading fails, the loader must remove any modules it has inserted
467+
into :data:`sys.modules`, but it must remove **only** the failing
468+
module(s), and only if the loader itself has loaded the module(s)
469+
explicitly.
470470

471471
.. versionchanged:: 3.5
472472
A :exc:`DeprecationWarning` is raised when ``exec_module()`` is defined but
@@ -693,17 +693,17 @@ with defaults for whatever information is missing.
693693

694694
Here are the exact rules used:
695695

696-
* If the module has a ``__spec__`` attribute, the information in the spec
697-
is used to generate the repr. The "name", "loader", "origin", and
698-
"has_location" attributes are consulted.
696+
* If the module has a ``__spec__`` attribute, the information in the spec
697+
is used to generate the repr. The "name", "loader", "origin", and
698+
"has_location" attributes are consulted.
699699

700-
* If the module has a ``__file__`` attribute, this is used as part of the
701-
module's repr.
700+
* If the module has a ``__file__`` attribute, this is used as part of the
701+
module's repr.
702702

703-
* If the module has no ``__file__`` but does have a ``__loader__`` that is not
704-
``None``, then the loader's repr is used as part of the module's repr.
703+
* If the module has no ``__file__`` but does have a ``__loader__`` that is not
704+
``None``, then the loader's repr is used as part of the module's repr.
705705

706-
* Otherwise, just use the module's ``__name__`` in the repr.
706+
* Otherwise, just use the module's ``__name__`` in the repr.
707707

708708
.. versionchanged:: 3.12
709709
Use of :meth:`!module_repr`, having been deprecated since Python 3.4, was

Doc/reference/lexical_analysis.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -657,12 +657,12 @@ is more easily recognized as broken.) It is also important to note that the
657657
escape sequences only recognized in string literals fall into the category of
658658
unrecognized escapes for bytes literals.
659659

660-
.. versionchanged:: 3.6
661-
Unrecognized escape sequences produce a :exc:`DeprecationWarning`.
660+
.. versionchanged:: 3.6
661+
Unrecognized escape sequences produce a :exc:`DeprecationWarning`.
662662

663-
.. versionchanged:: 3.12
664-
Unrecognized escape sequences produce a :exc:`SyntaxWarning`. In a future
665-
Python version they will be eventually a :exc:`SyntaxError`.
663+
.. versionchanged:: 3.12
664+
Unrecognized escape sequences produce a :exc:`SyntaxWarning`. In a future
665+
Python version they will be eventually a :exc:`SyntaxError`.
666666

667667
Even in a raw literal, quotes can be escaped with a backslash, but the
668668
backslash remains in the result; for example, ``r"\""`` is a valid string

0 commit comments

Comments
 (0)