]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use bool in fileinput.input() docstring and tests for the inplace argument (GH-111998)
authorVille Skyttä <ville.skytta@iki.fi>
Sat, 27 Jan 2024 21:47:55 +0000 (23:47 +0200)
committerGitHub <noreply@github.com>
Sat, 27 Jan 2024 21:47:55 +0000 (23:47 +0200)
The `.rst` docs, most tests, and typeshed already use bool for it.

Lib/fileinput.py
Lib/test/test_fileinput.py

index 1b25f28f3d343260038e76f8832718dbe4964e71..3dba3d2fbfa967b613b8928d6fb36ae73162b274 100644 (file)
@@ -53,7 +53,7 @@ __getitem__() method which implements the sequence behavior.  The
 sequence must be accessed in strictly sequential order; sequence
 access and readline() cannot be mixed.
 
-Optional in-place filtering: if the keyword argument inplace=1 is
+Optional in-place filtering: if the keyword argument inplace=True is
 passed to input() or to the FileInput constructor, the file is moved
 to a backup file and standard output is directed to the input file.
 This makes it possible to write a filter that rewrites its input file
index 786d9186634305b2b8a472c90013e536fed6da06..b3ad41d2588c4cb2d768fe17586c8c852e0c186b 100644 (file)
@@ -151,7 +151,7 @@ class BufferSizesTests(BaseTests, unittest.TestCase):
             print('6. Inplace')
         savestdout = sys.stdout
         try:
-            fi = FileInput(files=(t1, t2, t3, t4), inplace=1, encoding="utf-8")
+            fi = FileInput(files=(t1, t2, t3, t4), inplace=True, encoding="utf-8")
             for line in fi:
                 line = line[:-1].upper()
                 print(line)
@@ -256,7 +256,7 @@ class FileInputTests(BaseTests, unittest.TestCase):
     def test_file_opening_hook(self):
         try:
             # cannot use openhook and inplace mode
-            fi = FileInput(inplace=1, openhook=lambda f, m: None)
+            fi = FileInput(inplace=True, openhook=lambda f, m: None)
             self.fail("FileInput should raise if both inplace "
                              "and openhook arguments are given")
         except ValueError: