mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +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
|
||||
|
||||
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
|
||||
|
|
|
@ -18,4 +18,3 @@
|
|||
|
||||
from sre import *
|
||||
from sre import __all__
|
||||
|
||||
|
|
|
@ -227,8 +227,8 @@ class SMTP:
|
|||
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 = {}
|
||||
|
|
|
@ -409,7 +409,7 @@ Content-Type: text/plain; charset="us-ascii"
|
|||
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"
|
||||
|
||||
''')
|
||||
|
||||
|
@ -450,22 +450,22 @@ Test""")
|
|||
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 <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(), """\
|
||||
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)
|
||||
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)
|
||||
|
||||
|
||||
""")
|
||||
|
|
|
@ -6,9 +6,9 @@ from test_support import TestFailed, TestSkipped
|
|||
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:
|
||||
|
|
|
@ -87,4 +87,3 @@ else: raise TestFailed, 'gcdext(10, 10.) should raise a TypeError'
|
|||
try: mpz.mpz(-10).binary()
|
||||
except ValueError: pass
|
||||
else: raise TestFailed, 'mpz(-10).binary() should raise a ValueError'
|
||||
|
||||
|
|
|
@ -40,4 +40,3 @@ class NetrcTestCase(unittest.TestCase):
|
|||
|
||||
if __name__ == "__main__":
|
||||
test_support.run_unittest(NetrcTestCase)
|
||||
|
||||
|
|
|
@ -31,13 +31,13 @@ tests = unittest.TestSuite()
|
|||
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)
|
||||
|
||||
|
|
|
@ -494,7 +494,7 @@ else: raise TestFailed, "{}.pop(k) doesn't raise KeyError when dictionary is emp
|
|||
d[1] = 1
|
||||
try:
|
||||
for i in d:
|
||||
d[i+1] = 1
|
||||
d[i+1] = 1
|
||||
except RuntimeError:
|
||||
pass
|
||||
else:
|
||||
|
|
|
@ -6,7 +6,7 @@ import sys
|
|||
|
||||
DATA_TEMPLATE=[
|
||||
"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 " +
|
||||
"is meant to speed up the common case, but we also want to test " +
|
||||
"the uncommon case, naturally.'",
|
||||
|
|
|
@ -123,4 +123,3 @@ def test_main():
|
|||
|
||||
if __name__ == "__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."""
|
||||
# Check if message is already a Warning object
|
||||
if isinstance(message, Warning):
|
||||
category = message.__class__
|
||||
category = message.__class__
|
||||
# Check category argument
|
||||
if category is None:
|
||||
category = UserWarning
|
||||
|
@ -53,11 +53,11 @@ def warn_explicit(message, category, filename, lineno,
|
|||
if registry is None:
|
||||
registry = {}
|
||||
if isinstance(message, Warning):
|
||||
text = str(message)
|
||||
category = message.__class__
|
||||
text = str(message)
|
||||
category = message.__class__
|
||||
else:
|
||||
text = message
|
||||
message = category(message)
|
||||
text = message
|
||||
message = category(message)
|
||||
key = (text, category, lineno)
|
||||
# Quick test for common case
|
||||
if registry.get(key):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue