Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit00324a7

Browse files
[3.12]gh-101100: Fix various Sphinx warnings for dunder references in thelibrary/ directory (GH-113163) (#113183)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
1 parente3396b2 commit00324a7

File tree

8 files changed

+34
-24
lines changed

8 files changed

+34
-24
lines changed

‎Doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@
242242
# Attributes/methods/etc. that definitely should be documented better,
243243
# but are deferred for now:
244244
('py:attr','__annotations__'),
245+
('py:meth','__missing__'),
245246
('py:attr','__wrapped__'),
246247
('py:meth','index'),# list.index, tuple.index, etc.
247248
]

‎Doc/library/datetime.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1976,7 +1976,8 @@ Examples of working with a :class:`.time` object::
19761976
American EST and EDT.
19771977

19781978
Special requirement for pickling: A:class:`tzinfo` subclass must have an
1979-
:meth:`__init__` method that can be called with no arguments, otherwise it can be
1979+
:meth:`~object.__init__` method that can be called with no arguments,
1980+
otherwise it can be
19801981
pickled but possibly not unpickled again. This is a technical requirement that
19811982
may be relaxed in the future.
19821983

‎Doc/library/exceptions.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,9 +1005,9 @@ their subgroups based on the types of the contained exceptions.
10051005
True
10061006

10071007

1008-
Note that:exc:`BaseExceptionGroup` defines:meth:`__new__`, so
1008+
Note that:exc:`BaseExceptionGroup` defines:meth:`~object.__new__`, so
10091009
subclasses that need a different constructor signature need to
1010-
override that rather than:meth:`__init__`. For example, the following
1010+
override that rather than:meth:`~object.__init__`. For example, the following
10111011
defines an exception group subclass which accepts an exit_code and
10121012
and constructs the group's message from it. ::
10131013

‎Doc/library/test.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,8 @@ The :mod:`test.support.os_helper` module provides support for os tests.
14081408

14091409
..class::FakePath(path)
14101410

1411-
Simple:term:`path-like object`. It implements the:meth:`__fspath__`
1411+
Simple:term:`path-like object`. It implements the
1412+
:meth:`~os.PathLike.__fspath__`
14121413
method which just returns the *path* argument. If *path* is an exception,
14131414
it will be raised in:meth:`!__fspath__`.
14141415

‎Doc/library/unittest.mock.rst

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -820,8 +820,9 @@ apply to method calls on the mock object.
820820

821821
..class::PropertyMock(*args, **kwargs)
822822

823-
A mock intended to be used as a property, or other descriptor, on a class.
824-
:class:`PropertyMock` provides:meth:`__get__` and:meth:`__set__` methods
823+
A mock intended to be used as a:class:`property`, or other
824+
:term:`descriptor`, on a class.:class:`PropertyMock` provides
825+
:meth:`~object.__get__` and:meth:`~object.__set__` methods
825826
so you can specify a return value when it is fetched.
826827

827828
Fetching a:class:`PropertyMock` instance from an object calls the mock, with
@@ -1658,8 +1659,9 @@ Keywords can be used in the :func:`patch.dict` call to set values in the diction
16581659
:func:`patch.dict` can be used with dictionary like objects that aren't actually
16591660
dictionaries. At the very minimum they must support item getting, setting,
16601661
deleting and either iteration or membership test. This corresponds to the
1661-
magic methods:meth:`~object.__getitem__`,:meth:`__setitem__`,:meth:`__delitem__` and either
1662-
:meth:`__iter__` or:meth:`__contains__`.
1662+
magic methods:meth:`~object.__getitem__`,:meth:`~object.__setitem__`,
1663+
:meth:`~object.__delitem__` and either:meth:`~container.__iter__` or
1664+
:meth:`~object.__contains__`.
16631665

16641666
>>>classContainer:
16651667
...def__init__(self):
@@ -2122,7 +2124,7 @@ For example:
21222124
>>>object()in mock
21232125
False
21242126

2125-
The two equality methods,:meth:`__eq__` and:meth:`__ne__`, are special.
2127+
The two equality methods,:meth:`!__eq__` and:meth:`!__ne__`, are special.
21262128
They do the default equality comparison on identity, using the
21272129
:attr:`~Mock.side_effect` attribute, unless you change their return value to
21282130
return something else::
@@ -2472,8 +2474,8 @@ mock_open
24722474
*read_data* is now reset on each call to the *mock*.
24732475

24742476
..versionchanged::3.8
2475-
Added:meth:`__iter__` to implementation so that iteration (such as in for
2476-
loops) correctly consumes *read_data*.
2477+
Added:meth:`~container.__iter__` to implementation so that iteration
2478+
(such as in forloops) correctly consumes *read_data*.
24772479

24782480
Using:func:`open` as a context manager is a great way to ensure your file handles
24792481
are closed properly and is becoming common::
@@ -2655,7 +2657,7 @@ able to use autospec. On the other hand it is much better to design your
26552657
objects so that introspection is safe [#]_.
26562658

26572659
A more serious problem is that it is common for instance attributes to be
2658-
created in the:meth:`__init__` method and not to exist on the class at all.
2660+
created in the:meth:`~object.__init__` method and not to exist on the class at all.
26592661
*autospec* can't know about any dynamically created attributes and restricts
26602662
the api to visible attributes. ::
26612663

@@ -2696,8 +2698,9 @@ this particular scenario:
26962698
AttributeError: Mock object has no attribute 'a'
26972699

26982700
Probably the best way of solving the problem is to add class attributes as
2699-
default values for instance members initialised in:meth:`__init__`. Note that if
2700-
you are only setting default attributes in:meth:`__init__` then providing them via
2701+
default values for instance members initialised in:meth:`~object.__init__`.
2702+
Note that if
2703+
you are only setting default attributes in:meth:`!__init__` then providing them via
27012704
class attributes (shared between instances of course) is faster too. e.g.
27022705

27032706
..code-block::python

‎Doc/library/unittest.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@ Grouping tests
17251725
..method::__iter__()
17261726

17271727
Tests grouped by a:class:`TestSuite` are always accessed by iteration.
1728-
Subclasses can lazily provide tests by overriding:meth:`__iter__`. Note
1728+
Subclasses can lazily provide tests by overriding:meth:`!__iter__`. Note
17291729
that this method may be called several times on a single suite (for
17301730
example when counting tests or comparing for equality) so the tests
17311731
returned by repeated iterations before:meth:`TestSuite.run` must be the
@@ -1736,7 +1736,7 @@ Grouping tests
17361736

17371737
..versionchanged::3.2
17381738
In earlier versions the:class:`TestSuite` accessed tests directly rather
1739-
than through iteration, so overriding:meth:`__iter__` wasn't sufficient
1739+
than through iteration, so overriding:meth:`!__iter__` wasn't sufficient
17401740
for providing tests.
17411741

17421742
..versionchanged::3.4

‎Doc/library/wsgiref.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,9 @@ manipulation of WSGI response headers using a mapping-like interface.
201201
an empty list.
202202

203203
:class:`Headers` objects support typical mapping operations including
204-
:meth:`~object.__getitem__`,:meth:`get`,:meth:`__setitem__`,:meth:`setdefault`,
205-
:meth:`__delitem__` and:meth:`__contains__`. For each of
204+
:meth:`~object.__getitem__`,:meth:`~dict.get`,:meth:`~object.__setitem__`,
205+
:meth:`~dict.setdefault`,
206+
:meth:`~object.__delitem__` and:meth:`~object.__contains__`. For each of
206207
these methods, the key is the header name (treated case-insensitively), and the
207208
value is the first value associated with that header name. Setting a header
208209
deletes any existing values for that header, then adds a new value at the end of
@@ -520,8 +521,10 @@ input, output, and error streams.
520521
want to subclass this instead of:class:`BaseCGIHandler`.
521522

522523
This class is a subclass of:class:`BaseHandler`. It overrides the
523-
:meth:`__init__`,:meth:`get_stdin`,:meth:`get_stderr`,:meth:`add_cgi_vars`,
524-
:meth:`_write`, and:meth:`_flush` methods to support explicitly setting the
524+
:meth:`!__init__`,:meth:`~BaseHandler.get_stdin`,
525+
:meth:`~BaseHandler.get_stderr`,:meth:`~BaseHandler.add_cgi_vars`,
526+
:meth:`~BaseHandler._write`, and:meth:`~BaseHandler._flush` methods to
527+
support explicitly setting the
525528
environment and streams via the constructor. The supplied environment and
526529
streams are stored in the:attr:`stdin`,:attr:`stdout`,:attr:`stderr`, and
527530
:attr:`environ` attributes.

‎Doc/library/xmlrpc.client.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,9 @@ DateTime Objects
269269
Write the XML-RPC encoding of this:class:`DateTime` item to the *out* stream
270270
object.
271271

272-
It also supports certain of Python's built-in operators through rich comparison
273-
and:meth:`__repr__` methods.
272+
It also supports certain of Python's built-in operators through
273+
:meth:`rich comparison <object.__lt__>` and:meth:`~object.__repr__`
274+
methods.
274275

275276
A working example follows. The server code::
276277

@@ -334,8 +335,8 @@ Binary Objects
334335
which was the de facto standard base64 specification when the
335336
XML-RPC spec was written.
336337

337-
It also supports certain of Python's built-in operators through:meth:`__eq__`
338-
and:meth:`__ne__` methods.
338+
It also supports certain of Python's built-in operators through
339+
:meth:`~object.__eq__`and:meth:`~object.__ne__` methods.
339340

340341
Example usage of the binary objects. We're going to transfer an image over
341342
XMLRPC::

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp