← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/services-lint into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/services-lint into lp:launchpad.

Commit message:
Remove lots of lint from lp.services.

Requested reviews:
  Colin Watson (cjwatson)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/services-lint/+merge/274420

Remove lots of lint from lp.services.  No functional changes.
-- 
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/services/apachelogparser/base.py'
--- lib/lp/services/apachelogparser/base.py	2013-06-20 05:50:00 +0000
+++ lib/lp/services/apachelogparser/base.py	2015-10-14 15:31:43 +0000
@@ -164,7 +164,6 @@
             logger.error('Error (%s) while parsing "%s"' % (e, line))
             break
 
-
     if parsed_lines > 0:
         logger.info('Parsed %d lines resulting in %d download stats.' % (
             parsed_lines, len(downloads)))

=== modified file 'lib/lp/services/apachelogparser/tests/test_apachelogparser.py'
--- lib/lp/services/apachelogparser/tests/test_apachelogparser.py	2013-06-20 05:50:00 +0000
+++ lib/lp/services/apachelogparser/tests/test_apachelogparser.py	2015-10-14 15:31:43 +0000
@@ -441,7 +441,6 @@
         # ones.  The first time we see one, we'll parse from the beginning.
         gz_name = 'launchpadlibrarian.net.access-log.1.gz'
         gz_path = os.path.join(self.root, gz_name)
-        first_line = gzip.open(gz_path).readline()
         files_to_parse = get_files_to_parse([gz_path])
         positions = map(itemgetter(1), files_to_parse)
         self.assertEqual(positions, [0])

=== modified file 'lib/lp/services/auditor/tests/test_client.py'
--- lib/lp/services/auditor/tests/test_client.py	2013-06-28 00:04:30 +0000
+++ lib/lp/services/auditor/tests/test_client.py	2015-10-14 15:31:43 +0000
@@ -33,7 +33,7 @@
                 object_to_enterpriseid(pu), object_to_enterpriseid(actor))
         self.assertAction('auditor-send', data)
         result = client.receive(obj=pu)
-        del result[0]['date'] # Ignore the date.
+        del result[0]['date']  # Ignore the date.
         expected = [{
             u'comment': u'', u'details': u'', u'actor': actor,
             u'operation': u'packageupload-accepted', u'object': pu}]
@@ -54,7 +54,7 @@
             operation=('person-deleted', 'person-undeleted'))
         self.assertEqual(2, len(result))
         for r in result:
-            del r['date'] # Ignore the date.
+            del r['date']  # Ignore the date.
         expected = [
             {u'comment': u'', u'details': u'', u'actor': actor,
             u'operation': u'person-deleted', u'object': actor},

=== modified file 'lib/lp/services/authserver/interfaces.py'
--- lib/lp/services/authserver/interfaces.py	2013-01-07 02:40:55 +0000
+++ lib/lp/services/authserver/interfaces.py	2015-10-14 15:31:43 +0000
@@ -30,4 +30,3 @@
 
 class IAuthServerApplication(ILaunchpadApplication):
     """Launchpad legacy AuthServer application root."""
-

=== modified file 'lib/lp/services/authserver/xmlrpc.py'
--- lib/lp/services/authserver/xmlrpc.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/authserver/xmlrpc.py	2015-10-14 15:31:43 +0000
@@ -44,5 +44,3 @@
     """AuthServer End-Point."""
 
     title = "Auth Server"
-
-

=== modified file 'lib/lp/services/database/__init__.py'
--- lib/lp/services/database/__init__.py	2014-01-15 10:46:59 +0000
+++ lib/lp/services/database/__init__.py	2015-10-14 15:31:43 +0000
@@ -54,7 +54,7 @@
             except (DisconnectionError, IntegrityError,
                     TransactionRollbackError):
                 if attempt >= RETRY_ATTEMPTS:
-                    raise # tried too many times
+                    raise  # tried too many times
     return mergeFunctionMetadata(func, retry_transaction_decorator)
 
 
@@ -94,4 +94,3 @@
         return ret
     return retry_transaction(mergeFunctionMetadata(
         func, write_transaction_decorator))
-

=== modified file 'lib/lp/services/database/debug.py'
--- lib/lp/services/database/debug.py	2011-12-30 06:14:56 +0000
+++ lib/lp/services/database/debug.py	2015-10-14 15:31:43 +0000
@@ -11,6 +11,7 @@
 
 import psycopg
 
+
 # From http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/279155
 def LN(*args, **kwargs):
     """Prints a line number and some text.
@@ -51,13 +52,14 @@
 class ConnectionWrapper(object):
     _log = None
     _real_con = None
+
     def __init__(self, real_con):
         self.__dict__['_log'] = \
                 logging.getLogger('lp.services.database.debug').debug
         self.__dict__['_real_con'] = real_con
 
     def __getattr__(self, key):
-        if key in ('rollback','close','commit'):
+        if key in ('rollback', 'close', 'commit'):
             print '%s %r.__getattr__(%r)' % (LN(), self, key)
             self.__dict__['_log']('__getattr__(%r)', key)
         return getattr(self._real_con, key)
@@ -67,6 +69,7 @@
         self.__dict__['_log']('__setattr__(%r, %r)', key, val)
         return setattr(self._real_con, key, val)
 
+
 _org_connect = None
 
 def debug_connect(*args, **kw):
@@ -78,15 +81,16 @@
     print '%s connect(*%r, **%r) == %r' % (LN(), args, kw, con)
     return con
 
+
 def install():
     global _org_connect
     assert _org_connect is None, 'Already installed'
     _org_connect = psycopg.connect
     psycopg.connect = debug_connect
 
+
 def uninstall():
     global _org_connect
     assert _org_connect is not None, 'Not installed'
     psycopg.connect = _org_connect
     _org_connect = None
-

=== modified file 'lib/lp/services/database/interfaces.py'
--- lib/lp/services/database/interfaces.py	2013-06-20 05:50:00 +0000
+++ lib/lp/services/database/interfaces.py	2015-10-14 15:31:43 +0000
@@ -30,8 +30,9 @@
     timed out.
     """
 
+
 # XXX 2007-02-09 jamesh:
-# This derrived from sqlos.interfaces.ISQLObject before hand.  I don't
+# This derived from sqlos.interfaces.ISQLObject before hand.  I don't
 # think it is ever used though ...
 class ISQLBase(Interface):
     """An extension of ISQLObject that provides an ID."""

=== modified file 'lib/lp/services/database/sort_sql.py'
--- lib/lp/services/database/sort_sql.py	2011-12-30 06:14:56 +0000
+++ lib/lp/services/database/sort_sql.py	2015-10-14 15:31:43 +0000
@@ -193,4 +193,3 @@
 
     if block:
         print_block(block)
-

=== modified file 'lib/lp/services/database/tests/__init__.py'
--- lib/lp/services/database/tests/__init__.py	2009-07-17 02:25:09 +0000
+++ lib/lp/services/database/tests/__init__.py	2015-10-14 15:31:43 +0000
@@ -5,4 +5,3 @@
 
 __metaclass__ = type
 __all__ = []
-

=== modified file 'lib/lp/services/database/tests/test_postgresql.py'
--- lib/lp/services/database/tests/test_postgresql.py	2011-12-30 06:20:00 +0000
+++ lib/lp/services/database/tests/test_postgresql.py	2015-10-14 15:31:43 +0000
@@ -10,7 +10,6 @@
 
 
 def setUp(test):
-
     # Build a fresh, empty database and connect
     test._db_fixture = PgTestSetup()
     test._db_fixture.setUp()
@@ -55,11 +54,13 @@
     test.globs['con'] = con
     test.globs['cur'] = cur
 
+
 def tearDown(test):
     test.globs['con'].close()
     test._db_fixture.tearDown()
     del test._db_fixture
 
+
 def test_suite():
     suite = DocTestSuite(
             "lp.services.database.postgresql",
@@ -67,4 +68,3 @@
             )
     suite.layer = BaseLayer
     return suite
-

=== modified file 'lib/lp/services/database/tests/test_sqlbase.py'
--- lib/lp/services/database/tests/test_sqlbase.py	2011-12-30 06:47:17 +0000
+++ lib/lp/services/database/tests/test_sqlbase.py	2015-10-14 15:31:43 +0000
@@ -13,7 +13,7 @@
 
 
 def test_suite():
-    optionflags = ELLIPSIS|NORMALIZE_WHITESPACE|REPORT_NDIFF
+    optionflags = ELLIPSIS | NORMALIZE_WHITESPACE | REPORT_NDIFF
     dt_suite = doctest.DocTestSuite(sqlbase, optionflags=optionflags)
     return unittest.TestSuite((dt_suite,))
 

=== modified file 'lib/lp/services/encoding.py'
--- lib/lp/services/encoding.py	2015-07-07 12:46:42 +0000
+++ lib/lp/services/encoding.py	2015-10-14 15:31:43 +0000
@@ -183,12 +183,14 @@
     hello \\xa9
     """
     nonascii_regex = re.compile(r'[\200-\377]')
+
     # By encoding the invalid ascii with a backslash, x, and then the
     # hex value, it makes it easy to decode it by pasting into a python
     # interpreter. quopri() is not used, since that could caused the
     # decoding of an email to fail.
     def quote(match):
         return '\\x%x' % ord(match.group(0))
+
     return nonascii_regex.sub(quote, bogus_string)
 
 

=== modified file 'lib/lp/services/feeds/feed.py'
--- lib/lp/services/feeds/feed.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/feeds/feed.py	2015-10-14 15:31:43 +0000
@@ -50,7 +50,7 @@
 
 
 SUPPORTED_FEEDS = ('.atom', '.html')
-MINUTES = 60 # Seconds in a minute.
+MINUTES = 60  # Seconds in a minute.
 
 
 @implementer(IFeed)
@@ -179,7 +179,7 @@
             return utc_now()
         last_modified = sorted_items[0].last_modified
         if last_modified is None:
-            raise AssertionError, 'All feed entries require a date updated.'
+            raise AssertionError('All feed entries require a date updated.')
         return last_modified
 
     def render(self):
@@ -247,7 +247,7 @@
         self.date_updated = date_updated
         self.date_published = date_published
         if date_updated is None:
-            raise AssertionError, 'date_updated is required by RFC 4287'
+            raise AssertionError('date_updated is required by RFC 4287')
         if authors is None:
             authors = []
         self.authors = authors

=== modified file 'lib/lp/services/feeds/interfaces/feed.py'
--- lib/lp/services/feeds/interfaces/feed.py	2013-01-07 02:40:55 +0000
+++ lib/lp/services/feeds/interfaces/feed.py	2015-10-14 15:31:43 +0000
@@ -209,7 +209,7 @@
                      "became public.")
 
     # The primary authors for the entry.
-    authors= Attribute(
+    authors = Attribute(
         "A list of IFeedPerson representing the authors for the entry.")
 
     # People who contributed to the entry.  The line between authors and
@@ -222,14 +222,14 @@
 
     # The logo representing the entry.
     # Not used and ignored.
-    logo  = TextLine(
+    logo = TextLine(
         title=u"Logo URL",
         description=u"The URL for the entry logo."
                      "Currently not used.")
 
     # The icon representing the entry.
     # Not used and ignored.
-    icon  = TextLine(
+    icon = TextLine(
         title=u"Icon URL",
         description=u"The URL for the entry icon."
                      "Currently not used.")
@@ -269,6 +269,7 @@
                      "i.e. 'http://code.launchpad.net'",
         required=False)
 
+
 class IFeedPerson(Interface):
     """Interface for a person in a feed."""
 

=== modified file 'lib/lp/services/feeds/tests/helper.py'
--- lib/lp/services/feeds/tests/helper.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/feeds/tests/helper.py	2015-10-14 15:31:43 +0000
@@ -54,6 +54,7 @@
 class ThingFeedView(LaunchpadView):
     usedfor = IThing
     feedname = "thing-feed"
+
     def __call__(self):
         return "a feed view on an IThing"
 
@@ -121,11 +122,11 @@
                 max_line_length = 66
                 wrapped_column_number = column_number % max_line_length
                 line_number_range = range(
-                    max(error_line_number-2, 1),
-                    min(error_line_number+3, len(lines)))
+                    max(error_line_number - 2, 1),
+                    min(error_line_number + 3, len(lines)))
                 for line_number in line_number_range:
                     unicode_line = unicode(
-                        lines[line_number-1], 'ascii', 'replace')
+                        lines[line_number - 1], 'ascii', 'replace')
                     ascii_line = unicode_line.encode('ascii', 'replace')
                     wrapped_lines = wrap(ascii_line, max_line_length)
                     if line_number == error_line_number:
@@ -135,7 +136,7 @@
                         point_list = ['~'] * max_line_length
                         point_list[wrapped_column_number] = '^'
                         point_string = ''.join(point_list)
-                        index = column_number/max_line_length + 1
+                        index = column_number / max_line_length + 1
                         wrapped_lines.insert(index, point_string)
                     errors.append(
                         "% 3d: %s" % (line_number,

=== modified file 'lib/lp/services/googlesearch/googletestservice.py'
--- lib/lp/services/googlesearch/googletestservice.py	2013-01-07 03:29:28 +0000
+++ lib/lp/services/googlesearch/googletestservice.py	2015-10-14 15:31:43 +0000
@@ -73,7 +73,7 @@
         message = ("%s - - [%s] %s" %
                    (self.address_string(),
                     self.log_date_time_string(),
-                    format%args))
+                    format % args))
         log.info(message)
 
 
@@ -103,7 +103,7 @@
         before returning False.
     """
     sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-    sock.settimeout(timeout) # Block for 'timeout' seconds.
+    sock.settimeout(timeout)  # Block for 'timeout' seconds.
     host, port = get_service_endpoint()
     try:
         try:
@@ -113,7 +113,7 @@
         else:
             return True
     finally:
-        sock.close() # Clean up.
+        sock.close()  # Clean up.
 
 
 def wait_for_service(timeout=15.0):
@@ -125,7 +125,7 @@
     """
     host, port = get_service_endpoint()
     sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-    sock.settimeout(timeout) # Block for at most X seconds.
+    sock.settimeout(timeout)  # Block for at most X seconds.
 
     start = time.time()  # Record when we started polling.
     try:
@@ -162,7 +162,7 @@
     try:
         while True:
             sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-            sock.settimeout(5.0) # Block for at most X seconds.
+            sock.settimeout(5.0)  # Block for at most X seconds.
             try:
                 sock.connect((host, port))
                 sock.close()
@@ -184,7 +184,7 @@
 
 def hostpair(url):
     """Parse the host and port number out of a URL string."""
-    parts  = urlsplit(url)
+    parts = urlsplit(url)
     host, port = parts[1].split(':')
     port = int(port)
     return (host, port)

=== modified file 'lib/lp/services/identity/adapters/account.py'
--- lib/lp/services/identity/adapters/account.py	2011-12-24 17:49:30 +0000
+++ lib/lp/services/identity/adapters/account.py	2015-10-14 15:31:43 +0000
@@ -23,4 +23,3 @@
         # we can return None here.
         ##return None
         raise ComponentLookupError
-

=== modified file 'lib/lp/services/inlinehelp/__init__.py'
--- lib/lp/services/inlinehelp/__init__.py	2009-06-25 04:06:00 +0000
+++ lib/lp/services/inlinehelp/__init__.py	2015-10-14 15:31:43 +0000
@@ -2,4 +2,3 @@
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Inline Help System"""
-

=== modified file 'lib/lp/services/job/model/job.py'
--- lib/lp/services/job/model/job.py	2015-07-29 08:31:06 +0000
+++ lib/lp/services/job/model/job.py	2015-10-14 15:31:43 +0000
@@ -279,7 +279,7 @@
         # This method can be called with two distinct types of Jobs:
         # - Jobs that are backed by a DB table with a foreign key onto Job.
         # - Jobs that have no backing, and are only represented by a row in
-        #   the Job table, but the class name we are given is the abstract 
+        #   the Job table, but the class name we are given is the abstract
         #   job class.
         # If there is no __storm_table__, it is the second type, and we have
         # to look it up via the Job table.

=== modified file 'lib/lp/services/librarian/model.py'
--- lib/lp/services/librarian/model.py	2015-07-09 20:06:17 +0000
+++ lib/lp/services/librarian/model.py	2015-10-14 15:31:43 +0000
@@ -24,7 +24,6 @@
     SQLRelatedJoin,
     StringCol,
     )
-from storm.exceptions import IntegrityError
 from storm.locals import (
     Date,
     Desc,

=== modified file 'lib/lp/services/librarian/tests/test_smoketest.py'
--- lib/lp/services/librarian/tests/test_smoketest.py	2015-10-05 06:34:17 +0000
+++ lib/lp/services/librarian/tests/test_smoketest.py	2015-10-14 15:31:43 +0000
@@ -70,7 +70,8 @@
         # Make sure that the function meant to store a file in the librarian
         # and return the file's HTTP URL works.
         aid, url = store_file(self.fake_librarian)
-        self.assertEqual('http://localhost:58000/%d/smoke-test-file' % aid, url)
+        self.assertEqual(
+            'http://localhost:58000/%d/smoke-test-file' % aid, url)
 
     def test_good_data(self):
         # If storing and retrieving both the public and private files work,

=== modified file 'lib/lp/services/librarian/utils.py'
--- lib/lp/services/librarian/utils.py	2015-05-07 09:54:51 +0000
+++ lib/lp/services/librarian/utils.py	2015-10-14 15:31:43 +0000
@@ -13,10 +13,10 @@
 import hashlib
 
 
-MEGABYTE = 1024*1024
-
-
-def filechunks(file, chunk_size=4*MEGABYTE):
+MEGABYTE = 1024 * 1024
+
+
+def filechunks(file, chunk_size=4 * MEGABYTE):
     """Return an iterator which reads chunks of the given file."""
     return iter(lambda: file.read(chunk_size), '')
 

=== modified file 'lib/lp/services/librarianserver/tests/test_doc.py'
--- lib/lp/services/librarianserver/tests/test_doc.py	2011-12-30 02:24:09 +0000
+++ lib/lp/services/librarianserver/tests/test_doc.py	2015-10-14 15:31:43 +0000
@@ -36,6 +36,7 @@
 
 class MockLibrary:
     file = None
+
     def startAddFile(self, name, size):
         self.file = MockFile(name)
         return self.file
@@ -85,11 +86,15 @@
     # Send tracebacks from Twisted to stderr, if they occur, to make debugging
     # test failures easier.
     import sys
+
+    from twisted.internet import defer
+    from twisted.python import log
+
     def log_observer(x):
         print >> sys.stderr, x
         if 'failure' in x:
             x['failure'].printTraceback(file=sys.stderr)
-    from twisted.python import log
+
     log.addObserver(log_observer)
 
     # Create a FileUploadProtocol, and instrument it for testing:
@@ -97,7 +102,6 @@
 
     #  * hook _storeFile to dispatch straight to newFile.store without
     #    spawning a thread.
-    from twisted.internet import defer
     server._storeFile = lambda: defer.maybeDeferred(server.newFile.store)
 
     #  * give it a fake transport
@@ -142,5 +146,6 @@
             ),
 }
 
+
 def test_suite():
     return build_test_suite(here, special)

=== modified file 'lib/lp/services/librarianserver/tests/test_storage.py'
--- lib/lp/services/librarianserver/tests/test_storage.py	2014-10-17 09:21:23 +0000
+++ lib/lp/services/librarianserver/tests/test_storage.py	2015-10-14 15:31:43 +0000
@@ -31,13 +31,17 @@
         self.committed = self.rolledback = False
         self.orig_commit = self.store.commit
         self.orig_rollback = self.store.rollback
+
         def commit():
             self.committed = True
             self.orig_commit()
+
         self.store.commit = commit
+
         def rollback():
             self.rolledback = True
             self.orig_rollback()
+
         self.store.rollback = rollback
 
     def tearDown(self):

=== modified file 'lib/lp/services/librarianserver/tests/test_web.py'
--- lib/lp/services/librarianserver/tests/test_web.py	2015-05-07 10:43:04 +0000
+++ lib/lp/services/librarianserver/tests/test_web.py	2015-10-14 15:31:43 +0000
@@ -71,7 +71,7 @@
         for count in range(10):
             # Upload a file.  This should work without any exceptions being
             # thrown.
-            sampleData = 'x' + ('blah' * (count%5))
+            sampleData = 'x' + ('blah' * (count % 5))
             fileAlias = client.addFile('sample', len(sampleData),
                                                  StringIO(sampleData),
                                                  contentType='text/plain')
@@ -177,7 +177,7 @@
 
         # Change the aliasid and assert we get a 404
         self.failUnless(str(aid) in url)
-        bad_id_url = uri_path_replace(url, str(aid), str(aid+1))
+        bad_id_url = uri_path_replace(url, str(aid), str(aid + 1))
         self.require404(bad_id_url)
 
         # Change the filename and assert we get a 404
@@ -243,7 +243,7 @@
         # restricted files are served from.
         client = LibrarianClient()
         fileAlias = client.addFile(
-            'sample', 12, StringIO('a'*12), contentType='text/plain')
+            'sample', 12, StringIO('a' * 12), contentType='text/plain')
         # Note: We're deliberately using the wrong url here: we should be
         # passing secure=True to getURLForAlias, but to use the returned URL
         # we would need a wildcard DNS facility patched into urlopen; instead
@@ -253,9 +253,9 @@
         url = client.getURLForAlias(fileAlias)
         # Now that we have a url which talks to the public librarian, make the
         # file restricted.
-        IMasterStore(LibraryFileAlias).find(LibraryFileAlias,
-            LibraryFileAlias.id==fileAlias).set(
-            LibraryFileAlias.restricted==True)
+        IMasterStore(LibraryFileAlias).find(
+            LibraryFileAlias, LibraryFileAlias.id == fileAlias).set(
+                restricted=True)
         self.commit()
         return fileAlias, url
 
@@ -263,9 +263,9 @@
         # IFF there is a .restricted. in the host, then the library file alias
         # in the subdomain must match that in the path.
         client = LibrarianClient()
-        fileAlias = client.addFile('sample', 12, StringIO('a'*12),
+        fileAlias = client.addFile('sample', 12, StringIO('a' * 12),
             contentType='text/plain')
-        fileAlias2 = client.addFile('sample', 12, StringIO('b'*12),
+        fileAlias2 = client.addFile('sample', 12, StringIO('b' * 12),
             contentType='text/plain')
         self.commit()
         url = client.getURLForAlias(fileAlias)
@@ -329,7 +329,7 @@
         # Now we should be able to access the file.
         fileObj = urlopen(url)
         try:
-            self.assertEqual("a"*12, fileObj.read())
+            self.assertEqual("a" * 12, fileObj.read())
         finally:
             fileObj.close()
 

=== modified file 'lib/lp/services/limitedlist.py'
--- lib/lp/services/limitedlist.py	2010-03-22 14:10:42 +0000
+++ lib/lp/services/limitedlist.py	2015-10-14 15:31:43 +0000
@@ -6,6 +6,7 @@
     'LimitedList',
     ]
 
+
 class LimitedList(list):
     """A mutable sequence that takes a limited number of elements."""
 

=== modified file 'lib/lp/services/mail/stub.py'
--- lib/lp/services/mail/stub.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/mail/stub.py	2015-10-14 15:31:43 +0000
@@ -54,6 +54,8 @@
 
 
 test_emails = []
+
+
 @implementer(IMailer)
 class TestMailer:
     """

=== modified file 'lib/lp/services/mail/tests/helpers.py'
--- lib/lp/services/mail/tests/helpers.py	2011-08-12 15:57:11 +0000
+++ lib/lp/services/mail/tests/helpers.py	2015-10-14 15:31:43 +0000
@@ -14,6 +14,7 @@
 
 testmails_path = os.path.join(os.path.dirname(__file__), 'emails')
 
+
 def read_test_message(filename):
     """Reads a test message and returns it as ISignedMessage.
 

=== modified file 'lib/lp/services/mail/tests/test_stub.py'
--- lib/lp/services/mail/tests/test_stub.py	2015-03-13 19:05:50 +0000
+++ lib/lp/services/mail/tests/test_stub.py	2015-10-14 15:31:43 +0000
@@ -108,6 +108,7 @@
 
     """
 
+
 def test_suite():
     suite = DocTestSuite(checker=RENormalizing([
         (re.compile(r'Revision="\d+"'), 'Revision="1999"')]))

=== modified file 'lib/lp/services/mailman/monkeypatches/defaults.py'
--- lib/lp/services/mailman/monkeypatches/defaults.py	2013-01-07 02:40:55 +0000
+++ lib/lp/services/mailman/monkeypatches/defaults.py	2015-10-14 15:31:43 +0000
@@ -16,20 +16,20 @@
 
 # Disable runners for features we don't need.
 QRUNNERS = [
-    ('ArchRunner',     1), # messages for the archiver
-    ('BounceRunner',   1), # for processing the qfile/bounces directory
-##     ('CommandRunner',  1), # commands and bounces from the outside world
-    ('IncomingRunner', 1), # posts from the outside world
-##     ('NewsRunner',     1), # outgoing messages to the nntpd
-    ('OutgoingRunner', 1), # outgoing messages to the smtpd
-    ('VirginRunner',   1), # internally crafted (virgin birth) messages
-    ('RetryRunner',    1), # retry temporarily failed deliveries
+    ('ArchRunner',     1),  # messages for the archiver
+    ('BounceRunner',   1),  # for processing the qfile/bounces directory
+##     ('CommandRunner',  1),  # commands and bounces from the outside world
+    ('IncomingRunner', 1),  # posts from the outside world
+##     ('NewsRunner',     1),  # outgoing messages to the nntpd
+    ('OutgoingRunner', 1),  # outgoing messages to the smtpd
+    ('VirginRunner',   1),  # internally crafted (virgin birth) messages
+    ('RetryRunner',    1),  # retry temporarily failed deliveries
     # Non-standard runners we've added.
-    ('XMLRPCRunner',   1), # Poll for XMLRPC requests
+    ('XMLRPCRunner',   1),  # Poll for XMLRPC requests
     ]
 
 # Other list defaults.
-DEFAULT_GENERIC_NONMEMBER_ACTION = 3 # Discard
+DEFAULT_GENERIC_NONMEMBER_ACTION = 3  # Discard
 DEFAULT_SEND_REMINDERS = No
 DEFAULT_SEND_WELCOME_MSG = Yes
 DEFAULT_SEND_GOODBYE_MSG = No

=== modified file 'lib/lp/services/mailman/runmailman.py'
--- lib/lp/services/mailman/runmailman.py	2012-06-29 08:40:05 +0000
+++ lib/lp/services/mailman/runmailman.py	2015-10-14 15:31:43 +0000
@@ -117,7 +117,6 @@
     # We need the Mailman bin directory so we can run some of Mailman's
     # command line scripts.
     mailman_path = configure_prefix(config.mailman.build_prefix)
-    mailman_bin = os.path.join(mailman_path, 'bin')
 
     # Monkey-patch the installed Mailman 2.1 tree.
     monkey_patch(mailman_path, config)

=== modified file 'lib/lp/services/mailman/tests/test_lphandler.py'
--- lib/lp/services/mailman/tests/test_lphandler.py	2013-01-03 17:42:59 +0000
+++ lib/lp/services/mailman/tests/test_lphandler.py	2015-10-14 15:31:43 +0000
@@ -61,7 +61,7 @@
     def test_messages_from_launchpad_users_are_accepted(self):
         # A message from a launchpad user is accepted.
         lp_user_email = 'chinchila@xxxxxx'
-        lp_user = self.factory.makePerson(email=lp_user_email)
+        self.factory.makePerson(email=lp_user_email)
         message = self.makeMailmanMessage(
             self.mm_list, lp_user_email, 'subject', 'any content.')
         msg_data = {}
@@ -86,7 +86,7 @@
         # When the Launchpad xmlrpc proxy raises an error, the message
         # is re-enqueed.
         lp_user_email = 'groundhog@xxxxxx'
-        lp_user = self.factory.makePerson(email=lp_user_email)
+        self.factory.makePerson(email=lp_user_email)
         message = self.makeMailmanMessage(
             self.mm_list, lp_user_email, 'subject', 'any content.')
         msg_data = {}

=== modified file 'lib/lp/services/memcache/interfaces.py'
--- lib/lp/services/memcache/interfaces.py	2010-08-20 20:31:18 +0000
+++ lib/lp/services/memcache/interfaces.py	2015-10-14 15:31:43 +0000
@@ -11,4 +11,3 @@
 
 class IMemcacheClient(Interface):
     """Interface to lookup an initialized memcache.Client instance."""
-

=== modified file 'lib/lp/services/messaging/tests/test_rabbit.py'
--- lib/lp/services/messaging/tests/test_rabbit.py	2013-04-11 00:31:42 +0000
+++ lib/lp/services/messaging/tests/test_rabbit.py	2015-10-14 15:31:43 +0000
@@ -130,9 +130,11 @@
         session = self.session_factory()
         session.connect()
         old_close = session._connection.close
+
         def new_close(*args, **kwargs):
             old_close(*args, **kwargs)
             raise socket.error
+
         with monkey_patch(session._connection, close=new_close):
             session.disconnect()
             self.assertFalse(session.is_connected)

=== modified file 'lib/lp/services/oauth/tests/test_tokens.py'
--- lib/lp/services/oauth/tests/test_tokens.py	2015-01-29 11:58:57 +0000
+++ lib/lp/services/oauth/tests/test_tokens.py	2015-10-14 15:31:43 +0000
@@ -18,7 +18,6 @@
 from zope.security.interfaces import Unauthorized
 from zope.security.proxy import removeSecurityProxy
 
-from lp.services.features.testing import FeatureFixture
 from lp.services.oauth.interfaces import (
     IOAuthAccessToken,
     IOAuthConsumer,

=== modified file 'lib/lp/services/openid/interfaces/openid.py'
--- lib/lp/services/openid/interfaces/openid.py	2010-08-20 20:31:18 +0000
+++ lib/lp/services/openid/interfaces/openid.py	2015-10-14 15:31:43 +0000
@@ -24,5 +24,3 @@
         'The OpenID identity URL for the user.')
     openid_identifier = Attribute(
         'The OpenID identifier used with the request.')
-
-

=== modified file 'lib/lp/services/openid/tests/test_openid.py'
--- lib/lp/services/openid/tests/test_openid.py	2010-08-20 20:31:18 +0000
+++ lib/lp/services/openid/tests/test_openid.py	2015-10-14 15:31:43 +0000
@@ -12,5 +12,6 @@
 
 here = os.path.dirname(os.path.realpath(__file__))
 
+
 def test_suite():
     return build_test_suite(here)

=== modified file 'lib/lp/services/privacy/adapters.py'
--- lib/lp/services/privacy/adapters.py	2011-12-30 08:03:42 +0000
+++ lib/lp/services/privacy/adapters.py	2015-10-14 15:31:43 +0000
@@ -21,4 +21,3 @@
             self.is_private = removeSecurityProxy(object).private
         except AttributeError:
             self.is_private = False
-

=== modified file 'lib/lp/services/profile/mem.py'
--- lib/lp/services/profile/mem.py	2013-01-07 03:21:35 +0000
+++ lib/lp/services/profile/mem.py	2015-10-14 15:31:43 +0000
@@ -41,8 +41,9 @@
 
 _proc_status = '/proc/%d/status' % os.getpid()
 
-_scale = {'kB': 1024.0, 'mB': 1024.0*1024.0,
-          'KB': 1024.0, 'MB': 1024.0*1024.0}
+_scale = {'kB': 1024.0, 'mB': 1024.0 * 1024.0,
+          'KB': 1024.0, 'MB': 1024.0 * 1024.0}
+
 
 def _VmB(VmKey):
     '''Private.
@@ -103,6 +104,7 @@
             s = s[:80]
         print type(x), "\n  ", s
 
+
 # This is spiv's reference count code, under 'MIT Licence if I'm pressed'.
 #
 
@@ -185,6 +187,7 @@
         else:
             file.write("%s %s\n" % (c, obj))
 
+
 def readCounts(file, marker=None):
     """Reverse of printCounts().
 
@@ -204,7 +207,7 @@
 
 
 def logInThread(n=30):
-    reflog = file('/tmp/refs.log','w')
+    reflog = file('/tmp/refs.log', 'w')
     t = threading.Thread(target=_logRefsEverySecond, args=(reflog, n))
     # Allow process to exit without explicitly stopping thread.
     t.setDaemon(True)
@@ -233,4 +236,3 @@
 
     # show the dirt ;-)
     dump_garbage()
-

=== modified file 'lib/lp/services/salesforce/proxy.py'
--- lib/lp/services/salesforce/proxy.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/salesforce/proxy.py	2015-10-14 15:31:43 +0000
@@ -99,6 +99,7 @@
         """Get the proxy URL with port."""
         return "%s:%d" % (config.commercial.voucher_proxy_url,
                           config.commercial.voucher_proxy_port)
+
     @property
     def server(self):
         """See `ISalesforceVoucherProxy`."""

=== modified file 'lib/lp/services/salesforce/tests/proxy.py'
--- lib/lp/services/salesforce/tests/proxy.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/salesforce/tests/proxy.py	2015-10-14 15:31:43 +0000
@@ -134,7 +134,6 @@
                     'rPwGRk4'),
             ]
 
-
     def _createVoucher(self, owner_oid, term_months):
         """Create a new voucher with the given term and owner."""
         self.voucher_index += 1

=== modified file 'lib/lp/services/scripts/tests/test_logger.py'
--- lib/lp/services/scripts/tests/test_logger.py	2012-01-01 02:58:52 +0000
+++ lib/lp/services/scripts/tests/test_logger.py	2015-10-14 15:31:43 +0000
@@ -35,7 +35,7 @@
         traceback_info("Captain Kirk")
 
         try:
-            0/0
+            0 / 0
         except ZeroDivisionError:
             info = exc_info()
 

=== modified file 'lib/lp/services/searchbuilder.py'
--- lib/lp/services/searchbuilder.py	2011-12-23 17:05:14 +0000
+++ lib/lp/services/searchbuilder.py	2015-10-14 15:31:43 +0000
@@ -12,18 +12,22 @@
 # constants for use in search criteria
 NULL = "NULL"
 
+
 class all:
     def __init__(self, *query_values):
         self.query_values = query_values
 
+
 class any:
     def __init__(self, *query_values):
         self.query_values = query_values
 
+
 class not_equals:
     def __init__(self, value):
         self.value = value
 
+
 class greater_than:
     """Greater than value."""
 

=== modified file 'lib/lp/services/statistics/interfaces/statistic.py'
--- lib/lp/services/statistics/interfaces/statistic.py	2013-01-07 02:40:55 +0000
+++ lib/lp/services/statistics/interfaces/statistic.py	2015-10-14 15:31:43 +0000
@@ -55,4 +55,3 @@
 
     def updateStatistics(ztm):
         """Update the statistics in the system."""
-

=== modified file 'lib/lp/services/temporaryblobstorage/browser.py'
--- lib/lp/services/temporaryblobstorage/browser.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/temporaryblobstorage/browser.py	2015-10-14 15:31:43 +0000
@@ -64,7 +64,7 @@
         except BlobTooLarge:
             self.addError('Uploaded file was too large.')
             return None
-        except UploadFailed as e:
+        except UploadFailed:
             self.addError('File storage unavailable - try again later.')
             return None
         else:

=== modified file 'lib/lp/services/temporaryblobstorage/model.py'
--- lib/lp/services/temporaryblobstorage/model.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/temporaryblobstorage/model.py	2015-10-14 15:31:43 +0000
@@ -39,7 +39,7 @@
 class TemporaryBlobStorage(SQLBase):
     """A temporary BLOB stored in Launchpad."""
 
-    _table='TemporaryBlobStorage'
+    _table = 'TemporaryBlobStorage'
 
     uuid = StringCol(notNull=True, alternateID=True)
     file_alias = ForeignKey(
@@ -82,9 +82,10 @@
             return None
         if 'processed_data' not in job_for_blob.metadata:
             return {}
-        
+
         return job_for_blob.metadata['processed_data']
 
+
 @implementer(ITemporaryStorageManager)
 class TemporaryStorageManager:
     """A tool to create temporary BLOB's in Launchpad."""

=== modified file 'lib/lp/services/testing/doctestcodec.py'
--- lib/lp/services/testing/doctestcodec.py	2011-12-30 05:52:12 +0000
+++ lib/lp/services/testing/doctestcodec.py	2015-10-14 15:31:43 +0000
@@ -58,4 +58,3 @@
 
 codecs.register_error('doctest', doctest_unicode_error_handler)
 codecs.register(doctest_unicode_search)
-

=== modified file 'lib/lp/services/testing/parallel.py'
--- lib/lp/services/testing/parallel.py	2012-04-16 23:02:44 +0000
+++ lib/lp/services/testing/parallel.py	2015-10-14 15:31:43 +0000
@@ -48,7 +48,7 @@
         if arg.startswith('--load-list='):
             load_list = arg[len('--load-list='):]
         if arg == '--load-list':
-            load_list = args[pos+1]
+            load_list = args[pos + 1]
     return load_list
 
 
@@ -86,7 +86,7 @@
     test.run(result)
     process.wait()
     if process.returncode:
-        raise Exception('error listing tests: %s' % err)
+        raise Exception('error listing tests: %s' % process.returncode)
     return result.ids
 
 
@@ -107,7 +107,8 @@
             for test_id in self._test_ids:
                 test_list_file.write(test_id + '\n')
             test_list_file.flush()
-            argv = self._args + ['--subunit', '--load-list', test_list_file.name]
+            argv = self._args + [
+                '--subunit', '--load-list', test_list_file.name]
             process = subprocess.Popen(argv, stdin=subprocess.PIPE,
                 stdout=subprocess.PIPE, bufsize=1)
             try:
@@ -121,7 +122,7 @@
 
 def concurrency():
     """Return the number of current tests we should run on this machine.
-    
+
     Each test is run in its own process, and we assume that the optimal number
     is one per core.
     """
@@ -138,7 +139,8 @@
     # just one partition.  So the slowest partition shouldn't be much slower
     # than the fastest.
     partitions = [list() for i in range(count)]
-    for partition, test_id in itertools.izip(itertools.cycle(partitions), test_ids):
+    for partition, test_id in itertools.izip(
+            itertools.cycle(partitions), test_ids):
         partition.append(test_id)
     return partitions
 
@@ -147,13 +149,17 @@
     """CLI entry point to adapt a test run to parallel testing."""
     child_args = prepare_argv(argv)
     test_ids = find_tests(argv)
+
     # We could create a proxy object per test id if desired in future)
     def parallelise_tests(suite):
         test_ids = list(suite)[0]._test_ids
         count = concurrency()
         partitions = partition_tests(test_ids, count)
-        return [ListTestCase(partition, child_args) for partition in partitions]
-    suite = ConcurrentTestSuite(ListTestCase(test_ids, None), parallelise_tests)
+        return [
+            ListTestCase(partition, child_args) for partition in partitions]
+
+    suite = ConcurrentTestSuite(
+        ListTestCase(test_ids, None), parallelise_tests)
     if '--subunit' in argv:
         runner = SubunitTestRunner(sys.stdout)
         result = runner.run(suite)
@@ -168,4 +174,3 @@
     if result.wasSuccessful():
         return 0
     return -1
-

=== modified file 'lib/lp/services/testing/profiled.py'
--- lib/lp/services/testing/profiled.py	2012-01-01 03:00:09 +0000
+++ lib/lp/services/testing/profiled.py	2015-10-14 15:31:43 +0000
@@ -16,6 +16,7 @@
 _profile_stats_filename = os.environ.get('lp_layer_profile_filename', None)
 _profiling_setup_time = None
 
+
 def profiled(func):
     """Decorator that automatically profiles invocations of the method."""
     def profiled_func(cls, *args, **kw):
@@ -72,9 +73,8 @@
     stats[key] = (hits + 1, total_duration + duration)
 
     # Dump stats back to disk, making sure we flush
-    outf = open(_profile_stats_filename, 'wb')
-    pickle.dump(stats, outf, pickle.HIGHEST_PROTOCOL)
-    outf.close() # and flush
+    with open(_profile_stats_filename, 'wb') as outf:
+        pickle.dump(stats, outf, pickle.HIGHEST_PROTOCOL)
 
 
 def report_profile_stats():
@@ -104,4 +104,3 @@
     print
     print "Total duration of test run %0.1f seconds." % (
             time.time() - _profiling_setup_time)
-

=== modified file 'lib/lp/services/tests/test_browser_helpers.py'
--- lib/lp/services/tests/test_browser_helpers.py	2013-01-07 02:40:55 +0000
+++ lib/lp/services/tests/test_browser_helpers.py	2015-10-14 15:31:43 +0000
@@ -36,5 +36,6 @@
         self.failUnless(version is None,
                         "None should be returned when the match fails.")
 
+
 def test_suite():
     return unittest.TestLoader().loadTestsFromName(__name__)

=== modified file 'lib/lp/services/tests/test_osutils.py'
--- lib/lp/services/tests/test_osutils.py	2013-01-03 00:27:37 +0000
+++ lib/lp/services/tests/test_osutils.py	2015-10-14 15:31:43 +0000
@@ -5,9 +5,7 @@
 
 __metaclass__ = type
 
-import errno
 import os
-import socket
 import tempfile
 
 from testtools.matchers import FileContains

=== modified file 'lib/lp/services/tests/test_timeout.py'
--- lib/lp/services/tests/test_timeout.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/tests/test_timeout.py	2015-10-14 15:31:43 +0000
@@ -6,7 +6,6 @@
 
 __metaclass__ = type
 
-from cStringIO import StringIO
 from SimpleXMLRPCServer import (
     SimpleXMLRPCRequestHandler,
     SimpleXMLRPCServer,
@@ -14,13 +13,9 @@
 import socket
 from textwrap import dedent
 import threading
-import time
 import urllib2
 import xmlrpclib
 
-from zope.interface import implementer
-
-from lp.services.log.logger import FakeLogger
 from lp.services.timeout import (
     get_default_timeout_function,
     set_default_timeout_function,
@@ -30,11 +25,11 @@
     with_timeout,
     )
 from lp.testing import TestCase
-from lp.testing.layers import BaseLayer
 
 
 @with_timeout()
-def no_default_timeout(): pass
+def no_default_timeout():
+    pass
 
 
 class EchoOrWaitXMLRPCReqHandler(SimpleXMLRPCRequestHandler):
@@ -54,10 +49,12 @@
 class MySimpleXMLRPCServer(SimpleXMLRPCServer):
     """Create a simple XMLRPC server to listen for requests."""
     allow_reuse_address = True
+
     def serve_2_requests(self):
         for i in range(2):
             self.handle_request()
         self.server_close()
+
     def handle_error(self, request, address):
         pass
 
@@ -69,11 +66,13 @@
         finishes before the supplied timeout, it should function normally.
         """
         wait_evt = threading.Event()
+
         @with_timeout(timeout=0.5)
         def wait_100ms():
             """Function that waits for a supplied number of seconds."""
             wait_evt.wait(0.1)
             return "Succeeded."
+
         self.assertEqual("Succeeded.", wait_100ms())
 
     def test_timeout_overrun(self):
@@ -87,11 +86,13 @@
         # inform us that it is about to exit.
         wait_evt = threading.Event()
         stopping_evt = threading.Event()
+
         @with_timeout(timeout=0.5)
         def wait_for_event():
             """Function that waits for a supplied number of seconds."""
             wait_evt.wait()
             stopping_evt.set()
+
         self.assertRaises(TimeoutError, wait_for_event)
         wait_evt.set()
         stopping_evt.wait()
@@ -115,6 +116,7 @@
         socket.setdefaulttimeout(5)
         sockets = socket.socketpair()
         closed = []
+
         def close_socket():
             closed.append(True)
             sockets[0].shutdown(socket.SHUT_RDWR)
@@ -123,6 +125,7 @@
         def block():
             """This will block indefinitely."""
             sockets[0].recv(1024)
+
         self.assertRaises(TimeoutError, block)
         self.assertEqual([True], closed)
 
@@ -152,16 +155,18 @@
         method."""
         def do_definition():
             @with_timeout(cleanup='not_a_method', timeout=0.5)
-            def a_function(): pass
+            def a_function():
+                pass
+
         self.assertRaises(TypeError, do_definition)
 
     def test_timeout_uses_default(self):
-        """If the timeout parameter isn't provided, it will default to the value
-        returned by the function installed as "default_timeout_function". A
-        function is used because it's useful for the timeout value to be
-        determined dynamically. For example, if you want to limit the
-        overall processing to 30s and you already did 14s, you want that timeout
-        to be 16s.
+        """If the timeout parameter isn't provided, it will default to the
+        value returned by the function installed as
+        "default_timeout_function". A function is used because it's useful
+        for the timeout value to be determined dynamically. For example, if
+        you want to limit the overall processing to 30s and you already did
+        14s, you want that timeout to be 16s.
 
         By default, there is no default_timeout_function.
         """
@@ -177,13 +182,15 @@
             str(e))
 
     def test_set_default_timeout(self):
-        """the set_default_timeout_function() takes a function that should return
-        the number of seconds to wait.
+        """The set_default_timeout_function() takes a function that should
+        return the number of seconds to wait.
         """
         using_default = []
+
         def my_default_timeout():
             using_default.append(True)
             return 1
+
         set_default_timeout_function(my_default_timeout)
         self.addCleanup(set_default_timeout_function, None)
         no_default_timeout()
@@ -237,6 +244,7 @@
         sock, http_server_url = self.make_test_socket()
         sock.listen(1)
         stop_event = threading.Event()
+
         def slow_reply():
             (client_sock, client_addr) = sock.accept()
             content = 'You are veeeeryyy patient!'
@@ -252,12 +260,15 @@
                 if stop_event.wait(0.05):
                     break
             client_sock.close()
+
         slow_thread = threading.Thread(target=slow_reply)
         slow_thread.start()
         saved_threads = set(threading.enumerate())
         self.assertRaises(TimeoutError, urlfetch, http_server_url)
-        # Note that the cleanup also takes care of leaving no worker thread behind.
-        remaining_threads = set(threading.enumerate()).difference(saved_threads)
+        # Note that the cleanup also takes care of leaving no worker thread
+        # behind.
+        remaining_threads = set(threading.enumerate()).difference(
+            saved_threads)
         self.assertEqual(set(), remaining_threads)
         stop_event.set()
         slow_thread.join()
@@ -266,6 +277,7 @@
         """When the request succeeds, the result content is returned."""
         sock, http_server_url = self.make_test_socket()
         sock.listen(1)
+
         def success_result():
             (client_sock, client_addr) = sock.accept()
             client_sock.sendall(dedent("""\
@@ -275,6 +287,7 @@
 
                 Success."""))
             client_sock.close()
+
         t = threading.Thread(target=success_result)
         t.start()
         self.assertEqual('Success.', urlfetch(http_server_url))

=== modified file 'lib/lp/services/tests/test_vocabularies.py'
--- lib/lp/services/tests/test_vocabularies.py	2012-01-01 02:58:52 +0000
+++ lib/lp/services/tests/test_vocabularies.py	2015-10-14 15:31:43 +0000
@@ -9,7 +9,6 @@
 from zope.component import getUtilitiesFor
 from zope.proxy import isProxy
 from zope.schema.interfaces import IVocabularyFactory
-from zope.security._proxy import _Proxy
 
 from lp.testing import TestCase
 from lp.testing.layers import FunctionalLayer

=== modified file 'lib/lp/services/timeline/requesttimeline.py'
--- lib/lp/services/timeline/requesttimeline.py	2011-12-24 17:49:30 +0000
+++ lib/lp/services/timeline/requesttimeline.py	2015-10-14 15:31:43 +0000
@@ -14,7 +14,7 @@
 
 # XXX RobertCollins 2010-09-01 bug=623199: Undesirable but pragmatic.
 # Because of this bug, rather than using request.annotations we have
-# to work in with the webapp.adapter request model, which is 
+# to work in with the webapp.adapter request model, which is
 # different to that used by get_current_browser_request.
 from lp.services import webapp
 

=== modified file 'lib/lp/services/twistedsupport/processmonitor.py'
--- lib/lp/services/twistedsupport/processmonitor.py	2010-09-24 11:29:44 +0000
+++ lib/lp/services/twistedsupport/processmonitor.py	2015-10-14 15:31:43 +0000
@@ -214,8 +214,8 @@
         """Construct an instance of the protocol, for listening to a worker.
 
         :param deferred: Passed to `ProcessMonitorProtocol.__init__`.
-        :param timeout: The subprocess will be killed after this many seconds of
-            inactivity.
+        :param timeout: The subprocess will be killed after this many
+            seconds of inactivity.
         :param clock: Passed to `ProcessMonitorProtocol.__init__`.
         """
         ProcessMonitorProtocol.__init__(self, deferred, clock)
@@ -333,4 +333,3 @@
             self._deferred.errback((out, err, code))
         else:
             self._deferred.callback((out, err, code))
-

=== modified file 'lib/lp/services/twistedsupport/task.py'
--- lib/lp/services/twistedsupport/task.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/twistedsupport/task.py	2015-10-14 15:31:43 +0000
@@ -169,11 +169,13 @@
                 task_consumer.taskStarted(task)
             else:
                 task_consumer.noTasksFound()
+
         def task_failed(reason):
             # If task production fails, we inform the consumer of this, but we
             # don't let any deferred it returns delay subsequent polls.
             self._log_state('task_failed', reason)
             task_consumer.taskProductionFailed(reason)
+
         def poll():
             # If stop() has been called before the lock was acquired, don't
             # actually poll for more work.
@@ -182,6 +184,7 @@
                 d = defer.maybeDeferred(self._task_producer)
                 return d.addCallbacks(got_task, task_failed).addBoth(
                     lambda ignored: self._log_state('releasing_poll'))
+
         self._log_state('_poll')
         return self._polling_lock.run(poll).addBoth(
             lambda ignored: self._log_state('released_poll'))
@@ -190,9 +193,11 @@
         """See `ITaskSource`."""
         self._log_state('stop')
         self._clear_looping_call('called from stop()')
+
         def _return_still_stopped():
             self._log_state('_return_still_stopped')
             return self._looping_call is None
+
         return self._polling_lock.run(_return_still_stopped)
 
 
@@ -244,6 +249,7 @@
         def _call_stop(ignored):
             self._log_state('_stop', 'Got lock, stopping source')
             return self._task_source.stop()
+
         def _release_or_stop(still_stopped):
             self._log_state('_stop', 'stop() returned %s' % (still_stopped,))
             if still_stopped and self._worker_count == 0:
@@ -254,6 +260,7 @@
             else:
                 self._logger.debug('Releasing lock')
                 self._stopping_lock.release()
+
         self._log_state('_stop', 'Acquiring lock')
         d = self._stopping_lock.acquire()
         d.addCallback(_call_stop)

=== modified file 'lib/lp/services/twistedsupport/tests/test_gracefulshutdown.py'
--- lib/lp/services/twistedsupport/tests/test_gracefulshutdown.py	2011-12-19 23:38:16 +0000
+++ lib/lp/services/twistedsupport/tests/test_gracefulshutdown.py	2015-10-14 15:31:43 +0000
@@ -34,8 +34,10 @@
         self.assertTrue(ctf.isAvailable())
         ctf.stopFactory()
         self.assertFalse(ctf.isAvailable())
+
         def cb(ignored):
             self.was_fired = True
+
         ctf.allConnectionsGone.addCallback(cb)
         self.assertTrue(self.was_fired)
 
@@ -50,8 +52,10 @@
         ctf.registerProtocol(p)
         ctf.stopFactory()
         self.was_fired = False
+
         def cb(ignored):
             self.was_fired = True
+
         ctf.allConnectionsGone.addCallback(cb)
         self.assertFalse(self.was_fired)
         ctf.unregisterProtocol(p)
@@ -70,8 +74,10 @@
         ctf.registerProtocol(p2)
         ctf.stopFactory()
         self.was_fired = False
+
         def cb(ignored):
             self.was_fired = True
+
         ctf.allConnectionsGone.addCallback(cb)
         self.assertFalse(self.was_fired)
         ctf.unregisterProtocol(p1)
@@ -86,7 +92,7 @@
         ctf = gracefulshutdown.ConnTrackingFactoryWrapper(Factory())
         p = Protocol()
         ctf.registerProtocol(p)
-        ctf.unregisterProtocol(p) # No error raised.
+        ctf.unregisterProtocol(p)  # No error raised.
 
 
 class TestServerAvailableResource(TestCase):
@@ -202,8 +208,10 @@
         service2.setServiceParent(oms)
         oms.startService()
         self.all_stopped = False
+
         def cb_all_stopped(ignored):
             self.all_stopped = True
+
         oms.stopService().addCallback(cb_all_stopped)
         self.assertFalse(self.all_stopped)
         self.assertFalse(service1.stop_called)

=== modified file 'lib/lp/services/twistedsupport/tests/test_processmonitor.py'
--- lib/lp/services/twistedsupport/tests/test_processmonitor.py	2013-01-07 02:40:55 +0000
+++ lib/lp/services/twistedsupport/tests/test_processmonitor.py	2015-10-14 15:31:43 +0000
@@ -124,7 +124,7 @@
         self.protocol.transport.exited = True
 
         # Without catching the ProcessExitedAlready this will blow up.
-        self.clock.advance(self.TIMEOUT+1)
+        self.clock.advance(self.TIMEOUT + 1)
 
         # At this point, processEnded is yet to be called so the
         # Deferred has not fired.  Ideally it would be nice to test for
@@ -238,7 +238,7 @@
         # is not called until any deferred returned by the first one fires.
         deferred = defer.Deferred()
         calls = []
-        self.protocol.runNotification(lambda : deferred)
+        self.protocol.runNotification(lambda: deferred)
         self.protocol.runNotification(calls.append, 'called')
         self.assertEqual(calls, [])
         deferred.callback(None)
@@ -251,7 +251,7 @@
         # in the mean time are not run.
         deferred = defer.Deferred()
         calls = []
-        self.protocol.runNotification(lambda : deferred)
+        self.protocol.runNotification(lambda: deferred)
         self.protocol.runNotification(calls.append, 'called')
         self.assertEqual(calls, [])
         deferred.errback(makeFailure(RuntimeError))
@@ -263,7 +263,7 @@
         # Don't fire the termination deferred until all notifications are
         # complete, even if the process has died.
         deferred = defer.Deferred()
-        self.protocol.runNotification(lambda : deferred)
+        self.protocol.runNotification(lambda: deferred)
         self.simulateProcessExit()
         notificaion_pending = True
         self.termination_deferred.addCallback(
@@ -277,7 +277,7 @@
         # notification subsequently fails, the notification's failure is
         # passed on to the termination deferred.
         deferred = defer.Deferred()
-        self.protocol.runNotification(lambda : deferred)
+        self.protocol.runNotification(lambda: deferred)
         self.simulateProcessExit()
         deferred.errback(makeFailure(RuntimeError))
         return assert_fails_with(
@@ -290,7 +290,7 @@
         # fails, the ProcessTerminated is still passed on to the
         # termination deferred.
         deferred = defer.Deferred()
-        self.protocol.runNotification(lambda : deferred)
+        self.protocol.runNotification(lambda: deferred)
         self.simulateProcessExit(clean=False)
         runtime_error_failure = makeFailure(RuntimeError)
         deferred.errback(runtime_error_failure)
@@ -305,7 +305,7 @@
         # notification subsequently fails, the first failure "wins" and is
         # passed on to the termination deferred.
         deferred = defer.Deferred()
-        self.protocol.runNotification(lambda : deferred)
+        self.protocol.runNotification(lambda: deferred)
         self.protocol.unexpectedError(makeFailure(TypeError))
         runtime_error_failure = makeFailure(RuntimeError)
         deferred.errback(runtime_error_failure)
@@ -345,7 +345,7 @@
     def test_processExitingResetsTimeout(self):
         # When the process exits, the timeout is reset.
         deferred = defer.Deferred()
-        self.protocol.runNotification(lambda : deferred)
+        self.protocol.runNotification(lambda: deferred)
         self.clock.advance(self.timeout - 1)
         self.simulateProcessExit()
         self.clock.advance(2)
@@ -368,8 +368,10 @@
         # On success, i.e process succeeded before the specified timeout,
         # callback is fired with 'None'.
         d = run_process_with_timeout(('true',))
+
         def check_success_result(result):
             self.assertEquals(result, None, "Success result is not None.")
+
         d.addCallback(check_success_result)
         return d
 

=== modified file 'lib/lp/services/twistedsupport/tests/test_task.py'
--- lib/lp/services/twistedsupport/tests/test_task.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/twistedsupport/tests/test_task.py	2015-10-14 15:31:43 +0000
@@ -119,8 +119,10 @@
         class NoTasksFoundCountingConsumer:
             def __init__(self):
                 self._noTasksFound_calls = 0
+
             def noTasksFound(self):
                 self._noTasksFound_calls += 1
+
         task_source = self.makeTaskSource(task_producer=lambda: None)
         consumer = NoTasksFoundCountingConsumer()
         task_source.start(consumer)
@@ -236,10 +238,12 @@
         # interval we're polling at.
         tasks_called = []
         produced_deferreds = []
+
         def producer():
             deferred = Deferred()
             produced_deferreds.append(deferred)
             return deferred
+
         clock = Clock()
         interval = self.factory.getUniqueInteger()
         task_source = self.makeTaskSource(
@@ -264,8 +268,10 @@
         # The value fired with is True if the source is still stopped when the
         # deferred fires.
         produced_deferred = Deferred()
+
         def producer():
             return produced_deferred
+
         task_source = self.makeTaskSource(task_producer=producer)
         task_source.start(NoopTaskConsumer())
         # The call to start calls producer.  It returns produced_deferred
@@ -286,8 +292,10 @@
         # The value fired with is False if the source is no longer stopped
         # when the deferred fires.
         produced_deferred = Deferred()
+
         def producer():
             return produced_deferred
+
         task_source = self.makeTaskSource(task_producer=producer)
         task_source.start(NoopTaskConsumer())
         # The call to start calls producer.  It returns produced_deferred
@@ -309,10 +317,12 @@
         # stop() again are called in sequence, we shouldn't try to acquire
         # another job when the first acquisition completes.
         produced_deferreds = []
+
         def producer():
             d = Deferred()
             produced_deferreds.append(d)
             return d
+
         task_source = self.makeTaskSource(task_producer=producer)
         # Start the source.  This calls the producer.
         task_source.start(NoopTaskConsumer())
@@ -335,14 +345,17 @@
             def taskStarted(self, task):
                 started.append(task)
                 return Deferred()
+
         interval = self.factory.getUniqueInteger()
         clock = Clock()
         produced = []
         started = []
+
         def producer():
             value = self.factory.getUniqueInteger()
             produced.append(value)
             return value
+
         task_source = self.makeTaskSource(
             task_producer=producer, interval=interval, clock=clock)
         consumer = DeferredStartingConsumer()
@@ -360,12 +373,14 @@
         class LoggingConsumer:
             def __init__(self):
                 self._task_production_failed_calls = []
+
             def taskStarted(self, task):
                 self.fail("taskStarted should not be called.")
+
             def taskProductionFailed(self, reason):
                 self._task_production_failed_calls.append(reason)
 
-        task_source = self.makeTaskSource(task_producer=lambda: 1/0)
+        task_source = self.makeTaskSource(task_producer=lambda: 1 / 0)
         consumer = LoggingConsumer()
         task_source.start(consumer)
         self.assertEqual(1, len(consumer._task_production_failed_calls))
@@ -379,14 +394,17 @@
             def taskProductionFailed(self, reason):
                 failures.append(reason)
                 return Deferred()
+
         interval = self.factory.getUniqueInteger()
         clock = Clock()
         produced = []
         failures = []
+
         def producer():
             exc = RuntimeError()
             produced.append(exc)
             raise exc
+
         task_source = self.makeTaskSource(
             task_producer=producer, interval=interval, clock=clock)
         consumer = DeferredFailingConsumer()
@@ -596,9 +614,11 @@
         # concurrency limit, we'll do the work anyway. We cannot rely on the
         # source sending us the work again.
         log = []
+
         def log_append(item):
             log.append(item)
             return Deferred()
+
         consumer = self.makeConsumer(worker_limit=1)
         consumer.consume(LoggingSource([]))
         consumer.taskStarted(lambda: log_append('task1'))

=== modified file 'lib/lp/services/twistedsupport/tests/test_twistedsupport.py'
--- lib/lp/services/twistedsupport/tests/test_twistedsupport.py	2011-12-19 23:38:16 +0000
+++ lib/lp/services/twistedsupport/tests/test_twistedsupport.py	2015-10-14 15:31:43 +0000
@@ -58,7 +58,9 @@
         clock = Clock()
         d = cancel_on_timeout(defer.succeed("frobnicle"), 1, clock)
         clock.advance(2)
+
         def result(value):
             self.assertEqual(value, "frobnicle")
             self.assertEqual([], clock.getDelayedCalls())
+
         return d.addCallback(result)

=== modified file 'lib/lp/services/verification/tests/logintoken.py'
--- lib/lp/services/verification/tests/logintoken.py	2011-12-20 10:21:46 +0000
+++ lib/lp/services/verification/tests/logintoken.py	2015-10-14 15:31:43 +0000
@@ -12,6 +12,7 @@
     msg = email.message_from_string(email_msg)
     return get_token_url_from_string(msg.get_payload())
 
+
 def get_token_url_from_string(s):
     """Return the logintoken URL contained in the given string."""
     return re.findall(r'http.*/token/.*', s)[0]

=== modified file 'lib/lp/services/webapp/doc/__init__.py'
--- lib/lp/services/webapp/doc/__init__.py	2009-06-25 05:39:50 +0000
+++ lib/lp/services/webapp/doc/__init__.py	2015-10-14 15:31:43 +0000
@@ -2,4 +2,3 @@
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 # Make this directory into a Python package.
-

=== modified file 'lib/lp/services/webapp/metazcml.py'
--- lib/lp/services/webapp/metazcml.py	2015-10-11 20:06:23 +0000
+++ lib/lp/services/webapp/metazcml.py	2015-10-14 15:31:43 +0000
@@ -547,9 +547,9 @@
             context, request, new_name=new_name, rootsite=rootsite)
 
     _context.action(
-        discriminator = ('view', for_, name, IBrowserRequest, layer),
-        callable = handler,
-        args = (
+        discriminator=('view', for_, name, IBrowserRequest, layer),
+        callable=handler,
+        args=(
             'registerAdapter',
             renamed_factory, (for_, layer), Interface, name, _context.info))
 

=== modified file 'lib/lp/services/webapp/notifications.py'
--- lib/lp/services/webapp/notifications.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/webapp/notifications.py	2015-10-14 15:31:43 +0000
@@ -328,7 +328,7 @@
             response.addInfoNotification(
                 structured('Info notification <b>%d</b>' % count))
             response.addWarningNotification(
-                structured('Warning notification <b>%d</b>' %count))
+                structured('Warning notification <b>%d</b>' % count))
             response.addErrorNotification(
                 structured('Error notification <b>%d</b>' % count))
 

=== modified file 'lib/lp/services/webapp/opstats.py'
--- lib/lp/services/webapp/opstats.py	2012-04-16 23:02:44 +0000
+++ lib/lp/services/webapp/opstats.py	2015-10-14 15:31:43 +0000
@@ -16,34 +16,34 @@
     """The XML-RPC API for extracting operational statistics."""
 
     # Statistics maintained by the publication machinery. Class global.
-    stats = {} # Initialized by OpStats.resetStats()
+    stats = {}  # Initialized by OpStats.resetStats()
 
     @classmethod
     def resetStats(cls):
         """Reset the collected stats to 0."""
         OpStats.stats.update({
             # Global
-            'requests': 0, # Requests, all protocols, all statuses
-            'retries': 0, # Optimistic transaction retries.
-            'soft timeouts': 0, # Requests that generated a soft timeout OOPS
-            'timeouts': 0, # Requests that generated a hard timeout OOPS
+            'requests': 0,       # Requests, all protocols, all statuses
+            'retries': 0,        # Optimistic transaction retries.
+            'soft timeouts': 0,  # Requests that generated a soft timeout OOPS
+            'timeouts': 0,       # Requests that generated a hard timeout OOPS
 
             # XML-RPC specific
-            'xml-rpc requests': 0, # XML-RPC requests, all statuses
-            'xml-rpc faults': 0, # XML-RPC requests returning a Fault
+            'xml-rpc requests': 0,  # XML-RPC requests, all statuses
+            'xml-rpc faults': 0,    # XML-RPC requests returning a Fault
 
             # HTTP specific
             'http requests': 0,
-            '404s': 0, # Not Found
-            '500s': 0, # Internal Server Error (eg. unhandled exception)
-            '503s': 0, # Service Unavailable (eg. Timeout)
-            '1XXs': 0, # Informational (Don't think Launchpad produces these)
-            '2XXs': 0, # Successful
-            '3XXs': 0, # Redirection
-            '4XXs': 0, # Client Errors
-            '5XXs': 0, # Server Errors
-            '6XXs': 0, # Internal Errors
-            '5XXs_b': 0, # Server Errors returned to browsers (not robots).
+            '404s': 0,  # Not Found
+            '500s': 0,  # Internal Server Error (eg. unhandled exception)
+            '503s': 0,  # Service Unavailable (eg. Timeout)
+            '1XXs': 0,  # Informational (Don't think Launchpad produces these)
+            '2XXs': 0,  # Successful
+            '3XXs': 0,  # Redirection
+            '4XXs': 0,  # Client Errors
+            '5XXs': 0,  # Server Errors
+            '6XXs': 0,  # Internal Errors
+            '5XXs_b': 0,  # Server Errors returned to browsers (not robots).
             })
 
     def opstats(self):
@@ -78,5 +78,4 @@
         return out.getvalue()
 
 
-OpStats.resetStats() # Initialize the statistics
-
+OpStats.resetStats()  # Initialize the statistics

=== modified file 'lib/lp/services/webapp/sighup.py'
--- lib/lp/services/webapp/sighup.py	2011-12-24 17:49:30 +0000
+++ lib/lp/services/webapp/sighup.py	2015-10-14 15:31:43 +0000
@@ -23,4 +23,3 @@
 def setup_sighup(event):
     """Configure the SIGHUP handler.  Called at startup."""
     signal.signal(signal.SIGHUP, sighup_handler)
-

=== modified file 'lib/lp/services/webapp/sigusr1.py'
--- lib/lp/services/webapp/sigusr1.py	2010-08-20 20:31:18 +0000
+++ lib/lp/services/webapp/sigusr1.py	2015-10-14 15:31:43 +0000
@@ -29,16 +29,19 @@
                        getattr(thread, 'lp_last_sql_statement', None))
     logging.getLogger('sigusr1').info('\n'.join(message))
 
+
 def setup_sigusr1(event):
     """Configure the SIGUSR1 handler.  Called at startup."""
     signal.signal(signal.SIGUSR1, sigusr1_handler)
 
+
 def before_traverse(event):
     """Record the request URL (provided that the request has a URL)"""
     request = event.request
     threading.currentThread().lp_last_request = str(
         getattr(request, 'URL', ''))
 
+
 def end_request(event):
     """Record the OOPS ID in the thread, if one occurred."""
     request = event.request

=== modified file 'lib/lp/services/webapp/sigusr2.py'
--- lib/lp/services/webapp/sigusr2.py	2010-08-20 20:31:18 +0000
+++ lib/lp/services/webapp/sigusr2.py	2015-10-14 15:31:43 +0000
@@ -19,6 +19,7 @@
     "Rotate logfiles in response to SIGUSR2."""
     reopenFiles()
 
+
 def setup_sigusr2(event):
     """Configure the SIGUSR2 handler. Called at startup."""
     signal.signal(signal.SIGUSR2, sigusr2_handler)

=== modified file 'lib/lp/services/webapp/snapshot.py'
--- lib/lp/services/webapp/snapshot.py	2011-12-23 23:44:59 +0000
+++ lib/lp/services/webapp/snapshot.py	2015-10-14 15:31:43 +0000
@@ -13,8 +13,9 @@
 
 HARD_LIMIT_FOR_SNAPSHOT = 1000
 
+
 @implementer(ISnapshotValueFactory)
-@adapter(IResultSet) # And ISQLObjectResultSet.
+@adapter(IResultSet)  # And ISQLObjectResultSet.
 def snapshot_sql_result(value):
     # SQLMultipleJoin and SQLRelatedJoin return
     # SelectResults, which doesn't really help the Snapshot

=== modified file 'lib/lp/services/webapp/tests/sigusr2.py'
--- lib/lp/services/webapp/tests/sigusr2.py	2013-01-07 03:29:28 +0000
+++ lib/lp/services/webapp/tests/sigusr2.py	2015-10-14 15:31:43 +0000
@@ -20,6 +20,7 @@
 
 _counter = 1
 
+
 def sigusr1_handler(signum, frame):
     """Emit a message"""
     global _counter
@@ -30,10 +31,12 @@
 
 _installed_handler = None
 
+
 def sigusr2_handler(signum, frame):
     _installed_handler(signum, frame)
     notify('sigusr2')
 
+
 if __name__ == '__main__':
     logging.getLogger('').addHandler(FileHandler(sys.argv[1]))
     signal.signal(signal.SIGUSR1, sigusr1_handler)

=== modified file 'lib/lp/services/webapp/tests/test___init__.py'
--- lib/lp/services/webapp/tests/test___init__.py	2011-12-24 17:49:30 +0000
+++ lib/lp/services/webapp/tests/test___init__.py	2015-10-14 15:31:43 +0000
@@ -16,4 +16,3 @@
             optionflags=NORMALIZE_WHITESPACE | ELLIPSIS
             )
     return suite
-

=== modified file 'lib/lp/services/webapp/tests/test_dbpolicy.py'
--- lib/lp/services/webapp/tests/test_dbpolicy.py	2015-09-28 17:38:45 +0000
+++ lib/lp/services/webapp/tests/test_dbpolicy.py	2015-10-14 15:31:43 +0000
@@ -7,7 +7,6 @@
 __all__ = []
 
 from textwrap import dedent
-import time
 
 from lazr.restful.interfaces import IWebServiceConfiguration
 import psycopg2

=== modified file 'lib/lp/services/webapp/tests/test_loginsource.py'
--- lib/lp/services/webapp/tests/test_loginsource.py	2012-01-01 02:58:52 +0000
+++ lib/lp/services/webapp/tests/test_loginsource.py	2015-10-14 15:31:43 +0000
@@ -42,5 +42,6 @@
             self.mark.account.id, access_level=AccessLevel.WRITE_PUBLIC)
         self.assertEqual(principal.access_level, AccessLevel.WRITE_PUBLIC)
         principal = self.login_source.getPrincipalByLogin(
-            removeSecurityProxy(self.mark).preferredemail.email, AccessLevel.READ_PUBLIC)
+            removeSecurityProxy(self.mark).preferredemail.email,
+            AccessLevel.READ_PUBLIC)
         self.assertEqual(principal.access_level, AccessLevel.READ_PUBLIC)

=== modified file 'lib/lp/services/webapp/tests/test_metazcml.py'
--- lib/lp/services/webapp/tests/test_metazcml.py	2011-12-24 17:49:30 +0000
+++ lib/lp/services/webapp/tests/test_metazcml.py	2015-10-14 15:31:43 +0000
@@ -12,7 +12,7 @@
 class TestCallDirective(TestCase):
 
     def test_call(self):
-        directive = """ 
+        directive = """
             <call callable="%(this)s.callable" />
             """ % dict(this=this)
         xmlconfig.string(zcml_configure % directive)

=== modified file 'lib/lp/services/webapp/tests/test_navigation.py'
--- lib/lp/services/webapp/tests/test_navigation.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/webapp/tests/test_navigation.py	2015-10-14 15:31:43 +0000
@@ -27,7 +27,7 @@
     def test_default_layer(self):
         # By default all navigation classes are registered for
         # IDefaultBrowserLayer.
-        directive = """ 
+        directive = """
             <browser:navigation
                 module="%(this)s" classes="ThingNavigation"/>
             """ % dict(this=this)
@@ -57,7 +57,7 @@
     def test_multiple_navigations_for_single_context(self):
         # It is possible to have multiple navigation classes for a given
         # context class as long as they are registered for different layers.
-        directive = """ 
+        directive = """
             <browser:navigation
                 module="%(this)s" classes="ThingNavigation"/>
             <browser:navigation

=== modified file 'lib/lp/services/webapp/tests/test_notifications.py'
--- lib/lp/services/webapp/tests/test_notifications.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/webapp/tests/test_notifications.py	2015-10-14 15:31:43 +0000
@@ -100,4 +100,3 @@
 
 if __name__ == '__main__':
     unittest.main(defaultTest='test_suite')
-

=== modified file 'lib/lp/services/webapp/tests/test_preferredcharsets.py'
--- lib/lp/services/webapp/tests/test_preferredcharsets.py	2011-12-22 05:09:10 +0000
+++ lib/lp/services/webapp/tests/test_preferredcharsets.py	2015-10-14 15:31:43 +0000
@@ -11,4 +11,3 @@
 def test_suite():
     return LayeredDocFileSuite(
         'test_preferredcharsets.txt')
-

=== modified file 'lib/lp/services/webapp/tests/test_url.py'
--- lib/lp/services/webapp/tests/test_url.py	2011-12-24 17:49:30 +0000
+++ lib/lp/services/webapp/tests/test_url.py	2015-10-14 15:31:43 +0000
@@ -16,4 +16,3 @@
             optionflags=NORMALIZE_WHITESPACE | ELLIPSIS
             )
     return suite
-

=== modified file 'lib/lp/services/webapp/tests/test_vhosts.py'
--- lib/lp/services/webapp/tests/test_vhosts.py	2011-12-24 17:49:30 +0000
+++ lib/lp/services/webapp/tests/test_vhosts.py	2015-10-14 15:31:43 +0000
@@ -18,4 +18,3 @@
             optionflags=NORMALIZE_WHITESPACE | ELLIPSIS
             )
     return suite
-

=== modified file 'lib/lp/services/webapp/tests/test_webapp_authorization.py'
--- lib/lp/services/webapp/tests/test_webapp_authorization.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/webapp/tests/test_webapp_authorization.py	2015-10-14 15:31:43 +0000
@@ -18,7 +18,6 @@
     AccessLevel,
     ILaunchpadContainer,
     )
-from lp.testing.layers import ZopelessLayer
 
 
 class TestLaunchpadSecurityPolicy_getPrincipalsAccessLevel(

=== modified file 'lib/lp/services/webapp/url.py'
--- lib/lp/services/webapp/url.py	2012-01-01 03:00:09 +0000
+++ lib/lp/services/webapp/url.py	2015-10-14 15:31:43 +0000
@@ -36,6 +36,7 @@
 # Extend urlparse to support sftp at module load time.
 _enable_sftp_in_urlparse()
 
+
 def _enable_bzr_ssh_in_urlparse():
     """Teach the urlparse module about the bzr+ssh scheme.
 
@@ -59,6 +60,7 @@
 # schemes which are added here.
 _enable_bzr_ssh_in_urlparse()
 
+
 def urlappend(baseurl, path):
     """Append the given path to baseurl.
 

=== modified file 'lib/lp/services/webapp/vhosts.py'
--- lib/lp/services/webapp/vhosts.py	2012-01-06 11:08:30 +0000
+++ lib/lp/services/webapp/vhosts.py	2015-10-14 15:31:43 +0000
@@ -78,7 +78,6 @@
         """
         self._has_vhost_data = False
 
-
     def _getVHostData(self):
         """Parse the vhosts on demand."""
         # Avoid the circular imports inherent with the use of canonical.lazr.
@@ -126,4 +125,3 @@
 
 # The only public API to this module, the global virtual host configuration.
 allvhosts = AllVirtualHostsConfiguration()
-

=== modified file 'lib/lp/services/webhooks/tests/test_browser.py'
--- lib/lp/services/webhooks/tests/test_browser.py	2015-10-13 16:58:20 +0000
+++ lib/lp/services/webhooks/tests/test_browser.py	2015-10-14 15:31:43 +0000
@@ -9,7 +9,6 @@
 
 import soupmatchers
 from testtools.matchers import (
-    Equals,
     MatchesAll,
     MatchesStructure,
     Not,

=== modified file 'lib/lp/services/webservice/tests/test_wadllib.py'
--- lib/lp/services/webservice/tests/test_wadllib.py	2011-12-22 23:28:30 +0000
+++ lib/lp/services/webservice/tests/test_wadllib.py	2015-10-14 15:31:43 +0000
@@ -17,6 +17,7 @@
 
 topdir = os.path.dirname(wadllib.__file__)
 
+
 def test_suite():
     suite = unittest.TestSuite()
 
@@ -24,7 +25,7 @@
     packages = []
     for dirpath, dirnames, filenames in os.walk(topdir):
         if 'docs' in dirnames:
-            docsdir = os.path.join(dirpath, 'docs')[len(topdir)+1:]
+            docsdir = os.path.join(dirpath, 'docs')[len(topdir) + 1:]
             packages.append(docsdir)
     doctest_files = {}
     for docsdir in packages:

=== modified file 'lib/lp/services/worlddata/interfaces/country.py'
--- lib/lp/services/worlddata/interfaces/country.py	2013-01-07 02:40:55 +0000
+++ lib/lp/services/worlddata/interfaces/country.py	2015-10-14 15:31:43 +0000
@@ -102,4 +102,3 @@
     id = Int(title=_('ID'), required=True, readonly=True)
     code = TextLine(title=_("Continent's code"), required=True, readonly=True)
     name = TextLine(title=_("Continent's name"), required=True, readonly=True)
-

=== modified file 'lib/lp/services/worlddata/interfaces/spokenin.py'
--- lib/lp/services/worlddata/interfaces/spokenin.py	2013-01-07 02:40:55 +0000
+++ lib/lp/services/worlddata/interfaces/spokenin.py	2015-10-14 15:31:43 +0000
@@ -25,4 +25,3 @@
     country = Int(title=_('Country'), required=True, readonly=True)
 
     language = Int(title=_('Language'), required=True, readonly=True)
-

=== modified file 'lib/lp/services/worlddata/model/country.py'
--- lib/lp/services/worlddata/model/country.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/worlddata/model/country.py	2015-10-14 15:31:43 +0000
@@ -72,6 +72,7 @@
         """See `ICountrySet`."""
         return IStore(Country).find(Country).order_by(Country.iso3166code2)
 
+
 @implementer(IContinent)
 class Continent(SQLBase):
     """See IContinent."""

=== modified file 'lib/lp/services/worlddata/model/spokenin.py'
--- lib/lp/services/worlddata/model/spokenin.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/worlddata/model/spokenin.py	2015-10-14 15:31:43 +0000
@@ -23,4 +23,3 @@
     country = ForeignKey(dbName='country', notNull=True, foreignKey='Country')
     language = ForeignKey(dbName='language', notNull=True,
                           foreignKey='Language')
-

=== modified file 'lib/lp/services/worlddata/tests/test_doc.py'
--- lib/lp/services/worlddata/tests/test_doc.py	2012-01-01 02:58:52 +0000
+++ lib/lp/services/worlddata/tests/test_doc.py	2015-10-14 15:31:43 +0000
@@ -24,5 +24,6 @@
         setUp=setUp, tearDown=tearDown),
     }
 
+
 def test_suite():
     return build_test_suite(here, special)

=== modified file 'lib/lp/services/xml.py'
--- lib/lp/services/xml.py	2011-12-30 14:40:27 +0000
+++ lib/lp/services/xml.py	2015-10-14 15:31:43 +0000
@@ -28,7 +28,6 @@
         self.schema_filename = schema_filename
         self._errors = ''
 
-
     def validate(self, xml):
         """Validate the string xml
 


References