From a5440bd95489733ff9440fedd8de4295b07ba991 Mon Sep 17 00:00:00 2001 From: Robert O'Shea Date: Sat, 30 Jul 2022 01:15:46 +0100 Subject: [PATCH 1/4] gh-95454: Replaced truthy/falsy with true/false --- Doc/library/logging.rst | 2 +- Lib/logging/__init__.py | 10 +++++----- Lib/test/test_unittest/test_result.py | 4 ++-- Misc/NEWS.d/3.5.1rc1.rst | 2 +- Misc/NEWS.d/3.5.3rc1.rst | 2 +- Misc/NEWS.d/3.6.0b2.rst | 2 +- Misc/NEWS.d/3.7.0a1.rst | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst index 9bfed4352a19553..8ec1eda32b1531e 100644 --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -672,7 +672,7 @@ empty string, all events are passed. .. 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 different record instance which will replace the original log record in any future processing of the event. diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 88953fefb744769..deb76ffca153ed7 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -833,17 +833,17 @@ def filter(self, record): 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 - this by returning a falsy value. + this by returning a false value. 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 any further processing of the event by that handler. If a filter returns any other truthy value, the original log record 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. - If any of the filters return a falsy value, this method returns - a falsy value. + If any of the filters return a false value, this method returns + a false value. .. versionchanged:: 3.2 @@ -1017,7 +1017,7 @@ def handle(self, record): the I/O thread lock. 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) if isinstance(rv, LogRecord): diff --git a/Lib/test/test_unittest/test_result.py b/Lib/test/test_unittest/test_result.py index eeb15992fd109cf..e71d114751d94d8 100644 --- a/Lib/test/test_unittest/test_result.py +++ b/Lib/test/test_unittest/test_result.py @@ -449,8 +449,8 @@ def testGetSubTestDescriptionWithoutDocstringAndParams(self): '(' + __name__ + '.Test_TextTestResult.testGetSubTestDescriptionWithoutDocstringAndParams) ' '()') - def testGetSubTestDescriptionForFalsyValues(self): - expected = 'testGetSubTestDescriptionForFalsyValues (%s.Test_TextTestResult.testGetSubTestDescriptionForFalsyValues) [%s]' + def testGetSubTestDescriptionForFalseValues(self): + expected = 'testGetSubTestDescriptionForFalseValues (%s.Test_TextTestResult.testGetSubTestDescriptionForFalseValues) [%s]' result = unittest.TextTestResult(None, True, 1) for arg in [0, None, []]: with self.subTest(arg): diff --git a/Misc/NEWS.d/3.5.1rc1.rst b/Misc/NEWS.d/3.5.1rc1.rst index d06817ccb950ec1..dc247ce2096a7db 100644 --- a/Misc/NEWS.d/3.5.1rc1.rst +++ b/Misc/NEWS.d/3.5.1rc1.rst @@ -900,7 +900,7 @@ Kurenkov. .. nonce: QhQ9RD .. section: Library -Fixed functools.singledispatch on classes with falsy metaclasses. Patch by +Fixed functools.singledispatch on classes with false metaclasses. Patch by Ethan Furman. .. diff --git a/Misc/NEWS.d/3.5.3rc1.rst b/Misc/NEWS.d/3.5.3rc1.rst index 2307fccbf6f92d2..bf4ef9302c9d1d5 100644 --- a/Misc/NEWS.d/3.5.3rc1.rst +++ b/Misc/NEWS.d/3.5.3rc1.rst @@ -832,7 +832,7 @@ In the traceback module, restore the formatting of exception messages like .. nonce: 3UhyPo .. section: Library -Allow falsy values to be used for msg parameter of subTest(). +Allow false values to be used for msg parameter of subTest(). .. diff --git a/Misc/NEWS.d/3.6.0b2.rst b/Misc/NEWS.d/3.6.0b2.rst index 627465e887bc185..9413c6e01917d5c 100644 --- a/Misc/NEWS.d/3.6.0b2.rst +++ b/Misc/NEWS.d/3.6.0b2.rst @@ -460,7 +460,7 @@ In the traceback module, restore the formatting of exception messages like .. nonce: 3UhyPo .. section: Library -Allow falsy values to be used for msg parameter of subTest(). +Allow false values to be used for msg parameter of subTest(). .. diff --git a/Misc/NEWS.d/3.7.0a1.rst b/Misc/NEWS.d/3.7.0a1.rst index e99c45ec7fdaadf..9bada1b76be7a86 100644 --- a/Misc/NEWS.d/3.7.0a1.rst +++ b/Misc/NEWS.d/3.7.0a1.rst @@ -4453,7 +4453,7 @@ In the traceback module, restore the formatting of exception messages like .. nonce: 3UhyPo .. section: Library -Allow falsy values to be used for msg parameter of subTest(). +Allow false values to be used for msg parameter of subTest(). .. From 43b4be4c5aae365dba36ed705ec17f27b11fb037 Mon Sep 17 00:00:00 2001 From: Robert O'Shea Date: Sat, 30 Jul 2022 01:18:24 +0100 Subject: [PATCH 2/4] gh-95454: Remove truthy with true --- Lib/logging/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index deb76ffca153ed7..dc28702f50048ab 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -837,7 +837,7 @@ def filter(self, record): 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 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. If none of the filters return false values, this method returns From f1e7cf1b103364146a867a4edad7a58688c749bd Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sat, 30 Jul 2022 00:23:11 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Documentation/2022-07-30-00-23-11.gh-issue-95454.we7AFm.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Documentation/2022-07-30-00-23-11.gh-issue-95454.we7AFm.rst diff --git a/Misc/NEWS.d/next/Documentation/2022-07-30-00-23-11.gh-issue-95454.we7AFm.rst b/Misc/NEWS.d/next/Documentation/2022-07-30-00-23-11.gh-issue-95454.we7AFm.rst new file mode 100644 index 000000000000000..7c5114c3a5b9660 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2022-07-30-00-23-11.gh-issue-95454.we7AFm.rst @@ -0,0 +1 @@ +Removed truthy/falsy. Patch by Robert O'Shea From 1f37d2f79edbedd3debe79f4bc51455e02d9491d Mon Sep 17 00:00:00 2001 From: Robert O'Shea Date: Sat, 30 Jul 2022 01:34:55 +0100 Subject: [PATCH 4/4] gh-95454: change NEWS doc --- .../2022-07-30-00-23-11.gh-issue-95454.we7AFm.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Documentation/2022-07-30-00-23-11.gh-issue-95454.we7AFm.rst b/Misc/NEWS.d/next/Documentation/2022-07-30-00-23-11.gh-issue-95454.we7AFm.rst index 7c5114c3a5b9660..6440c23fd5000a8 100644 --- a/Misc/NEWS.d/next/Documentation/2022-07-30-00-23-11.gh-issue-95454.we7AFm.rst +++ b/Misc/NEWS.d/next/Documentation/2022-07-30-00-23-11.gh-issue-95454.we7AFm.rst @@ -1 +1,2 @@ -Removed truthy/falsy. Patch by Robert O'Shea +Replaced incorrectly written true/false values +in documentiation. Patch by Robert O'Shea