Commit c1401319 authored by Barry Warsaw's avatar Barry Warsaw

Change the file's indentation from tabs to 4 spaces per level.

parent c7ed0e3c
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment