8000 [3.8] bpo-38738: Fix formatting of True and False. (GH-17083) (GH-17125) · python/cpython@d360346 · GitHub
[go: up one dir, main page]

Skip to content

Commit d360346

Browse files
[3.8] bpo-38738: Fix formatting of True and False. (GH-17083) (GH-17125)
* "Return true/false" is replaced with "Return ``True``/``False``" if the function actually returns a bool. * Fixed formatting of some True and False literals (now in monospace). * Replaced "True/False" with "true/false" if it can be not only bool. * Replaced some 1/0 with True/False if it corresponds the code. * "Returns <bool>" is replaced with "Return <bool>". (cherry picked from commit 138ccbb)
1 parent 29fd6a7 commit d360346

40 files changed

+172
-172
lines changed

Doc/library/asyncio-stream.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ StreamWriter
263263

264264
.. method:: can_write_eof()
265265

266-
Return *True* if the underlying transport supports
267-
the :meth:`write_eof` method, *False* otherwise.
266+
Return ``True`` if the underlying transport supports
267+
the :meth:`write_eof` method, ``False`` otherwise.
268268

269269
.. method:: write_eof()
270270

Doc/library/dataclasses.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Module-level decorators, classes, and functions
153153
method of the superclass will be used (if the superclass is
154154
:class:`object`, this means it will fall back to id-based hashing).
155155

156-
- ``frozen``: If true (the default is False), assigning to fields will
156+
- ``frozen``: If true (the default is ``False``), assigning to fields will
157157
generate an exception. This emulates read-only frozen instances. If
158158
:meth:`__setattr__` or :meth:`__delattr__` is defined in the class, then
159159
:exc:`TypeError` is raised. See the discussion below.
@@ -386,8 +386,8 @@ Module-level decorators, classes, and functions
386386

387387
.. function:: is_dataclass(class_or_instance)
388388

389-
Returns True if its parameter is a dataclass or an instance of one,
390-
otherwise returns False.
389+
Return ``True`` if its parameter is a dataclass or an instance of one,
390+
otherwise return ``False``.
391391

392392
If you need to know if a class is an instance of a dataclass (and
393393
not a dataclass itself), then add a further check for ``not

Doc/library/difflib.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,14 +338,14 @@ diffs. For comparing directories and files, see also, the :mod:`filecmp` module.
338338

339339
.. function:: IS_LINE_JUNK(line)
340340

341-
Return true for ignorable lines. The line *line* is ignorable if *line* is
341+
Return ``True`` for ignorable lines. The line *line* is ignorable if *line* is
342342
blank or contains a single ``'#'``, otherwise it is not ignorable. Used as a
343343
default for parameter *linejunk* in :func:`ndiff` in older versions.
344344

345345

346346
.. function:: IS_CHARACTER_JUNK(ch)
347347

348-
Return true for ignorable characters. The character *ch* is ignorable if *ch*
348+
Return ``True`` for ignorable characters. The character *ch* is ignorable if *ch*
349349
is a space or tab, otherwise it is not ignorable. Used as a default for
350350
parameter *charjunk* in :func:`ndiff`.
351351

@@ -370,7 +370,7 @@ The :class:`SequenceMatcher` class has this constructor:
370370
Optional argument *isjunk* must be ``None`` (the default) or a one-argument
371371
function that takes a sequence element and returns true if and only if the
372372
element is "junk" and should be ignored. Passing ``None`` for *isjunk* is
373-
equivalent to passing ``lambda x: 0``; in other words, no elements are ignored.
373+
equivalent to passing ``lambda x: False``; in other words, no elements are ignored.
374374
For example, pass::
375375

376376
lambda x: x in " \t"

Doc/library/doctest.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,7 @@ OutputChecker objects
15291529

15301530
A class used to check the whether the actual output from a doctest example
15311531
matches the expected output. :class:`OutputChecker` defines two methods:
1532-
:meth:`check_output`, which compares a given pair of outputs, and returns true
1532+
:meth:`check_output`, which compares a given pair of outputs, and returns ``True``
15331533
if they match; and :meth:`output_difference`, which returns a string describing
15341534
the differences between two outputs.
15351535

Doc/library/email.compat32-message.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ Here are the methods of the :class:`Message` class:
308308

309309
.. method:: __contains__(name)
310310

311-
Return true if the message object has a field named *name*. Matching is
311+
Return ``True`` if the message object has a field named *name*. Matching is
312312
done case-insensitively and *name* should not include the trailing colon.
313313
Used for the ``in`` operator, e.g.::
314314

Doc/library/email.errors.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ All defect classes are subclassed from :class:`email.errors.MessageDefect`.
9999
* :class:`MultipartInvariantViolationDefect` -- A message claimed to be a
100100
:mimetype:`multipart`, but no subparts were found. Note that when a message
101101
has this defect, its :meth:`~email.message.Message.is_multipart` method may
102-
return false even though its content type claims to be :mimetype:`multipart`.
102+
return ``False`` even though its content type claims to be :mimetype:`multipart`.
103103

104104
* :class:`InvalidBase64PaddingDefect` -- When decoding a block of base64
105105
encoded bytes, the padding was not correct. Enough padding is added to

Doc/library/email.message.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ message objects.
178178

179179
.. method:: __contains__(name)
180180

181-
Return true if the message object has a field named *name*. Matching is
181+
Return ``True`` if the message object has a field named *name*. Matching is
182182
done without regard to case and *name* does not include the trailing
183183
colon. Used for the ``in`` operator. For example::
184184

Doc/library/fileinput.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ if there is no active state, :exc:`RuntimeError` is raised.
109109

110110
.. function:: isfirstline()
111111

112-
Returns true if the line just read is the first line of its file, otherwise
113-
returns false.
112+
Return ``True`` if the line just read is the first line of its file, otherwise
113+
return ``False``.
114114

115115

116116
.. function:: isstdin()
117117

118-
Returns true if the last line was read from ``sys.stdin``, otherwise returns
119-
false.
118+
Return ``True`` if the last line was read from ``sys.stdin``, otherwise return
119+
``False``.
120120

121121

122122
.. function:: nextfile()

Doc/library/functions.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ are always available. They are listed here in alphabetical order.
181181
.. function:: callable(object)
182182

183183
Return :const:`True` if the *object* argument appears callable,
184-
:const:`False` if not. If this returns true, it is still possible that a
185-
call fails, but if it is false, calling *object* will never succeed.
184+
:const:`False` if not. If this returns ``True``, it is still possible that a
185+
call fails, but if it is ``False``, calling *object* will never succeed.
186186
Note that classes are callable (calling a class returns a new instance);
187187
instances are callable if their class has a :meth:`__call__` method.
188188

@@ -838,19 +838,19 @@ are always available. They are listed here in alphabetical order.
838838

839839
.. function:: isinstance(object, classinfo)
840840

841-
Return true if the *object* argument is an instance of the *classinfo*
841+
Return ``True`` if the *object* argument is an instance of the *classinfo*
842842
argument, or of a (direct, indirect or :term:`virtual <abstract base
843843
class>`) subclass thereof. If *object* is not
844-
an object of the given type, the function always returns false.
844+
an object of the given type, the function always returns ``False``.
845845
If *classinfo* is a tuple of type objects (or recursively, other such
846-
tuples), return true if *object* is an instance of any of the types.
846+
tuples), return ``True`` if *object* is an instance of any of the types.
847847
If *classinfo* is not a type or tuple of types and such tuples,
848848
a :exc:`TypeError` exception is raised.
849849

850850

851851
.. function:: issubclass(class, classinfo)
852852

853-
Return true if *class* is a subclass (direct, indirect or :term:`virtual
853+
Return ``True`` if *class* is a subclass (direct, indirect or :term:`virtual
854854
<abstract base class>`) of *classinfo*. A
855855
class is considered a subclass of itself. *classinfo* may be a tuple of class
856856
objects, in which case every entry in *classinfo* will be checked. In any other

Doc/library/gc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The :mod:`gc` module provides the following functions:
3535

3636
.. function:: isenabled()
3737

38-
Returns true if automatic collection is enabled.
38+
Return ``True`` if automatic collection is enabled.
3939

4040

4141
.. function:: collect(generation=2)

0 commit comments

Comments
 (0)
0