Skip to content

Commit 530c3bb

Browse files
[3.12] Format None, True, False and NotImplemented as literals (GH-118758) (GH-118794)
(cherry picked from commit 05c2fe1)
1 parent b83b3cb commit 530c3bb

33 files changed

+76
-75
lines changed

Doc/c-api/object.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Object Protocol
1616
1717
Properly handle returning :c:data:`Py_NotImplemented` from within a C
1818
function (that is, create a new :term:`strong reference`
19-
to NotImplemented and return it).
19+
to :const:`NotImplemented` and return it).
2020

2121

2222
.. c:macro:: Py_PRINT_RAW

Doc/library/_thread.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,14 @@ Lock objects have the following methods:
166166
time can acquire a lock --- that's their reason for existence).
167167

168168
If the *blocking* argument is present, the action depends on its
169-
value: if it is False, the lock is only acquired if it can be acquired
170-
immediately without waiting, while if it is True, the lock is acquired
169+
value: if it is false, the lock is only acquired if it can be acquired
170+
immediately without waiting, while if it is true, the lock is acquired
171171
unconditionally as above.
172172

173173
If the floating-point *timeout* argument is present and positive, it
174174
specifies the maximum wait time in seconds before returning. A negative
175175
*timeout* argument specifies an unbounded wait. You cannot specify
176-
a *timeout* if *blocking* is False.
176+
a *timeout* if *blocking* is false.
177177

178178
The return value is ``True`` if the lock is acquired successfully,
179179
``False`` if not.

Doc/library/asyncio-task.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ Running Tasks Concurrently
507507
# [2, 6, 24]
508508

509509
.. note::
510-
If *return_exceptions* is False, cancelling gather() after it
510+
If *return_exceptions* is false, cancelling gather() after it
511511
has been marked done won't cancel any submitted awaitables.
512512
For instance, gather can be marked done after propagating an
513513
exception to the caller, therefore, calling ``gather.cancel()``

Doc/library/bdb.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ The :mod:`bdb` module also defines two classes:
8686

8787
.. attribute:: temporary
8888

89-
True if a :class:`Breakpoint` at (file, line) is temporary.
89+
``True`` if a :class:`Breakpoint` at (file, line) is temporary.
9090

9191
.. attribute:: cond
9292

@@ -99,7 +99,7 @@ The :mod:`bdb` module also defines two classes:
9999

100100
.. attribute:: enabled
101101

102-
True if :class:`Breakpoint` is enabled.
102+
``True`` if :class:`Breakpoint` is enabled.
103103

104104
.. attribute:: bpbynumber
105105

@@ -215,22 +215,22 @@ The :mod:`bdb` module also defines two classes:
215215

216216
.. method:: is_skipped_line(module_name)
217217

218-
Return True if *module_name* matches any skip pattern.
218+
Return ``True`` if *module_name* matches any skip pattern.
219219

220220
.. method:: stop_here(frame)
221221

222-
Return True if *frame* is below the starting frame in the stack.
222+
Return ``True`` if *frame* is below the starting frame in the stack.
223223

224224
.. method:: break_here(frame)
225225

226-
Return True if there is an effective breakpoint for this line.
226+
Return ``True`` if there is an effective breakpoint for this line.
227227

228228
Check whether a line or function breakpoint exists and is in effect. Delete temporary
229229
breakpoints based on information from :func:`effective`.
230230

231231
.. method:: break_anywhere(frame)
232232

233-
Return True if any breakpoint exists for *frame*'s filename.
233+
Return ``True`` if any breakpoint exists for *frame*'s filename.
234234

235235
Derived classes should override these methods to gain control over debugger
236236
operation.
@@ -344,7 +344,7 @@ The :mod:`bdb` module also defines two classes:
344344

345345
.. method:: get_break(filename, lineno)
346346

347-
Return True if there is a breakpoint for *lineno* in *filename*.
347+
Return ``True`` if there is a breakpoint for *lineno* in *filename*.
348348

349349
.. method:: get_breaks(filename, lineno)
350350

@@ -408,7 +408,7 @@ Finally, the module defines the following functions:
408408

409409
.. function:: checkfuncname(b, frame)
410410

411-
Return True if we should break here, depending on the way the
411+
Return ``True`` if we should break here, depending on the way the
412412
:class:`Breakpoint` *b* was set.
413413

414414
If it was set via line number, it checks if
@@ -427,14 +427,14 @@ Finally, the module defines the following functions:
427427
:attr:`bplist <bdb.Breakpoint.bplist>` for the
428428
(:attr:`file <bdb.Breakpoint.file>`, :attr:`line <bdb.Breakpoint.line>`)
429429
(which must exist) that is :attr:`enabled <bdb.Breakpoint.enabled>`, for
430-
which :func:`checkfuncname` is True, and that has neither a False
430+
which :func:`checkfuncname` is true, and that has neither a false
431431
:attr:`condition <bdb.Breakpoint.cond>` nor positive
432432
:attr:`ignore <bdb.Breakpoint.ignore>` count. The *flag*, meaning that a
433-
temporary breakpoint should be deleted, is False only when the
433+
temporary breakpoint should be deleted, is ``False`` only when the
434434
:attr:`cond <bdb.Breakpoint.cond>` cannot be evaluated (in which case,
435435
:attr:`ignore <bdb.Breakpoint.ignore>` count is ignored).
436436

