mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
gh-95454: Replace truthy/falsy with true/false (GH-95456)
This commit is contained in:
parent
0956b6d9c4
commit
cd26595232
8 changed files with 15 additions and 13 deletions
|
@ -672,7 +672,7 @@ empty string, all events are passed.
|
||||||
|
|
||||||
.. method:: filter(record)
|
.. method:: filter(record)
|
||||||
|
|
||||||
Is the specified record to be logged? Returns falsy for no, truthy for
|
Is the specified record to be logged? Returns false for no, true for
|
||||||
yes. Filters can either modify log records in-place or return a completely
|
yes. Filters can either modify log records in-place or return a completely
|
||||||
different record instance which will replace the original
|
different record instance which will replace the original
|
||||||
log record in any future processing of the event.
|
log record in any future processing of the event.
|
||||||
|
|
|
@ -833,17 +833,17 @@ class Filterer(object):
|
||||||
Determine if a record is loggable by consulting all the filters.
|
Determine if a record is loggable by consulting all the filters.
|
||||||
|
|
||||||
The default is to allow the record to be logged; any filter can veto
|
The default is to allow the record to be logged; any filter can veto
|
||||||
this by returning a falsy value.
|
this by returning a false value.
|
||||||
If a filter attached to a handler returns a log record instance,
|
If a filter attached to a handler returns a log record instance,
|
||||||
then that instance is used in place of the original log record in
|
then that instance is used in place of the original log record in
|
||||||
any further processing of the event by that handler.
|
any further processing of the event by that handler.
|
||||||
If a filter returns any other truthy value, the original log record
|
If a filter returns any other true value, the original log record
|
||||||
is used in any further processing of the event by that handler.
|
is used in any further processing of the event by that handler.
|
||||||
|
|
||||||
If none of the filters return falsy values, this method returns
|
If none of the filters return false values, this method returns
|
||||||
a log record.
|
a log record.
|
||||||
If any of the filters return a falsy value, this method returns
|
If any of the filters return a false value, this method returns
|
||||||
a falsy value.
|
a false value.
|
||||||
|
|
||||||
.. versionchanged:: 3.2
|
.. versionchanged:: 3.2
|
||||||
|
|
||||||
|
@ -1017,7 +1017,7 @@ class Handler(Filterer):
|
||||||
the I/O thread lock.
|
the I/O thread lock.
|
||||||
|
|
||||||
Returns an instance of the log record that was emitted
|
Returns an instance of the log record that was emitted
|
||||||
if it passed all filters, otherwise a falsy value is returned.
|
if it passed all filters, otherwise a false value is returned.
|
||||||
"""
|
"""
|
||||||
rv = self.filter(record)
|
rv = self.filter(record)
|
||||||
if isinstance(rv, LogRecord):
|
if isinstance(rv, LogRecord):
|
||||||
|
|
|
@ -449,8 +449,8 @@ class Test_TextTestResult(unittest.TestCase):
|
||||||
'(' + __name__ + '.Test_TextTestResult.testGetSubTestDescriptionWithoutDocstringAndParams) '
|
'(' + __name__ + '.Test_TextTestResult.testGetSubTestDescriptionWithoutDocstringAndParams) '
|
||||||
'(<subtest>)')
|
'(<subtest>)')
|
||||||
|
|
||||||
def testGetSubTestDescriptionForFalsyValues(self):
|
def testGetSubTestDescriptionForFalseValues(self):
|
||||||
expected = 'testGetSubTestDescriptionForFalsyValues (%s.Test_TextTestResult.testGetSubTestDescriptionForFalsyValues) [%s]'
|
expected = 'testGetSubTestDescriptionForFalseValues (%s.Test_TextTestResult.testGetSubTestDescriptionForFalseValues) [%s]'
|
||||||
result = unittest.TextTestResult(None, True, 1)
|
result = unittest.TextTestResult(None, True, 1)
|
||||||
for arg in [0, None, []]:
|
for arg in [0, None, []]:
|
||||||
with self.subTest(arg):
|
with self.subTest(arg):
|
||||||
|
|
|
@ -900,7 +900,7 @@ Kurenkov.
|
||||||
.. nonce: QhQ9RD
|
.. nonce: QhQ9RD
|
||||||
.. section: Library
|
.. section: Library
|
||||||
|
|
||||||
Fixed functools.singledispatch on classes with falsy metaclasses. Patch by
|
Fixed functools.singledispatch on classes with false metaclasses. Patch by
|
||||||
Ethan Furman.
|
Ethan Furman.
|
||||||
|
|
||||||
..
|
..
|
||||||
|
|
|
@ -832,7 +832,7 @@ In the traceback module, restore the formatting of exception messages like
|
||||||
.. nonce: 3UhyPo
|
.. nonce: 3UhyPo
|
||||||
.. section: Library
|
.. section: Library
|
||||||
|
|
||||||
Allow falsy values to be used for msg parameter of subTest().
|
Allow false values to be used for msg parameter of subTest().
|
||||||
|
|
||||||
..
|
..
|
||||||
|
|
||||||
|
|
|
@ -460,7 +460,7 @@ In the traceback module, restore the formatting of exception messages like
|
||||||
.. nonce: 3UhyPo
|
.. nonce: 3UhyPo
|
||||||
.. section: Library
|
.. section: Library
|
||||||
|
|
||||||
Allow falsy values to be used for msg parameter of subTest().
|
Allow false values to be used for msg parameter of subTest().
|
||||||
|
|
||||||
..
|
..
|
||||||
|
|
||||||
|
|
|
@ -4453,7 +4453,7 @@ In the traceback module, restore the formatting of exception messages like
|
||||||
.. nonce: 3UhyPo
|
.. nonce: 3UhyPo
|
||||||
.. section: Library
|
.. section: Library
|
||||||
|
|
||||||
Allow falsy values to be used for msg parameter of subTest().
|
Allow false values to be used for msg parameter of subTest().
|
||||||
|
|
||||||
..
|
..
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Replaced incorrectly written true/false values
|
||||||
|
in documentiation. Patch by Robert O'Shea
|
Loading…
Add table
Add a link
Reference in a new issue