Skip to content

Commit cd26595

Browse files
authored
gh-95454: Replace truthy/falsy with true/false (GH-95456)
1 parent 0956b6d commit cd26595

File tree

8 files changed

+15
-13
lines changed

8 files changed

+15
-13
lines changed

Doc/library/logging.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ empty string, all events are passed.
672672

673673
.. method:: filter(record)
674674

675-
Is the specified record to be logged? Returns falsy for no, truthy for
675+
Is the specified record to be logged? Returns false for no, true for
676676
yes. Filters can either modify log records in-place or return a completely
677677
different record instance which will replace the original
678678
log record in any future processing of the event.

Lib/logging/__init__.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -833,17 +833,17 @@ def filter(self, record):
833833
Determine if a record is loggable by consulting all the filters.
834834
835835
The default is to allow the record to be logged; any filter can veto
836-
this by returning a falsy value.
836+
this by returning a false value.
837837
If a filter attached to a handler returns a log record instance,
838838
then that instance is used in place of the original log record in
839839
any further processing of the event by that handler.
840-
If a filter returns any other truthy value, the original log record
840+
If a filter returns any other true value, the original log record
841841
is used in any further processing of the event by that handler.
842842
843-
If none of the filters return falsy values, this method returns
843+
If none of the filters return false values, this method returns
844844
a log record.
845-
If any of the filters return a falsy value, this method returns
846-
a falsy value.
845+
If any of the filters return a false value, this method returns
846+
a false value.
847847
848848
.. versionchanged:: 3.2
849849
@@ -1017,7 +1017,7 @@ def handle(self, record):
10171017
the I/O thread lock.
10181018
10191019
Returns an instance of the log record that was emitted
1020-
if it passed all filters, otherwise a falsy value is returned.
1020+
if it passed all filters, otherwise a false value is returned.
10211021
"""
10221022
rv = self.filter(record)
10231023
if isinstance(rv, LogRecord):

Lib/test/test_unittest/test_result.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,8 @@ def testGetSubTestDescriptionWithoutDocstringAndParams(self):
449449
'(' + __name__ + '.Test_TextTestResult.testGetSubTestDescriptionWithoutDocstringAndParams) '
450450
'(<subtest>)')
451451

452-
def testGetSubTestDescriptionForFalsyValues(self):
453-
expected = 'testGetSubTestDescriptionForFalsyValues (%s.Test_TextTestResult.testGetSubTestDescriptionForFalsyValues) [%s]'
452+
def testGetSubTestDescriptionForFalseValues(self):
453+
expected = 'testGetSubTestDescriptionForFalseValues (%s.Test_TextTestResult.testGetSubTestDescriptionForFalseValues) [%s]'
454454
result = unittest.TextTestResult(None, True, 1)
455455
for arg in [0, None, []]:
456456
with self.subTest(arg):

Misc/NEWS.d/3.5.1rc1.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ Kurenkov.
900900
.. nonce: QhQ9RD
901901
.. section: Library
902902
903-
Fixed functools.singledispatch on classes with falsy metaclasses. Patch by
903+
Fixed functools.singledispatch on classes with false metaclasses. Patch by
904904
Ethan Furman.
905905

906906
..

Misc/NEWS.d/3.5.3rc1.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ In the traceback module, restore the formatting of exception messages like
832832
.. nonce: 3UhyPo
833833
.. section: Library
834834
835-
Allow falsy values to be used for msg parameter of subTest().
835+
Allow false values to be used for msg parameter of subTest().
836836

837837
..
838838

Misc/NEWS.d/3.6.0b2.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ In the traceback module, restore the formatting of exception messages like
460460
.. nonce: 3UhyPo
461461
.. section: Library
462462
463-
Allow falsy values to be used for msg parameter of subTest().
463+
Allow false values to be used for msg parameter of subTest().
464464

465465
..
466466

Misc/NEWS.d/3.7.0a1.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -4453,7 +4453,7 @@ In the traceback module, restore the formatting of exception messages like
44534453
.. nonce: 3UhyPo
44544454
.. section: Library
44554455
4456-
Allow falsy values to be used for msg parameter of subTest().
4456+
Allow false values to be used for msg parameter of subTest().
44574457

44584458
..
44594459
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Replaced incorrectly written true/false values
2+
in documentiation. Patch by Robert O'Shea

0 commit comments

Comments
 (0)