bpo-38738: Fix formatting of True and False. (GH-17083)
* "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>".
diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst
index 905862e..9a68491 100644
--- a/Doc/library/threading.rst
+++ b/Doc/library/threading.rst
@@ -543,15 +543,15 @@
There is no return value in this case.
When invoked with the *blocking* argument set to true, do the same thing as when
- called without arguments, and return true.
+ called without arguments, and return ``True``.
When invoked with the *blocking* argument set to false, do not block. If a call
- without an argument would block, return false immediately; otherwise, do the
- same thing as when called without arguments, and return true.
+ without an argument would block, return ``False`` immediately; otherwise, do the
+ same thing as when called without arguments, and return ``True``.
When invoked with the floating-point *timeout* argument set to a positive
value, block for at most the number of seconds specified by *timeout*
- and as long as the lock cannot be acquired. Return true if the lock has
+ and as long as the lock cannot be acquired. Return ``True`` if the lock has
been acquired, false if the timeout has elapsed.
.. versionchanged:: 3.2
@@ -784,20 +784,20 @@
When invoked without arguments:
* If the internal counter is larger than zero on entry, decrement it by
- one and return true immediately.
+ one and return ``True`` immediately.
* If the internal counter is zero on entry, block until awoken by a call to
:meth:`~Semaphore.release`. Once awoken (and the counter is greater
- than 0), decrement the counter by 1 and return true. Exactly one
+ than 0), decrement the counter by 1 and return ``True``. Exactly one
thread will be awoken by each call to :meth:`~Semaphore.release`. The
order in which threads are awoken should not be relied on.
When invoked with *blocking* set to false, do not block. If a call
- without an argument would block, return false immediately; otherwise, do
- the same thing as when called without arguments, and return true.
+ without an argument would block, return ``False`` immediately; otherwise, do
+ the same thing as when called without arguments, and return ``True``.
When invoked with a *timeout* other than ``None``, it will block for at
most *timeout* seconds. If acquire does not complete successfully in
- that interval, return false. Return true otherwise.
+ that interval, return ``False``. Return ``True`` otherwise.
.. versionchanged:: 3.2
The *timeout* parameter is new.
@@ -877,7 +877,7 @@
.. method:: is_set()
- Return true if and only if the internal flag is true.
+ Return ``True`` if and only if the internal flag is true.
.. method:: set()
@@ -901,7 +901,7 @@
floating point number specifying a timeout for the operation in seconds
(or fractions thereof).
- This method returns true if and only if the internal flag has been set to
+ This method returns ``True`` if and only if the internal flag has been set to
true, either before the wait call or after the wait starts, so it will
always return ``True`` except if a timeout is given and the operation
times out.