Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ef0a865

Browse files
committed
Use PEP 8 and true booleans.
1 parent 55689c9 commit ef0a865

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

Lib/fileinput.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,17 @@
8181

8282
import sys, os
8383

84-
__all__ = ["input","close","nextfile","filename","lineno","filelineno",
85-
"isfirstline","isstdin","FileInput"]
84+
__all__ = ["input", "close", "nextfile", "filename", "lineno", "filelineno",
85+
"isfirstline", "isstdin", "FileInput"]
8686

8787
_state = None
8888

8989
DEFAULT_BUFSIZE = 8*1024
9090

91-
def input(files=None, inplace=0, backup="", bufsize=0,
91+
def input(files=None, inplace=False, backup="", bufsize=0,
9292
mode="r", openhook=None):
93-
"""input([files[, inplace[, backup[, mode[, openhook]]]]])
93+
"""input(files=None, inplace=False, backup="", bufsize=0, \
94+
mode="r", openhook=None)
9495
9596
Create an instance of the FileInput class. The instance will be used
9697
as global state for the functions of this module, and is also returned
@@ -194,7 +195,7 @@ class FileInput:
194195
sequential order; random access and readline() cannot be mixed.
195196
"""
196197

197-
def __init__(self, files=None, inplace=0, backup="", bufsize=0,
198+
def __init__(self, files=None, inplace=False, backup="", bufsize=0,
198199
mode="r", openhook=None):
199200
if isinstance(files, str):
200201
files = (files,)
@@ -398,11 +399,11 @@ def openhook(filename, mode):
398399

399400
def _test():
400401
import getopt
401-
inplace = 0
402-
backup = 0
402+
inplace = False
403+
backup = False
403404
opts, args = getopt.getopt(sys.argv[1:], "ib:")
404405
for o, a in opts:
405-
if o == '-i': inplace = 1
406+
if o == '-i': inplace = True
406407
if o == '-b': backup = a
407408
for line in input(args, inplace=inplace, backup=backup):
408409
if line[-1:] == '\n': line = line[:-1]

0 commit comments

Comments
 (0)