Skip to content

Commit a768e12

Browse files
authored
Use bool in fileinput.input() docstring and tests for the inplace argument (GH-111998)
The `.rst` docs, most tests, and typeshed already use bool for it.
1 parent 823a38a commit a768e12

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Lib/fileinput.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
sequence must be accessed in strictly sequential order; sequence
5454
access and readline() cannot be mixed.
5555
56-
Optional in-place filtering: if the keyword argument inplace=1 is
56+
Optional in-place filtering: if the keyword argument inplace=True is
5757
passed to input() or to the FileInput constructor, the file is moved
5858
to a backup file and standard output is directed to the input file.
5959
This makes it possible to write a filter that rewrites its input file

Lib/test/test_fileinput.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def test_buffer_sizes(self):
151151
print('6. Inplace')
152152
savestdout = sys.stdout
153153
try:
154-
fi = FileInput(files=(t1, t2, t3, t4), inplace=1, encoding="utf-8")
154+
fi = FileInput(files=(t1, t2, t3, t4), inplace=True, encoding="utf-8")
155155
for line in fi:
156156
line = line[:-1].upper()
157157
print(line)
@@ -256,7 +256,7 @@ def test_detached_stdin_binary_mode(self):
256256
def test_file_opening_hook(self):
257257
try:
258258
# cannot use openhook and inplace mode
259-
fi = FileInput(inplace=1, openhook=lambda f, m: None)
259+
fi = FileInput(inplace=True, openhook=lambda f, m: None)
260260
self.fail("FileInput should raise if both inplace "
261261
"and openhook arguments are given")
262262
except ValueError:

0 commit comments

Comments
 (0)