437-
If no such entry exists, then (None, None) is returned.
437+
If no such entry exists, then ``(None, None)`` is returned.
438438

439439

440440
.. function:: set_trace()

Doc/library/compileall.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ Public functions
226226
The *invalidation_mode* parameter was added.
227227

228228
.. versionchanged:: 3.7.2
229-
The *invalidation_mode* parameter's default value is updated to None.
229+
The *invalidation_mode* parameter's default value is updated to ``None``.
230230

231231
.. versionchanged:: 3.8
232232
Setting *workers* to 0 now chooses the optimal number of cores.
@@ -289,7 +289,7 @@ Public functions
289289
The *invalidation_mode* parameter was added.
290290

291291
.. versionchanged:: 3.7.2
292-
The *invalidation_mode* parameter's default value is updated to None.
292+
The *invalidation_mode* parameter's default value is updated to ``None``.
293293

294294
.. versionchanged:: 3.9
295295
Added *stripdir*, *prependdir*, *limit_sl_dest* and *hardlink_dupes* arguments.
@@ -318,7 +318,7 @@ Public functions
318318
The *invalidation_mode* parameter was added.
319319

320320
.. versionchanged:: 3.7.2
321-
The *invalidation_mode* parameter's default value is updated to None.
321+
The *invalidation_mode* parameter's default value is updated to ``None``.
322322

323323
To force a recompile of all the :file:`.py` files in the :file:`Lib/`
324324
subdirectory and all its subdirectories::

Doc/library/csv.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ The :mod:`csv` module defines the following constants:
349349
``None``. This is similar to :data:`QUOTE_ALL`, except that if a
350350
field value is ``None`` an empty (unquoted) string is written.
351351

352-
Instructs :class:`reader` objects to interpret an empty (unquoted) field as None and
353-
to otherwise behave as :data:`QUOTE_ALL`.
352+
Instructs :class:`reader` objects to interpret an empty (unquoted) field
353+
as ``None`` and to otherwise behave as :data:`QUOTE_ALL`.
354354

355355
.. versionadded:: 3.12
356356

Doc/library/dataclasses.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ Module contents
278278
generated equality and comparison methods (:meth:`~object.__eq__`,
279279
:meth:`~object.__gt__`, et al.).
280280

281-
- *metadata*: This can be a mapping or None. None is treated as
281+
- *metadata*: This can be a mapping or ``None``. ``None`` is treated as
282282
an empty dict. This value is wrapped in
283283
:func:`~types.MappingProxyType` to make it read-only, and exposed
284284
on the :class:`Field` object. It is not used at all by Data

Doc/library/functools.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ The :mod:`functools` module defines the following functions:
325325
.. versionadded:: 3.2
326326

327327
.. versionchanged:: 3.4
328-
Returning NotImplemented from the underlying comparison function for
328+
Returning ``NotImplemented`` from the underlying comparison function for
329329
unrecognised types is now supported.
330330

331331
.. function:: partial(func, /, *args, **keywords)

Doc/library/gc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The :mod:`gc` module provides the following functions:
6969
.. function:: get_objects(generation=None)
7070

7171
Returns a list of all objects tracked by the collector, excluding the list
72-
returned. If *generation* is not None, return only the objects tracked by
72+
returned. If *generation* is not ``None``, return only the objects tracked by
7373
the collector that are in that generation.
7474

7575
.. versionchanged:: 3.8

Doc/library/imaplib.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ base class:
3939
initialized. If *host* is not specified, ``''`` (the local host) is used. If
4040
*port* is omitted, the standard IMAP4 port (143) is used. The optional *timeout*
4141
parameter specifies a timeout in seconds for the connection attempt.
42-
If timeout is not given or is None, the global default socket timeout is used.
42+
If timeout is not given or is ``None``, the global default socket timeout is used.
4343

4444
The :class:`IMAP4` class supports the :keyword:`with` statement. When used
4545
like this, the IMAP4 ``LOGOUT`` command is issued automatically when the
@@ -97,7 +97,7 @@ There's also a subclass for secure connections:
9797
best practices.
9898

9999
The optional *timeout* parameter specifies a timeout in seconds for the
100-
connection attempt. If timeout is not given or is None, the global default
100+
connection attempt. If timeout is not given or is ``None``, the global default
101101
socket timeout is used.
102102

103103
.. versionchanged:: 3.3
@@ -360,7 +360,7 @@ An :class:`IMAP4` instance has the following methods:
360360

361361
Opens socket to *port* at *host*. The optional *timeout* parameter
362362
specifies a timeout in seconds for the connection attempt.
363-
If timeout is not given or is None, the global default socket timeout
363+
If timeout is not given or is ``None``, the global default socket timeout
364364
is used. Also note that if the *timeout* parameter is set to be zero,
365365
it will raise a :class:`ValueError` to reject creating a non-blocking socket.
366366
This method is implicitly called by the :class:`IMAP4` constructor.

0 commit comments

Comments
 (0)