Skip to content

Commit d3ded08

Browse files
authored
bpo-40204: Add :noindex: in the documentation (GH-21859)
Add :noindex: to duplicated documentation to fix "duplicate object description" errors. For example, fix this Sphinx 3 issue: Doc/library/configparser.rst:1146: WARNING: duplicate object description of configparser.ConfigParser.optionxform, other instance in library/configparser, use :noindex: for one of them
1 parent 20ae565 commit d3ded08

File tree

9 files changed

+94
-81
lines changed

9 files changed

+94
-81
lines changed

Doc/library/aifc.rst

+2
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ number of frames must be filled in.
208208

209209

210210
.. method:: aifc.tell()
211+
:noindex:
211212

212213
Return the current write position in the output file. Useful in combination
213214
with :meth:`setmark`.
@@ -232,6 +233,7 @@ number of frames must be filled in.
232233

233234

234235
.. method:: aifc.close()
236+
:noindex:
235237

236238
Close the AIFF file. The header of the file is updated to reflect the actual
237239
size of the audio data. After calling this method, the object can no longer be

Doc/library/configparser.rst

+81-80
Original file line numberDiff line numberDiff line change
@@ -674,97 +674,98 @@ be overridden by subclasses or by attribute assignment.
674674

675675
.. attribute:: ConfigParser.BOOLEAN_STATES
676676

677-
By default when using :meth:`~ConfigParser.getboolean`, config parsers
678-
consider the following values ``True``: ``'1'``, ``'yes'``, ``'true'``,
679-
``'on'`` and the following values ``False``: ``'0'``, ``'no'``, ``'false'``,
680-
``'off'``. You can override this by specifying a custom dictionary of strings
681-
and their Boolean outcomes. For example:
682-
683-
.. doctest::
684-
685-
>>> custom = configparser.ConfigParser()
686-
>>> custom['section1'] = {'funky': 'nope'}
687-
>>> custom['section1'].getboolean('funky')
688-
Traceback (most recent call last):
689-
...
690-
ValueError: Not a boolean: nope
691-
>>> custom.BOOLEAN_STATES = {'sure': True, 'nope': False}
692-
>>> custom['section1'].getboolean('funky')
693-
False
694-
695-
Other typical Boolean pairs include ``accept``/``reject`` or
696-
``enabled``/``disabled``.
677+
By default when using :meth:`~ConfigParser.getboolean`, config parsers
678+
consider the following values ``True``: ``'1'``, ``'yes'``, ``'true'``,
679+
``'on'`` and the following values ``False``: ``'0'``, ``'no'``, ``'false'``,
680+
``'off'``. You can override this by specifying a custom dictionary of strings
681+
and their Boolean outcomes. For example:
682+
683+
.. doctest::
684+
685+
>>> custom = configparser.ConfigParser()
686+
>>> custom['section1'] = {'funky': 'nope'}
687+
>>> custom['section1'].getboolean('funky')
688+
Traceback (most recent call last):
689+
...
690+
ValueError: Not a boolean: nope
691+
>>> custom.BOOLEAN_STATES = {'sure': True, 'nope': False}
692+
>>> custom['section1'].getboolean('funky')
693+
False
694+
695+
Other typical Boolean pairs include ``accept``/``reject`` or
696+
``enabled``/``disabled``.
697697

698698
.. method:: ConfigParser.optionxform(option)
699+
:noindex:
699700

700-
This method transforms option names on every read, get, or set
701-
operation. The default converts the name to lowercase. This also
702-
means that when a configuration file gets written, all keys will be
703-
lowercase. Override this method if that's unsuitable.
704-
For example:
701+
This method transforms option names on every read, get, or set
702+
operation. The default converts the name to lowercase. This also
703+
means that when a configuration file gets written, all keys will be
704+
lowercase. Override this method if that's unsuitable.
705+
For example:
705706

706-
.. doctest::
707+
.. doctest::
708+
709+
>>> config = """
710+
... [Section1]
711+
... Key = Value
712+
...
713+
... [Section2]
714+
... AnotherKey = Value
715+
... """
716+
>>> typical = configparser.ConfigParser()
717+
>>> typical.read_string(config)
718+
>>> list(typical['Section1'].keys())
719+
['key']
720+
>>> list(typical['Section2'].keys())
721+
['anotherkey']
722+
>>> custom = configparser.RawConfigParser()
723+
>>> custom.optionxform = lambda option: option
724+
>>> custom.read_string(config)
725+
>>> list(custom['Section1'].keys())
726+
['Key']
727+
>>> list(custom['Section2'].keys())
728+
['AnotherKey']
707729

708-
>>> config = """
709-
... [Section1]
710-
... Key = Value
711-
...
712-
... [Section2]
713-
... AnotherKey = Value
714-
... """
715-
>>> typical = configparser.ConfigParser()
716-
>>> typical.read_string(config)
717-
>>> list(typical['Section1'].keys())
718-
['key']
719-
>>> list(typical['Section2'].keys())
720-
['anotherkey']
721-
>>> custom = configparser.RawConfigParser()
722-
>>> custom.optionxform = lambda option: option
723-
>>> custom.read_string(config)
724-
>>> list(custom['Section1'].keys())
725-
['Key']
726-
>>> list(custom['Section2'].keys())
727-
['AnotherKey']
728-
729-
.. note::
730-
The optionxform function transforms option names to a canonical form.
731-
This should be an idempotent function: if the name is already in
732-
canonical form, it should be returned unchanged.
730+
.. note::
731+
The optionxform function transforms option names to a canonical form.
732+
This should be an idempotent function: if the name is already in
733+
canonical form, it should be returned unchanged.
733734

734735

735736
.. attribute:: ConfigParser.SECTCRE
736737

