gh-101100: Sphinx warnings: pick the low hanging fruits (GH-107386)

This commit is contained in:
Serhiy Storchaka 2023-07-29 08:48:10 +03:00 committed by GitHub
parent 413ba8943e
commit f2d07d3289
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 125 additions and 139 deletions

View file

@ -1594,9 +1594,9 @@ Basic customization
Called to implement truth value testing and the built-in operation
``bool()``; should return ``False`` or ``True``. When this method is not
defined, :meth:`__len__` is called, if it is defined, and the object is
defined, :meth:`~object.__len__` is called, if it is defined, and the object is
considered true if its result is nonzero. If a class defines neither
:meth:`__len__` nor :meth:`__bool__`, all its instances are considered
:meth:`!__len__` nor :meth:`!__bool__`, all its instances are considered
true.
@ -2494,7 +2494,7 @@ through the object's keys; for sequences, it should iterate through the values.
Called to implement the built-in function :func:`len`. Should return the length
of the object, an integer ``>=`` 0. Also, an object that doesn't define a
:meth:`__bool__` method and whose :meth:`__len__` method returns zero is
:meth:`~object.__bool__` method and whose :meth:`!__len__` method returns zero is
considered to be false in a Boolean context.
.. impl-detail::
@ -2503,7 +2503,7 @@ through the object's keys; for sequences, it should iterate through the values.
If the length is larger than :data:`!sys.maxsize` some features (such as
:func:`len`) may raise :exc:`OverflowError`. To prevent raising
:exc:`!OverflowError` by truth value testing, an object must define a
:meth:`__bool__` method.
:meth:`~object.__bool__` method.
.. method:: object.__length_hint__(self)

View file

@ -1724,7 +1724,7 @@ control flow statements, the following values are interpreted as false:
``False``, ``None``, numeric zero of all types, and empty strings and containers
(including strings, tuples, lists, dictionaries, sets and frozensets). All
other values are interpreted as true. User-defined objects can customize their
truth value by providing a :meth:`__bool__` method.
truth value by providing a :meth:`~object.__bool__` method.
.. index:: pair: operator; not

View file

@ -787,7 +787,7 @@ is converted before formatting. Conversion ``'!s'`` calls :func:`str` on
the result, ``'!r'`` calls :func:`repr`, and ``'!a'`` calls :func:`ascii`.
The result is then formatted using the :func:`format` protocol. The
format specifier is passed to the :meth:`__format__` method of the
format specifier is passed to the :meth:`~object.__format__` method of the
expression or conversion result. An empty string is passed when the
format specifier is omitted. The formatted result is then included in
the final value of the whole string.