Skip to content

Commit

Permalink
[3.12] gh-110631: Fix reST indentation in Doc/library (GH-110685) (#…
Browse files Browse the repository at this point in the history
…110736)

gh-110631: Fix reST indentation in `Doc/library` (GH-110685)

Fix wrong indentation in the Doc/library dir.
(cherry picked from commit bb7923f)

Co-authored-by: Ezio Melotti <[email protected]>
  • Loading branch information
miss-islington and ezio-melotti authored Oct 11, 2023
1 parent e6c53dd commit cae968b
Show file tree
Hide file tree
Showing 34 changed files with 933 additions and 926 deletions.
46 changes: 23 additions & 23 deletions Doc/library/__main__.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,45 +54,45 @@ The top-level code environment can be:

* the scope of an interactive prompt::

>>> __name__
'__main__'
>>> __name__
'__main__'

* the Python module passed to the Python interpreter as a file argument:

.. code-block:: shell-session
.. code-block:: shell-session
$ python helloworld.py
Hello, world!
$ python helloworld.py
Hello, world!
* the Python module or package passed to the Python interpreter with the
:option:`-m` argument:

.. code-block:: shell-session
.. code-block:: shell-session
$ python -m tarfile
usage: tarfile.py [-h] [-v] (...)
$ python -m tarfile
usage: tarfile.py [-h] [-v] (...)
* Python code read by the Python interpreter from standard input:

.. code-block:: shell-session
.. code-block:: shell-session
$ echo "import this" | python
The Zen of Python, by Tim Peters
$ echo "import this" | python
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
...
Beautiful is better than ugly.
Explicit is better than implicit.
...
* Python code passed to the Python interpreter with the :option:`-c` argument:

.. code-block:: shell-session
.. code-block:: shell-session
$ python -c "import this"
The Zen of Python, by Tim Peters
$ python -c "import this"
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
...
Beautiful is better than ugly.
Explicit is better than implicit.
...
In each of these situations, the top-level module's ``__name__`` is set to
``'__main__'``.
Expand All @@ -102,9 +102,9 @@ top-level environment by checking its own ``__name__``, which allows a common
idiom for conditionally executing code when the module is not initialized from
an import statement::

if __name__ == '__main__':
# Execute when the module is not initialized from an import statement.
...
if __name__ == '__main__':
# Execute when the module is not initialized from an import statement.
...

.. seealso::

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/_thread.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ In addition to these methods, lock objects can also be used via the

**Caveats:**

.. index:: pair: module; signal
.. index:: pair: module; signal

* Threads interact strangely with interrupts: the :exc:`KeyboardInterrupt`
exception will be received by an arbitrary thread. (When the :mod:`signal`
Expand Down
9 changes: 5 additions & 4 deletions Doc/library/binascii.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ The :mod:`binascii` module defines the following functions:
data will raise :exc:`binascii.Error`.

Valid base64:
* Conforms to :rfc:`3548`.
* Contains only characters from the base64 alphabet.
* Contains no excess data after padding (including excess padding, newlines, etc.).
* Does not start with a padding.

* Conforms to :rfc:`3548`.
* Contains only characters from the base64 alphabet.
* Contains no excess data after padding (including excess padding, newlines, etc.).
* Does not start with a padding.

.. versionchanged:: 3.11
Added the *strict_mode* parameter.
Expand Down
78 changes: 39 additions & 39 deletions Doc/library/collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,26 +120,26 @@ The class can be used to simulate nested scopes and is useful in templating.

.. seealso::

* The `MultiContext class
<https://github.com/enthought/codetools/blob/4.0.0/codetools/contexts/multi_context.py>`_
in the Enthought `CodeTools package
<https://github.com/enthought/codetools>`_ has options to support
writing to any mapping in the chain.
* The `MultiContext class
<https://github.com/enthought/codetools/blob/4.0.0/codetools/contexts/multi_context.py>`_
in the Enthought `CodeTools package
<https://github.com/enthought/codetools>`_ has options to support
writing to any mapping in the chain.

* Django's `Context class
<https://github.com/django/django/blob/main/django/template/context.py>`_
for templating is a read-only chain of mappings. It also features
pushing and popping of contexts similar to the
:meth:`~collections.ChainMap.new_child` method and the
:attr:`~collections.ChainMap.parents` property.
* Django's `Context class
<https://github.com/django/django/blob/main/django/template/context.py>`_
for templating is a read-only chain of mappings. It also features
pushing and popping of contexts similar to the
:meth:`~collections.ChainMap.new_child` method and the
:attr:`~collections.ChainMap.parents` property.

* The `Nested Contexts recipe
<https://code.activestate.com/recipes/577434/>`_ has options to control
whether writes and other mutations apply only to the first mapping or to
any mapping in the chain.
* The `Nested Contexts recipe
<https://code.activestate.com/recipes/577434/>`_ has options to control
whether writes and other mutations apply only to the first mapping or to
any mapping in the chain.

* A `greatly simplified read-only version of Chainmap
<https://code.activestate.com/recipes/305268/>`_.
* A `greatly simplified read-only version of Chainmap
<https://code.activestate.com/recipes/305268/>`_.


:class:`ChainMap` Examples and Recipes
Expand Down Expand Up @@ -429,22 +429,22 @@ or subtracting from an empty counter.

.. seealso::

* `Bag class <https://www.gnu.org/software/smalltalk/manual-base/html_node/Bag.html>`_
in Smalltalk.
* `Bag class <https://www.gnu.org/software/smalltalk/manual-base/html_node/Bag.html>`_
in Smalltalk.

* Wikipedia entry for `Multisets <https://en.wikipedia.org/wiki/Multiset>`_.
* Wikipedia entry for `Multisets <https://en.wikipedia.org/wiki/Multiset>`_.

* `C++ multisets <http://www.java2s.com/Tutorial/Cpp/0380__set-multiset/Catalog0380__set-multiset.htm>`_
tutorial with examples.
* `C++ multisets <http://www.java2s.com/Tutorial/Cpp/0380__set-multiset/Catalog0380__set-multiset.htm>`_
tutorial with examples.

* For mathematical operations on multisets and their use cases, see
*Knuth, Donald. The Art of Computer Programming Volume II,
Section 4.6.3, Exercise 19*.
* For mathematical operations on multisets and their use cases, see
*Knuth, Donald. The Art of Computer Programming Volume II,
Section 4.6.3, Exercise 19*.

* To enumerate all distinct multisets of a given size over a given set of
elements, see :func:`itertools.combinations_with_replacement`::
* To enumerate all distinct multisets of a given size over a given set of
elements, see :func:`itertools.combinations_with_replacement`::

map(Counter, combinations_with_replacement('ABC', 2)) # --> AA AB AC BB BC CC
map(Counter, combinations_with_replacement('ABC', 2)) # --> AA AB AC BB BC CC


:class:`deque` objects
Expand Down Expand Up @@ -1060,20 +1060,20 @@ fields:

.. seealso::

* See :class:`typing.NamedTuple` for a way to add type hints for named
tuples. It also provides an elegant notation using the :keyword:`class`
keyword::
* See :class:`typing.NamedTuple` for a way to add type hints for named
tuples. It also provides an elegant notation using the :keyword:`class`
keyword::

class Component(NamedTuple):
part_number: int
weight: float
description: Optional[str] = None
class Component(NamedTuple):
part_number: int
weight: float
description: Optional[str] = None

* See :meth:`types.SimpleNamespace` for a mutable namespace based on an
underlying dictionary instead of a tuple.
* See :meth:`types.SimpleNamespace` for a mutable namespace based on an
underlying dictionary instead of a tuple.

* The :mod:`dataclasses` module provides a decorator and functions for
automatically adding generated special methods to user-defined classes.
* The :mod:`dataclasses` module provides a decorator and functions for
automatically adding generated special methods to user-defined classes.


:class:`OrderedDict` objects
Expand Down
Loading

0 comments on commit cae968b

Please sign in to comment.