Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ef0a865f
Commit
ef0a865f
authored
May 17, 2009
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use PEP 8 and true booleans.
parent
55689c92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
8 deletions
+9
-8
Lib/fileinput.py
Lib/fileinput.py
+9
-8
No files found.
Lib/fileinput.py
View file @
ef0a865f
...
...
@@ -81,16 +81,17 @@ XXX Possible additions:
import
sys
,
os
__all__
=
[
"input"
,
"close"
,
"nextfile"
,
"filename"
,
"lineno"
,
"filelineno"
,
"isfirstline"
,
"isstdin"
,
"FileInput"
]
__all__
=
[
"input"
,
"close"
,
"nextfile"
,
"filename"
,
"lineno"
,
"filelineno"
,
"isfirstline"
,
"isstdin"
,
"FileInput"
]
_state
=
None
DEFAULT_BUFSIZE
=
8
*
1024
def
input
(
files
=
None
,
inplace
=
0
,
backup
=
""
,
bufsize
=
0
,
def
input
(
files
=
None
,
inplace
=
False
,
backup
=
""
,
bufsize
=
0
,
mode
=
"r"
,
openhook
=
None
):
"""input([files[, inplace[, backup[, mode[, openhook]]]]])
"""input(files=None, inplace=False, backup="", bufsize=0,
\
mode="r", openhook=None)
Create an instance of the FileInput class. The instance will be used
as global state for the functions of this module, and is also returned
...
...
@@ -194,7 +195,7 @@ class FileInput:
sequential order; random access and readline() cannot be mixed.
"""
def
__init__
(
self
,
files
=
None
,
inplace
=
0
,
backup
=
""
,
bufsize
=
0
,
def
__init__
(
self
,
files
=
None
,
inplace
=
False
,
backup
=
""
,
bufsize
=
0
,
mode
=
"r"
,
openhook
=
None
):
if
isinstance
(
files
,
str
):
files
=
(
files
,)
...
...
@@ -398,11 +399,11 @@ def hook_encoded(encoding):
def
_test
():
import
getopt
inplace
=
0
backup
=
0
inplace
=
False
backup
=
False
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"ib:"
)
for
o
,
a
in
opts
:
if
o
==
'-i'
:
inplace
=
1
if
o
==
'-i'
:
inplace
=
True
if
o
==
'-b'
:
backup
=
a
for
line
in
input
(
args
,
inplace
=
inplace
,
backup
=
backup
):
if
line
[
-
1
:]
==
'
\
n
'
:
line
=
line
[:
-
1
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment