Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.11] gh-110631: Fix reST indentation in Doc/library (GH-110685) #110737

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

$ python3 helloworld.py
Hello, world!
$ python3 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

$ python3 -m tarfile
usage: tarfile.py [-h] [-v] (...)
$ python3 -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" | python3
The Zen of Python, by Tim Peters
$ echo "import this" | python
ezio-melotti marked this conversation as resolved.
Show resolved Hide resolved
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

$ python3 -c "import this"
The Zen of Python, by Tim Peters
$ python3 -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 @@ -206,7 +206,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 @@ -428,22 +428,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 @@ -1058,20 +1058,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
Loading