737-
A compiled regular expression used to parse section headers. The default
738-
matches ``[section]`` to the name ``"section"``. Whitespace is considered
739-
part of the section name, thus ``[ larch ]`` will be read as a section of
740-
name ``" larch "``. Override this attribute if that's unsuitable. For
741-
example:
738+
A compiled regular expression used to parse section headers. The default
739+
matches ``[section]`` to the name ``"section"``. Whitespace is considered
740+
part of the section name, thus ``[ larch ]`` will be read as a section of
741+
name ``" larch "``. Override this attribute if that's unsuitable. For
742+
example:
743+
744+
.. doctest::
745+
746+
>>> import re
747+
>>> config = """
748+
... [Section 1]
749+
... option = value
750+
...
751+
... [ Section 2 ]
752+
... another = val
753+
... """
754+
>>> typical = configparser.ConfigParser()
755+
>>> typical.read_string(config)
756+
>>> typical.sections()
757+
['Section 1', ' Section 2 ']
758+
>>> custom = configparser.ConfigParser()
759+
>>> custom.SECTCRE = re.compile(r"\[ *(?P<header>[^]]+?) *\]")
760+
>>> custom.read_string(config)
761+
>>> custom.sections()
762+
['Section 1', 'Section 2']
742763

743-
.. doctest::
764+
.. note::
744765

745-
>>> import re
746-
>>> config = """
747-
... [Section 1]
748-
... option = value
749-
...
750-
... [ Section 2 ]
751-
... another = val
752-
... """
753-
>>> typical = configparser.ConfigParser()
754-
>>> typical.read_string(config)
755-
>>> typical.sections()
756-
['Section 1', ' Section 2 ']
757-
>>> custom = configparser.ConfigParser()
758-
>>> custom.SECTCRE = re.compile(r"\[ *(?P<header>[^]]+?) *\]")
759-
>>> custom.read_string(config)
760-
>>> custom.sections()
761-
['Section 1', 'Section 2']
762-
763-
.. note::
764-
765-
While ConfigParser objects also use an ``OPTCRE`` attribute for recognizing
766-
option lines, it's not recommended to override it because that would
767-
interfere with constructor options *allow_no_value* and *delimiters*.
766+
While ConfigParser objects also use an ``OPTCRE`` attribute for recognizing
767+
option lines, it's not recommended to override it because that would
768+
interfere with constructor options *allow_no_value* and *delimiters*.
768769

769770

770771
Legacy API Examples

Doc/library/difflib.rst

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
2424

2525

2626
.. class:: SequenceMatcher
27+
:noindex:
2728

2829
This is a flexible class for comparing pairs of sequences of any type, so long
2930
as the sequence elements are :term:`hashable`. The basic algorithm predates, and is a
@@ -651,6 +652,7 @@ The :class:`Differ` class has this constructor:
651652

652653

653654
.. class:: Differ(linejunk=None, charjunk=None)
655+
:noindex:
654656

655657
Optional keyword parameters *linejunk* and *charjunk* are for filter functions
656658
(or ``None``):

Doc/library/enum.rst

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ helper, :class:`auto`.
5050
the bitwise operations without losing their :class:`Flag` membership.
5151

5252
.. function:: unique
53+
:noindex:
5354

5455
Enum class decorator that ensures only one name is bound to any one value.
5556

Doc/library/socket.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,9 @@ to sockets.
16951695

16961696
.. method:: socket.setsockopt(level, optname, value: int)
16971697
.. method:: socket.setsockopt(level, optname, value: buffer)
1698+
:noindex:
16981699
.. method:: socket.setsockopt(level, optname, None, optlen: int)
1700+
:noindex:
16991701

17001702
.. index:: module: struct
17011703

Doc/library/tarfile.rst

+1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ Some facts and figures:
151151

152152

153153
.. class:: TarFile
154+
:noindex:
154155

155156
Class for reading and writing tar archives. Do not use this class directly:
156157
use :func:`tarfile.open` instead. See :ref:`tarfile-objects`.

Doc/library/token.rst

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ the :mod:`tokenize` module.
7070

7171

7272
.. data:: TYPE_COMMENT
73+
:noindex:
7374

7475
Token value indicating that a type comment was recognized. Such
7576
tokens are only produced when :func:`ast.parse()` is invoked with

Doc/library/turtle.rst

+3
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,7 @@ More drawing control
10691069
~~~~~~~~~~~~~~~~~~~~
10701070

10711071
.. function:: reset()
1072+
:noindex:
10721073

10731074
Delete the turtle's drawings from the screen, re-center the turtle and set
10741075
variables to the default values.
@@ -1090,6 +1091,7 @@ More drawing control
10901091

10911092

10921093
.. function:: clear()
1094+
:noindex:
10931095

10941096
Delete the turtle's drawings from the screen. Do not move turtle. State and
10951097
position of the turtle as well as drawings of other turtles are not affected.
@@ -1362,6 +1364,7 @@ Using events
13621364
------------
13631365

13641366
.. function:: onclick(fun, btn=1, add=None)
1367+
:noindex:
13651368

13661369
:param fun: a function with two arguments which will be called with the
13671370
coordinates of the clicked point on the canvas

Doc/library/urllib.request.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ tracking URIs for which authentication credentials should always be sent.
946946
If *is_authenticated* is specified as ``True``, *realm* is ignored.
947947

948948

949-
.. method:: HTTPPasswordMgr.find_user_password(realm, authuri)
949+
.. method:: HTTPPasswordMgrWithPriorAuth.find_user_password(realm, authuri)
950950

951951
Same as for :class:`HTTPPasswordMgrWithDefaultRealm` objects
952952

0 commit comments

Comments
 (0)