Whitespace normalization.

This commit is contained in:
Tim Peters 2002-11-09 05:08:07 +00:00
parent b0ead4ea4a
commit 230a60c6ec
7 changed files with 27 additions and 28 deletions

View File

@ -525,7 +525,7 @@ class ConfigParser(RawConfigParser):
def _interpolate(self, section, option, rawval, vars): def _interpolate(self, section, option, rawval, vars):
# do the string interpolation # do the string interpolation
value = rawval value = rawval
depth = MAX_INTERPOLATION_DEPTH depth = MAX_INTERPOLATION_DEPTH
while depth: # Loop through this until it's done while depth: # Loop through this until it's done
depth -= 1 depth -= 1
if value.find("%(") != -1: if value.find("%(") != -1:

View File

@ -371,7 +371,7 @@ class HTTPResponse:
if self.chunked: if self.chunked:
return self._read_chunked(amt) return self._read_chunked(amt)
if amt is None: if amt is None:
# unbounded read # unbounded read
if self.will_close: if self.will_close:
@ -441,7 +441,7 @@ class HTTPResponse:
self.close() self.close()
return value return value
def _safe_read(self, amt): def _safe_read(self, amt):
"""Read the number of bytes requested, compensating for partial reads. """Read the number of bytes requested, compensating for partial reads.

View File

@ -272,7 +272,7 @@ def _parse_localename(localename):
# since some systems may use other encodings for these # since some systems may use other encodings for these
# locales. Also, we ignore other modifiers. # locales. Also, we ignore other modifiers.
return code, 'iso-8859-15' return code, 'iso-8859-15'
if '.' in code: if '.' in code:
return code.split('.')[:2] return code.split('.')[:2]
elif code == 'C': elif code == 'C':
@ -420,7 +420,7 @@ else:
return result return result
else: else:
return nl_langinfo(CODESET) return nl_langinfo(CODESET)
### Database ### Database
# #

View File

@ -411,4 +411,3 @@ symbolic links encountered in the path."""
return filename return filename
supports_unicode_filenames = False supports_unicode_filenames = False

View File

@ -94,7 +94,7 @@ del dir, dircase, L
# (especially for Guido :-) # (especially for Guido :-)
# XXX This should not be part of site.py, since it is needed even when # XXX This should not be part of site.py, since it is needed even when
# using the -S option for Python. See http://www.python.org/sf/586680 # using the -S option for Python. See http://www.python.org/sf/586680
if (os.name == "posix" and sys.path and if (os.name == "posix" and sys.path and
os.path.basename(sys.path[-1]) == "Modules"): os.path.basename(sys.path[-1]) == "Modules"):
from distutils.util import get_platform from distutils.util import get_platform
s = "build/lib.%s-%.3s" % (get_platform(), sys.version) s = "build/lib.%s-%.3s" % (get_platform(), sys.version)

View File

@ -399,12 +399,12 @@ class Telnet:
if not buf and self.eof and not self.rawq: if not buf and self.eof and not self.rawq:
raise EOFError, 'telnet connection closed' raise EOFError, 'telnet connection closed'
return buf return buf
def read_sb_data(self): def read_sb_data(self):
"""Return any data available in the SB ... SE queue. """Return any data available in the SB ... SE queue.
Return '' if no SB ... SE available. Should only be called Return '' if no SB ... SE available. Should only be called
after seeing a SB or SE command. When a new SB command is after seeing a SB or SE command. When a new SB command is
found, old unread SB data will be discarded. Don't block. found, old unread SB data will be discarded. Don't block.
""" """
@ -442,7 +442,7 @@ class Telnet:
if c in (DO, DONT, WILL, WONT): if c in (DO, DONT, WILL, WONT):
self.iacseq += c self.iacseq += c
continue continue
self.iacseq = '' self.iacseq = ''
if c == IAC: if c == IAC:
buf[self.sb] = buf[self.sb] + c buf[self.sb] = buf[self.sb] + c
@ -468,7 +468,7 @@ class Telnet:
self.iacseq = '' self.iacseq = ''
opt = c opt = c
if cmd in (DO, DONT): if cmd in (DO, DONT):
self.msg('IAC %s %d', self.msg('IAC %s %d',
cmd == DO and 'DO' or 'DONT', ord(opt)) cmd == DO and 'DO' or 'DONT', ord(opt))
if self.option_callback: if self.option_callback:
self.option_callback(self.sock, cmd, opt) self.option_callback(self.sock, cmd, opt)

View File

@ -28,11 +28,11 @@ class BZ2FileTest(BaseTest):
def setUp(self): def setUp(self):
self.filename = tempfile.mktemp("bz2") self.filename = tempfile.mktemp("bz2")
def tearDown(self): def tearDown(self):
if os.path.isfile(self.filename): if os.path.isfile(self.filename):
os.unlink(self.filename) os.unlink(self.filename)
def createTempFile(self, crlf=0): def createTempFile(self, crlf=0):
f = open(self.filename, "wb") f = open(self.filename, "wb")
if crlf: if crlf:
@ -41,14 +41,14 @@ class BZ2FileTest(BaseTest):
data = self.DATA data = self.DATA
f.write(data) f.write(data)
f.close() f.close()
def testRead(self): def testRead(self):
"Test BZ2File.read()" "Test BZ2File.read()"
self.createTempFile() self.createTempFile()
bz2f = BZ2File(self.filename) bz2f = BZ2File(self.filename)
self.assertEqual(bz2f.read(), self.TEXT) self.assertEqual(bz2f.read(), self.TEXT)
bz2f.close() bz2f.close()
def testReadChunk10(self): def testReadChunk10(self):
"Test BZ2File.read() in chunks of 10 bytes" "Test BZ2File.read() in chunks of 10 bytes"
self.createTempFile() self.createTempFile()
@ -61,14 +61,14 @@ class BZ2FileTest(BaseTest):
text += str text += str
self.assertEqual(text, text) self.assertEqual(text, text)
bz2f.close() bz2f.close()
def testRead100(self): def testRead100(self):
"Test BZ2File.read(100)" "Test BZ2File.read(100)"
self.createTempFile() self.createTempFile()
bz2f = BZ2File(self.filename) bz2f = BZ2File(self.filename)
self.assertEqual(bz2f.read(100), self.TEXT[:100]) self.assertEqual(bz2f.read(100), self.TEXT[:100])
bz2f.close() bz2f.close()
def testReadLine(self): def testReadLine(self):
"Test BZ2File.readline()" "Test BZ2File.readline()"
self.createTempFile() self.createTempFile()
@ -77,7 +77,7 @@ class BZ2FileTest(BaseTest):
for line in sio.readlines(): for line in sio.readlines():
self.assertEqual(bz2f.readline(), line) self.assertEqual(bz2f.readline(), line)
bz2f.close() bz2f.close()
def testReadLines(self): def testReadLines(self):
"Test BZ2File.readlines()" "Test BZ2File.readlines()"
self.createTempFile() self.createTempFile()
@ -85,7 +85,7 @@ class BZ2FileTest(BaseTest):
sio = StringIO(self.TEXT) sio = StringIO(self.TEXT)
self.assertEqual(bz2f.readlines(), sio.readlines()) self.assertEqual(bz2f.readlines(), sio.readlines())
bz2f.close() bz2f.close()
def testIterator(self): def testIterator(self):
"Test iter(BZ2File)" "Test iter(BZ2File)"
self.createTempFile() self.createTempFile()
@ -93,7 +93,7 @@ class BZ2FileTest(BaseTest):
sio = StringIO(self.TEXT) sio = StringIO(self.TEXT)
self.assertEqual(list(iter(bz2f)), sio.readlines()) self.assertEqual(list(iter(bz2f)), sio.readlines())
bz2f.close() bz2f.close()
def testXReadLines(self): def testXReadLines(self):
"Test BZ2File.xreadlines()" "Test BZ2File.xreadlines()"
self.createTempFile() self.createTempFile()
@ -101,7 +101,7 @@ class BZ2FileTest(BaseTest):
sio = StringIO(self.TEXT) sio = StringIO(self.TEXT)
self.assertEqual(list(bz2f.xreadlines()), sio.readlines()) self.assertEqual(list(bz2f.xreadlines()), sio.readlines())
bz2f.close() bz2f.close()
def testUniversalNewlinesLF(self): def testUniversalNewlinesLF(self):
"Test BZ2File.read() with universal newlines (\\n)" "Test BZ2File.read() with universal newlines (\\n)"
self.createTempFile() self.createTempFile()
@ -109,7 +109,7 @@ class BZ2FileTest(BaseTest):
self.assertEqual(bz2f.read(), self.TEXT) self.assertEqual(bz2f.read(), self.TEXT)
self.assertEqual(bz2f.newlines, "\n") self.assertEqual(bz2f.newlines, "\n")
bz2f.close() bz2f.close()
def testUniversalNewlinesCRLF(self): def testUniversalNewlinesCRLF(self):
"Test BZ2File.read() with universal newlines (\\r\\n)" "Test BZ2File.read() with universal newlines (\\r\\n)"
self.createTempFile(crlf=1) self.createTempFile(crlf=1)
@ -117,7 +117,7 @@ class BZ2FileTest(BaseTest):
self.assertEqual(bz2f.read(), self.TEXT) self.assertEqual(bz2f.read(), self.TEXT)
self.assertEqual(bz2f.newlines, "\r\n") self.assertEqual(bz2f.newlines, "\r\n")
bz2f.close() bz2f.close()
def testWrite(self): def testWrite(self):
"Test BZ2File.write()" "Test BZ2File.write()"
bz2f = BZ2File(self.filename, "w") bz2f = BZ2File(self.filename, "w")
@ -151,7 +151,7 @@ class BZ2FileTest(BaseTest):
f = open(self.filename) f = open(self.filename)
self.assertEqual(self.decompress(f.read()), self.TEXT) self.assertEqual(self.decompress(f.read()), self.TEXT)
f.close() f.close()
def testSeekForward(self): def testSeekForward(self):
"Test BZ2File.seek(150, 0)" "Test BZ2File.seek(150, 0)"
self.createTempFile() self.createTempFile()
@ -173,7 +173,7 @@ class BZ2FileTest(BaseTest):
bz2f = BZ2File(self.filename) bz2f = BZ2File(self.filename)
bz2f.seek(-150, 2) bz2f.seek(-150, 2)
self.assertEqual(bz2f.read(), self.TEXT[len(self.TEXT)-150:]) self.assertEqual(bz2f.read(), self.TEXT[len(self.TEXT)-150:])
def testSeekPostEnd(self): def testSeekPostEnd(self):
"Test BZ2File.seek(150000)" "Test BZ2File.seek(150000)"
self.createTempFile() self.createTempFile()
@ -258,7 +258,7 @@ class BZ2DecompressorTest(BaseTest):
class FuncTest(BaseTest): class FuncTest(BaseTest):
"Test module functions" "Test module functions"
def testCompress(self): def testCompress(self):
"Test compress() function" "Test compress() function"
data = compress(self.TEXT) data = compress(self.TEXT)
@ -268,7 +268,7 @@ class FuncTest(BaseTest):
"Test decompress() function" "Test decompress() function"
text = decompress(self.DATA) text = decompress(self.DATA)
self.assertEqual(text, self.TEXT) self.assertEqual(text, self.TEXT)
def testDecompressEmpty(self): def testDecompressEmpty(self):
"Test decompress() function with empty string" "Test decompress() function with empty string"
text = decompress("") text = decompress("")