mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Whitespace normalization.
This commit is contained in:
parent
c86c1b88f9
commit
863ac44b74
23 changed files with 84 additions and 88 deletions
|
@ -291,7 +291,7 @@ class fifo:
|
||||||
# regex: 14035/s
|
# regex: 14035/s
|
||||||
|
|
||||||
def find_prefix_at_end (haystack, needle):
|
def find_prefix_at_end (haystack, needle):
|
||||||
l = len(needle) - 1
|
l = len(needle) - 1
|
||||||
while l and not haystack.endswith(needle[:l]):
|
while l and not haystack.endswith(needle[:l]):
|
||||||
l -= 1
|
l -= 1
|
||||||
return l
|
return l
|
||||||
|
|
|
@ -18,4 +18,3 @@
|
||||||
|
|
||||||
from sre import *
|
from sre import *
|
||||||
from sre import __all__
|
from sre import __all__
|
||||||
|
|
||||||
|
|
|
@ -227,8 +227,8 @@ class SMTP:
|
||||||
connect. If specified, `port' specifies the port to which to connect.
|
connect. If specified, `port' specifies the port to which to connect.
|
||||||
By default, smtplib.SMTP_PORT is used. An SMTPConnectError is raised
|
By default, smtplib.SMTP_PORT is used. An SMTPConnectError is raised
|
||||||
if the specified `host' doesn't respond correctly. If specified,
|
if the specified `host' doesn't respond correctly. If specified,
|
||||||
`local_hostname` is used as the FQDN of the local host. By default,
|
`local_hostname` is used as the FQDN of the local host. By default,
|
||||||
the local hostname is found using socket.getfqdn().
|
the local hostname is found using socket.getfqdn().
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.esmtp_features = {}
|
self.esmtp_features = {}
|
||||||
|
|
|
@ -409,7 +409,7 @@ Content-Type: text/plain; charset="us-ascii"
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
Content-Transfer-Encoding: 7bit
|
Content-Transfer-Encoding: 7bit
|
||||||
X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals";
|
X-Foobar-Spoink-Defrobnit: wasnipoop; giraffes="very-long-necked-animals";
|
||||||
spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"
|
spooge="yummy"; hippos="gargantuan"; marshmallows="gooey"
|
||||||
|
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
@ -450,22 +450,22 @@ Test""")
|
||||||
msg = Message()
|
msg = Message()
|
||||||
msg['Received'] = """\
|
msg['Received'] = """\
|
||||||
from babylon.socal-raves.org (localhost [127.0.0.1]); by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81; for <mailman-admin@babylon.socal-raves.org>; 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 <mailman-admin@babylon.socal-raves.org>; 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 <mailman-admin@babylon.socal-raves.org>; 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 <mailman-admin@babylon.socal-raves.org>; 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 <mailman-admin@babylon.socal-raves.org>; 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 <mailman-admin@babylon.socal-raves.org>; Sat, 2 Feb 2002 17:00:06 -0800 (PST)
|
||||||
"""
|
"""
|
||||||
self.assertEqual(msg.as_string(), """\
|
self.assertEqual(msg.as_string(), """\
|
||||||
Received: from babylon.socal-raves.org (localhost [127.0.0.1]);
|
Received: from babylon.socal-raves.org (localhost [127.0.0.1]);
|
||||||
by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81;
|
by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81;
|
||||||
for <mailman-admin@babylon.socal-raves.org>;
|
for <mailman-admin@babylon.socal-raves.org>;
|
||||||
Sat, 2 Feb 2002 17:00:06 -0800 (PST)
|
Sat, 2 Feb 2002 17:00:06 -0800 (PST)
|
||||||
from babylon.socal-raves.org (localhost [127.0.0.1]);
|
from babylon.socal-raves.org (localhost [127.0.0.1]);
|
||||||
by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81;
|
by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81;
|
||||||
for <mailman-admin@babylon.socal-raves.org>;
|
for <mailman-admin@babylon.socal-raves.org>;
|
||||||
Sat, 2 Feb 2002 17:00:06 -0800 (PST)
|
Sat, 2 Feb 2002 17:00:06 -0800 (PST)
|
||||||
from babylon.socal-raves.org (localhost [127.0.0.1]);
|
from babylon.socal-raves.org (localhost [127.0.0.1]);
|
||||||
by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81;
|
by babylon.socal-raves.org (Postfix) with ESMTP id B570E51B81;
|
||||||
for <mailman-admin@babylon.socal-raves.org>;
|
for <mailman-admin@babylon.socal-raves.org>;
|
||||||
Sat, 2 Feb 2002 17:00:06 -0800 (PST)
|
Sat, 2 Feb 2002 17:00:06 -0800 (PST)
|
||||||
|
|
||||||
|
|
||||||
""")
|
""")
|
||||||
|
|
|
@ -6,9 +6,9 @@ from test_support import TestFailed, TestSkipped
|
||||||
REPS = 65580
|
REPS = 65580
|
||||||
|
|
||||||
if sys.platform == 'mac':
|
if sys.platform == 'mac':
|
||||||
import gestalt
|
import gestalt
|
||||||
if gestalt.gestalt('sysv') > 0x9ff:
|
if gestalt.gestalt('sysv') > 0x9ff:
|
||||||
raise TestSkipped, 'Triggers pathological malloc slowdown on OSX MacPython'
|
raise TestSkipped, 'Triggers pathological malloc slowdown on OSX MacPython'
|
||||||
if sys.platform == "os2emx":
|
if sys.platform == "os2emx":
|
||||||
raise TestFailed, "OS/2+EMX port has malloc problems with long expressions"
|
raise TestFailed, "OS/2+EMX port has malloc problems with long expressions"
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -87,4 +87,3 @@ else: raise TestFailed, 'gcdext(10, 10.) should raise a TypeError'
|
||||||
try: mpz.mpz(-10).binary()
|
try: mpz.mpz(-10).binary()
|
||||||
except ValueError: pass
|
except ValueError: pass
|
||||||
else: raise TestFailed, 'mpz(-10).binary() should raise a ValueError'
|
else: raise TestFailed, 'mpz(-10).binary() should raise a ValueError'
|
||||||
|
|
||||||
|
|
|
@ -40,4 +40,3 @@ class NetrcTestCase(unittest.TestCase):
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_support.run_unittest(NetrcTestCase)
|
test_support.run_unittest(NetrcTestCase)
|
||||||
|
|
||||||
|
|
|
@ -31,13 +31,13 @@ tests = unittest.TestSuite()
|
||||||
def RobotTest(index, robots_txt, good_urls, bad_urls,
|
def RobotTest(index, robots_txt, good_urls, bad_urls,
|
||||||
agent="test_robotparser"):
|
agent="test_robotparser"):
|
||||||
|
|
||||||
lines = StringIO.StringIO(robots_txt).readlines()
|
lines = StringIO.StringIO(robots_txt).readlines()
|
||||||
parser = robotparser.RobotFileParser()
|
parser = robotparser.RobotFileParser()
|
||||||
parser.parse(lines)
|
parser.parse(lines)
|
||||||
for url in good_urls:
|
for url in good_urls:
|
||||||
tests.addTest(RobotTestCase(index, parser, url, 1, agent))
|
tests.addTest(RobotTestCase(index, parser, url, 1, agent))
|
||||||
for url in bad_urls:
|
for url in bad_urls:
|
||||||
tests.addTest(RobotTestCase(index, parser, url, 0, agent))
|
tests.addTest(RobotTestCase(index, parser, url, 0, agent))
|
||||||
|
|
||||||
# Examples from http://www.robotstxt.org/wc/norobots.html (fetched 2002)
|
# Examples from http://www.robotstxt.org/wc/norobots.html (fetched 2002)
|
||||||
|
|
||||||
|
|
|
@ -494,7 +494,7 @@ else: raise TestFailed, "{}.pop(k) doesn't raise KeyError when dictionary is emp
|
||||||
d[1] = 1
|
d[1] = 1
|
||||||
try:
|
try:
|
||||||
for i in d:
|
for i in d:
|
||||||
d[i+1] = 1
|
d[i+1] = 1
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -6,7 +6,7 @@ import sys
|
||||||
|
|
||||||
DATA_TEMPLATE=[
|
DATA_TEMPLATE=[
|
||||||
"line1=1",
|
"line1=1",
|
||||||
"line2='this is a very long line designed to go past the magic " +
|
"line2='this is a very long line designed to go past the magic " +
|
||||||
"hundred character limit that is inside fileobject.c and which " +
|
"hundred character limit that is inside fileobject.c and which " +
|
||||||
"is meant to speed up the common case, but we also want to test " +
|
"is meant to speed up the common case, but we also want to test " +
|
||||||
"the uncommon case, naturally.'",
|
"the uncommon case, naturally.'",
|
||||||
|
|
|
@ -123,4 +123,3 @@ def test_main():
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ def warn(message, category=None, stacklevel=1):
|
||||||
"""Issue a warning, or maybe ignore it or raise an exception."""
|
"""Issue a warning, or maybe ignore it or raise an exception."""
|
||||||
# Check if message is already a Warning object
|
# Check if message is already a Warning object
|
||||||
if isinstance(message, Warning):
|
if isinstance(message, Warning):
|
||||||
category = message.__class__
|
category = message.__class__
|
||||||
# Check category argument
|
# Check category argument
|
||||||
if category is None:
|
if category is None:
|
||||||
category = UserWarning
|
category = UserWarning
|
||||||
|
@ -53,11 +53,11 @@ def warn_explicit(message, category, filename, lineno,
|
||||||
if registry is None:
|
if registry is None:
|
||||||
registry = {}
|
registry = {}
|
||||||
if isinstance(message, Warning):
|
if isinstance(message, Warning):
|
||||||
text = str(message)
|
text = str(message)
|
||||||
category = message.__class__
|
category = message.__class__
|
||||||
else:
|
else:
|
||||||
text = message
|
text = message
|
||||||
message = category(message)
|
message = category(message)
|
||||||
key = (text, category, lineno)
|
key = (text, category, lineno)
|
||||||
# Quick test for common case
|
# Quick test for common case
|
||||||
if registry.get(key):
|
if registry.get(key):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue