Skip to content

Commit

Permalink
Whitespace normalization.
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-one committed Apr 16, 2002
1 parent c86c1b8 commit 863ac44
Show file tree
Hide file tree
Showing 23 changed files with 84 additions and 88 deletions.
2 changes: 1 addition & 1 deletion Lib/BaseHTTPServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# Network Working Group R. Fielding
# Request for Comments: 2616 et al
# Obsoletes: 2068 June 1999
# Category: Standards Track
# Category: Standards Track
#
# URL: http://www.faqs.org/rfcs/rfc2616.html

Expand Down
12 changes: 6 additions & 6 deletions Lib/asynchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ def __init__ (self, conn=None):

def collect_incoming_data(self, data):
raise NotImplementedError, "must be implemented in subclass"

def found_terminator(self):
raise NotImplementedError, "must be implemented in subclass"

def set_terminator (self, term):
"Set the input delimiter. Can be a fixed string of any length, an integer, or None"
self.terminator = term
Expand Down Expand Up @@ -291,7 +291,7 @@ def pop (self):
# regex: 14035/s

def find_prefix_at_end (haystack, needle):
l = len(needle) - 1
while l and not haystack.endswith(needle[:l]):
l -= 1
return l
l = len(needle) - 1
while l and not haystack.endswith(needle[:l]):
l -= 1
return l
2 changes: 1 addition & 1 deletion Lib/fileinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def next(self):
if not line:
raise StopIteration
return line

def __getitem__(self, i):
if i != self._lineno:
raise RuntimeError, "accessing lines out of order"
Expand Down
4 changes: 2 additions & 2 deletions Lib/gzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def write(self,data):
if self.mode != WRITE:
import errno
raise IOError(errno.EBADF, "write() on read-only GzipFile object")

if self.fileobj is None:
raise ValueError, "write() on closed GzipFile object"
if len(data) > 0:
Expand All @@ -149,7 +149,7 @@ def read(self, size=-1):
if self.mode != READ:
import errno
raise IOError(errno.EBADF, "write() on read-only GzipFile object")

if self.extrasize <= 0 and self.fileobj is None:
return ''

Expand Down
2 changes: 1 addition & 1 deletion Lib/imaplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ def open(self, host, port):
"""
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.connect((self.host, self.port))
self.sslobj = socket.ssl(self.sock,self.keyfile, self.certfile)
self.sslobj = socket.ssl(self.sock,self.keyfile, self.certfile)


def read(self, size):
Expand Down
2 changes: 1 addition & 1 deletion Lib/os2emxpath.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Module 'os2emxpath' -- common operations on OS/2 pathnames
"""Common pathname manipulations, OS/2 EMX version.
"""Common pathname manipulations, OS/2 EMX version.
Instead of importing this module directly, import os and refer to this
module as os.path.
Expand Down
2 changes: 1 addition & 1 deletion Lib/pre.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
import warnings as _warnings
_warnings.warn("Please use the 're' module, not the 'pre' module",
DeprecationWarning)

__all__ = ["match","search","sub","subn","split","findall","escape","compile",
"I","L","M","S","X","IGNORECASE","LOCALE","MULTILINE","DOTALL",
"VERBOSE","error"]
Expand Down
1 change: 0 additions & 1 deletion Lib/re.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@

from sre import *
from sre import __all__

4 changes: 2 additions & 2 deletions Lib/rlcompleter.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(self, namespace = None):
readline.set_completer(Completer(my_namespace).complete)
"""

if namespace and not isinstance(namespace, dict):
raise TypeError,'namespace must be a dictionary'

Expand All @@ -82,7 +82,7 @@ def complete(self, text, state):
"""
if self.use_main_ns:
self.namespace = __main__.__dict__

if state == 0:
if "." in text:
self.matches = self.attr_matches(text)
Expand Down
4 changes: 2 additions & 2 deletions Lib/smtplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ def __init__(self, host = '', port = 0, local_hostname = None):
connect. If specified, `port' specifies the port to which to connect.
By default, smtplib.SMTP_PORT is used. An SMTPConnectError is raised
if the specified `host' doesn't respond correctly. If specified,
`local_hostname` is used as the FQDN of the local host. By default,
the local hostname is found using socket.getfqdn().
`local_hostname` is used as the FQDN of the local host. By default,
the local hostname is found using socket.getfqdn().
"""
self.esmtp_features = {}
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/pickletester.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def test_structseq(self):
t = time.localtime()
s = self.dumps(t)
u = self.loads(s)
self.assertEqual(t, u)
self.assertEqual(t, u)
import os
if hasattr(os, "stat"):
t = os.stat(os.curdir)
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/string_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def run_method_tests(test):
test('zfill', '', '000', 3)
test('zfill', '34', '34', 1)
test('zfill', '34', '0034', 4)

# Encoding/decoding
codecs = [('rot13', 'uryyb jbeyq'),
('base64', 'aGVsbG8gd29ybGQ=\n'),
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_cfgparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def write(src):
foo = this line is much, much longer than my editor
likes it.
""")

def case_sensitivity():
print "Testing case sensitivity..."
cf = ConfigParser.ConfigParser()
Expand Down
52 changes: 26 additions & 26 deletions Lib/test/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def test_del_param(self):
msg.del_param("report-type")
eq(msg.get_params(),
[('multipart/report', ''),
('boundary', 'D1690A7AC1.996856090/mail.example.com')])
('boundary', 'D1690A7AC1.996856090/mail.example.com')])
msg.set_param("report-type", old_val)
eq(msg.get_params(),
[('multipart/report', ''),
Expand All @@ -331,7 +331,7 @@ def test_set_type(self):
msg.set_type('text/html')
eq(msg['content-type'], 'text/html; charset="us-ascii"')



# Test the email.Encoders module
class TestEncoders(unittest.TestCase):
Expand Down Expand Up @@ -409,7 +409,7 @@ def test_header_splitter(self):
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals";
spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"
spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"
''')

Expand Down Expand Up @@ -450,22 +450,22 @@ def test_splitting_multiple_long_lines(self):
msg = Message()
msg['Received'] = """\
from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for <[email protected]>; Sat, 2 Feb 2002 17:00:06 -0800 (PST)
from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for <[email protected]>; Sat, 2 Feb 2002 17:00:06 -0800 (PST)
from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for <[email protected]>; Sat, 2 Feb 2002 17:00:06 -0800 (PST)
from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for <[email protected]>; Sat, 2 Feb 2002 17:00:06 -0800 (PST)
from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for <[email protected]>; Sat, 2 Feb 2002 17:00:06 -0800 (PST)
"""
self.assertEqual(msg.as_string(), """\
Received: from babylon.socal-raves.org (localhost [127.0.0.1]);
by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81;
for <[email protected]>;
Sat, 2 Feb 2002 17:00:06 -0800 (PST)
from babylon.socal-raves.org (localhost [127.0.0.1]);
by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81;
for <[email protected]>;
Sat, 2 Feb 2002 17:00:06 -0800 (PST)
from babylon.socal-raves.org (localhost [127.0.0.1]);
by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81;
for <[email protected]>;
Sat, 2 Feb 2002 17:00:06 -0800 (PST)
by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81;
for <[email protected]>;
Sat, 2 Feb 2002 17:00:06 -0800 (PST)
from babylon.socal-raves.org (localhost [127.0.0.1]);
by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81;
for <[email protected]>;
Sat, 2 Feb 2002 17:00:06 -0800 (PST)
from babylon.socal-raves.org (localhost [127.0.0.1]);
by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81;
for <[email protected]>;
Sat, 2 Feb 2002 17:00:06 -0800 (PST)
""")
Expand Down Expand Up @@ -721,7 +721,7 @@ def test_no_parts_in_a_multipart(self):
--BOUNDARY--
''')
''')

def test_one_part_in_a_multipart(self):
outer = MIMEBase('multipart', 'mixed')
Expand All @@ -748,7 +748,7 @@ def test_one_part_in_a_multipart(self):
hello world
--BOUNDARY--
''')
''')

def test_seq_parts_in_a_multipart(self):
outer = MIMEBase('multipart', 'mixed')
Expand All @@ -775,7 +775,7 @@ def test_seq_parts_in_a_multipart(self):
hello world
--BOUNDARY--
''')
''')



Expand Down Expand Up @@ -1163,11 +1163,11 @@ def test__all__(self):
module = __import__('email')
all = module.__all__
all.sort()
self.assertEqual(all, ['Charset', 'Encoders', 'Errors', 'Generator',
'Header', 'Iterators', 'MIMEAudio',
'MIMEBase', 'MIMEImage', 'MIMEMessage',
self.assertEqual(all, ['Charset', 'Encoders', 'Errors', 'Generator',
'Header', 'Iterators', 'MIMEAudio',
'MIMEBase', 'MIMEImage', 'MIMEMessage',
'MIMEText', 'Message', 'Parser',
'Utils', 'base64MIME',
'Utils', 'base64MIME',
'message_from_file', 'message_from_string',
'quopriMIME'])

Expand Down Expand Up @@ -1313,7 +1313,7 @@ def test_whitespace_continuaton(self):
From: [email protected]
To: [email protected]
Subject: the next line has a space on it
Date: Mon, 8 Apr 2002 15:09:19 -0400
Message-ID: spam
Expand Down Expand Up @@ -1367,7 +1367,7 @@ def test_encode(self):
eHh4eCB4eHh4IHh4eHggeHh4eCB4eHh4IHh4eHgg\r
eHh4eCB4eHh4IA==\r
""")

def test_header_encode(self):
eq = self.assertEqual
he = base64MIME.header_encode
Expand Down Expand Up @@ -1504,7 +1504,7 @@ def test_encode(self):
one line
two line""")



# Test the Charset class
Expand Down
6 changes: 3 additions & 3 deletions Lib/test/test_longexp.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
REPS = 65580

if sys.platform == 'mac':
import gestalt
if gestalt.gestalt('sysv') > 0x9ff:
raise TestSkipped, 'Triggers pathological malloc slowdown on OSX MacPython'
import gestalt
if gestalt.gestalt('sysv') > 0x9ff:
raise TestSkipped, 'Triggers pathological malloc slowdown on OSX MacPython'
if sys.platform == "os2emx":
raise TestFailed, "OS/2+EMX port has malloc problems with long expressions"
else:
Expand Down
1 change: 0 additions & 1 deletion Lib/test/test_mpz.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,3 @@ def check_conversion(num):
try: mpz.mpz(-10).binary()
except ValueError: pass
else: raise TestFailed, 'mpz(-10).binary() should raise a ValueError'

9 changes: 4 additions & 5 deletions Lib/test/test_netrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
line3
line4
default login log2 password pass2
default login log2 password pass2
"""

Expand All @@ -25,7 +25,7 @@ def setUp (self):
fp.write(TEST_NETRC)
fp.close()
self.netrc = netrc.netrc(temp_filename)

def tearDown (self):
del self.netrc
os.unlink(temp_filename)
Expand All @@ -36,8 +36,7 @@ def test_case_1(self):
)
self.assert_(self.netrc.hosts['foo'] == ('log1', 'acct1', 'pass1'))
self.assert_(self.netrc.hosts['default'] == ('log2', None, 'pass2'))


if __name__ == "__main__":
test_support.run_unittest(NetrcTestCase)

18 changes: 9 additions & 9 deletions Lib/test/test_robotparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ def __str__(self):

def RobotTest(index, robots_txt, good_urls, bad_urls,
agent="test_robotparser"):
lines = StringIO.StringIO(robots_txt).readlines()
parser = robotparser.RobotFileParser()
parser.parse(lines)
for url in good_urls:
tests.addTest(RobotTestCase(index, parser, url, 1, agent))
for url in bad_urls:
tests.addTest(RobotTestCase(index, parser, url, 0, agent))

lines = StringIO.StringIO(robots_txt).readlines()
parser = robotparser.RobotFileParser()
parser.parse(lines)
for url in good_urls:
tests.addTest(RobotTestCase(index, parser, url, 1, agent))
for url in bad_urls:
tests.addTest(RobotTestCase(index, parser, url, 0, agent))

# Examples from http://www.robotstxt.org/wc/norobots.html (fetched 2002)

Expand Down Expand Up @@ -116,7 +116,7 @@ def RobotTest(index, robots_txt, good_urls, bad_urls,
good = ['/tmp',] # XFAIL: '/a%2fb.html'
bad = ['/tmp/','/tmp/a.html',
'/a%3cd.html','/a%3Cd.html',"/a/b.html",
'/%7Ejoe/index.html']
'/%7Ejoe/index.html']

RobotTest(6, doc, good, bad)

Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ def __getitem__(self, key):
d[1] = 1
try:
for i in d:
d[i+1] = 1
d[i+1] = 1
except RuntimeError:
pass
else:
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ def __str__(self):
u'\u90e8\u306f\u30c9\u30a4\u30c4\u8a9e\u3067\u3059\u304c'
u'\u3001\u3042\u3068\u306f\u3067\u305f\u3089\u3081\u3067'
u'\u3059\u3002\u5b9f\u969b\u306b\u306f\u300cWenn ist das'
u' Nunstuck git und'.encode('utf-8') ==
u' Nunstuck git und'.encode('utf-8') ==
'\xe6\xad\xa3\xe7\xa2\xba\xe3\x81\xab\xe8\xa8\x80\xe3\x81'
'\x86\xe3\x81\xa8\xe7\xbf\xbb\xe8\xa8\xb3\xe3\x81\xaf\xe3'
'\x81\x95\xe3\x82\x8c\xe3\x81\xa6\xe3\x81\x84\xe3\x81\xbe'
Expand Down
Loading

0 comments on commit 863ac44

Please sign in to comment.