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
c1401319
Commit
c1401319
authored
Dec 12, 2000
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the file's indentation from tabs to 4 spaces per level.
parent
c7ed0e3c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
163 additions
and
151 deletions
+163
-151
Lib/StringIO.py
Lib/StringIO.py
+163
-151
No files found.
Lib/StringIO.py
View file @
c1401319
...
...
@@ -44,14 +44,17 @@ class StringIO:
self
.
pos
=
0
self
.
closed
=
0
self
.
softspace
=
0
def
close
(
self
):
if
not
self
.
closed
:
self
.
closed
=
1
del
self
.
buf
,
self
.
pos
def
isatty
(
self
):
if
self
.
closed
:
raise
ValueError
,
"I/O operation on closed file"
return
0
def
seek
(
self
,
pos
,
mode
=
0
):
if
self
.
closed
:
raise
ValueError
,
"I/O operation on closed file"
...
...
@@ -63,10 +66,12 @@ class StringIO:
elif
mode
==
2
:
pos
+=
self
.
len
self
.
pos
=
max
(
0
,
pos
)
def
tell
(
self
):
if
self
.
closed
:
raise
ValueError
,
"I/O operation on closed file"
return
self
.
pos
def
read
(
self
,
n
=
-
1
):
if
self
.
closed
:
raise
ValueError
,
"I/O operation on closed file"
...
...
@@ -80,6 +85,7 @@ class StringIO:
r
=
self
.
buf
[
self
.
pos
:
newpos
]
self
.
pos
=
newpos
return
r
def
readline
(
self
,
length
=
None
):
if
self
.
closed
:
raise
ValueError
,
"I/O operation on closed file"
...
...
@@ -97,6 +103,7 @@ class StringIO:
r
=
self
.
buf
[
self
.
pos
:
newpos
]
self
.
pos
=
newpos
return
r
def
readlines
(
self
,
sizehint
=
0
):
total
=
0
lines
=
[]
...
...
@@ -108,6 +115,7 @@ class StringIO:
break
line
=
self
.
readline
()
return
lines
def
truncate
(
self
,
size
=
None
):
if
self
.
closed
:
raise
ValueError
,
"I/O operation on closed file"
...
...
@@ -118,6 +126,7 @@ class StringIO:
elif
size
<
self
.
pos
:
self
.
pos
=
size
self
.
buf
=
self
.
getvalue
()[:
size
]
def
write
(
self
,
s
):
if
self
.
closed
:
raise
ValueError
,
"I/O operation on closed file"
...
...
@@ -138,11 +147,14 @@ class StringIO:
self
.
buflist
.
append
(
s
)
self
.
len
=
newpos
self
.
pos
=
newpos
def
writelines
(
self
,
list
):
self
.
write
(
EMPTYSTRING
.
join
(
list
))
def
flush
(
self
):
if
self
.
closed
:
raise
ValueError
,
"I/O operation on closed file"
def
getvalue
(
self
):
if
self
.
buflist
:
self
.
buf
+=
EMPTYSTRING
.
join
(
self
.
buflist
)
...
...
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