← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Commit message:
Fix assorted lint.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This is mainly to have a reasonably harmless change to test developer-driven NDTs with.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/lint-cleanup into lp:launchpad.
=== modified file 'buildout-templates/_pythonpath.py.in'
--- buildout-templates/_pythonpath.py.in	2010-05-04 15:51:59 +0000
+++ buildout-templates/_pythonpath.py.in	2016-12-23 10:00:14 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 # NOTE: This is a generated file.  The original is in
@@ -41,4 +41,4 @@
     # This one line is to support Mailman 2, which does something unexpected
     # to set up its paths.
     sys.path[:] = [p for p in sys.path if 'site-packages' not in p]
-import site # sets up paths
+import site  # sets up paths

=== modified file 'lib/lp/bugs/doc/checkwatches.txt'
--- lib/lp/bugs/doc/checkwatches.txt	2015-07-08 16:05:11 +0000
+++ lib/lp/bugs/doc/checkwatches.txt	2016-12-23 10:00:14 +0000
@@ -26,8 +26,7 @@
     >>> from lp.bugs.interfaces.bugtracker import BugTrackerType
     >>> from lp.bugs.model.bugtracker import BugTracker
     >>> from pytz import utc
-    >>> from lp.bugs.scripts.checkwatches import (
-    ...     CheckwatchesMaster)
+    >>> from lp.bugs.scripts.checkwatches import CheckwatchesMaster
     >>> from lp.registry.interfaces.person import IPersonSet
     >>> sample_person = getUtility(IPersonSet).getByEmail(
     ...     'test@xxxxxxxxxxxxx')

=== modified file 'lib/lp/bugs/scripts/checkwatches/__init__.py'
--- lib/lp/bugs/scripts/checkwatches/__init__.py	2012-01-01 02:58:52 +0000
+++ lib/lp/bugs/scripts/checkwatches/__init__.py	2016-12-23 10:00:14 +0000
@@ -1,19 +1,20 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 """Top-level __init__ for the checkwatches package."""
 
+__all__ = [
+    'CheckWatchesCronScript',
+    'CheckwatchesMaster',
+    'externalbugtracker',
+    'SerialScheduler',
+    'TwistedThreadScheduler',
+    ]
+
 # We do this to maintain backwards compatibility with tests.
-from lp.bugs.scripts.checkwatches.base import (
-    commit_before,
-    with_interaction,
-    WorkingBase,
-    )
 from lp.bugs.scripts.checkwatches.core import (
-    BaseScheduler,
     CheckWatchesCronScript,
     CheckwatchesMaster,
     externalbugtracker,
     SerialScheduler,
-    TooMuchTimeSkew,
     TwistedThreadScheduler,
     )

=== modified file 'lib/lp/code/browser/widgets/branch.py'
--- lib/lp/code/browser/widgets/branch.py	2013-04-10 07:45:16 +0000
+++ lib/lp/code/browser/widgets/branch.py	2016-12-23 10:00:14 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -15,6 +15,7 @@
     InvalidURIError,
     URI,
     )
+from six import reraise
 from zope.component import getUtility
 from zope.formlib.interfaces import ConversionError
 
@@ -105,4 +106,4 @@
                     LaunchpadValidationError):
                 # If it's not a URL or we can't figure out a product, then we
                 # re-raise the initial error.
-                raise exc_class, exc_obj, exc_tb
+                reraise(exc_class, exc_obj, tb=exc_tb)

=== modified file 'lib/lp/codehosting/sshserver/session.py'
--- lib/lp/codehosting/sshserver/session.py	2015-10-19 10:56:16 +0000
+++ lib/lp/codehosting/sshserver/session.py	2016-12-23 10:00:14 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """SSH session implementations for the codehosting SSH server."""
@@ -16,6 +16,7 @@
 
 from lazr.sshserver.events import AvatarEvent
 from lazr.sshserver.session import DoNothingSession
+from six import reraise
 from twisted.internet import (
     error,
     interfaces,
@@ -208,7 +209,7 @@
                     # all cleanups get called so we don't get leaks. We know
                     # there is an active exception, or we wouldn't be here.
                     log.err()
-            raise exc_class, exc_value, exc_tb
+            reraise(exc_class, exc_value, tb=exc_tb)
         self.pipes['exit'] = self._exiter
 
     def _getReason(self, status):

=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py	2016-11-03 15:07:36 +0000
+++ lib/lp/registry/browser/person.py	2016-12-23 10:00:14 +0000
@@ -191,7 +191,6 @@
 from lp.registry.model.person import get_recipients
 from lp.services.config import config
 from lp.services.database.sqlbase import flush_database_updates
-from lp.services.features import getFeatureFlag
 from lp.services.feeds.browser import FeedsMixin
 from lp.services.geoip.interfaces import IRequestPreferredLanguages
 from lp.services.gpg.interfaces import (

=== modified file 'lib/lp/registry/browser/tests/test_distroseriesdifference_views.py'
--- lib/lp/registry/browser/tests/test_distroseriesdifference_views.py	2016-06-17 15:46:57 +0000
+++ lib/lp/registry/browser/tests/test_distroseriesdifference_views.py	2016-12-23 10:00:14 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Unit tests for the DistroSeriesDifference views."""
@@ -391,7 +391,7 @@
 
         with person_logged_in(self.factory.makePerson()):
             view = create_initialized_view(
-                ds_diff, '+listing-distroseries-extra')  #, principal=user)
+                ds_diff, '+listing-distroseries-extra')  # , principal=user)
             soup = BeautifulSoup(view())
         # Both diffs present simple text repr. of proposed diff.
         self.assertEqual(2, self.number_of_request_diff_texts(soup))

=== modified file 'lib/lp/registry/browser/tests/test_person.py'
--- lib/lp/registry/browser/tests/test_person.py	2016-11-03 15:19:01 +0000
+++ lib/lp/registry/browser/tests/test_person.py	2016-12-23 10:00:14 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -7,7 +7,6 @@
 import email
 from textwrap import dedent
 
-from lazr.restful.utils import get_current_browser_request
 import soupmatchers
 from storm.store import Store
 from testtools.matchers import (
@@ -47,7 +46,6 @@
 from lp.services.log.logger import FakeLogger
 from lp.services.mail import stub
 from lp.services.propertycache import clear_property_cache
-from lp.services.timeline.requesttimeline import get_request_timeline
 from lp.services.verification.interfaces.authtoken import LoginTokenType
 from lp.services.verification.interfaces.logintoken import ILoginTokenSet
 from lp.services.verification.tests.logintoken import get_token_url_from_email

=== modified file 'lib/lp/registry/model/distroseriesdifference.py'
--- lib/lp/registry/model/distroseriesdifference.py	2016-03-02 17:51:02 +0000
+++ lib/lp/registry/model/distroseriesdifference.py	2016-12-23 10:00:14 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010-2014 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Database classes for a difference between two distribution series."""
@@ -64,7 +64,6 @@
 from lp.registry.model.distroseriesdifferencecomment import (
     DistroSeriesDifferenceComment,
     )
-from lp.registry.model.gpgkey import GPGKey
 from lp.registry.model.sourcepackagename import SourcePackageName
 from lp.registry.model.teammembership import TeamParticipation
 from lp.services.database import bulk

=== modified file 'lib/lp/registry/model/gpgkey.py'
--- lib/lp/registry/model/gpgkey.py	2016-11-03 16:15:55 +0000
+++ lib/lp/registry/model/gpgkey.py	2016-12-23 10:00:14 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -17,8 +17,6 @@
     IGPGKey,
     IGPGKeySet,
     )
-from lp.registry.interfaces.person import IPersonSet
-from lp.services.config import config
 from lp.services.database.enumcol import EnumCol
 from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
@@ -29,8 +27,6 @@
     GPGKeyAlgorithm,
     IGPGHandler,
     )
-from lp.services.openid.interfaces.openid import IOpenIDPersistentIdentity
-from lp.services.openid.model.openididentifier import OpenIdIdentifier
 
 
 @implementer(IGPGKey)

=== modified file 'lib/lp/registry/tests/test_gpgkey.py'
--- lib/lp/registry/tests/test_gpgkey.py	2016-11-03 16:13:14 +0000
+++ lib/lp/registry/tests/test_gpgkey.py	2016-12-23 10:00:14 +0000
@@ -9,12 +9,11 @@
     Contains,
     Equals,
     HasLength,
-    StartsWith,
     )
 from zope.component import getUtility
 
+from lp.registry.interfaces.gpg import IGPGKeySet
 from lp.registry.interfaces.person import IPersonSet
-from lp.registry.interfaces.gpg import IGPGKeySet
 from lp.services.config.fixture import (
     ConfigFixture,
     ConfigUseFixture,

=== modified file 'lib/lp/scripts/utilities/warninghandler.py'
--- lib/lp/scripts/utilities/warninghandler.py	2015-10-26 12:34:50 +0000
+++ lib/lp/scripts/utilities/warninghandler.py	2016-12-23 10:00:14 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Handlers for warnings, to be installed when testing."""
@@ -58,11 +58,8 @@
             L.append('request url: %s' % self.requesturl)
         return '\n'.join(L)
 
-# PageTemplateFile has .filename.
-from z3c.ptcompat import (
-    PageTemplateFile,
-    ViewPageTemplateFile,
-    )
+# ViewPageTemplateFile has .filename.
+from z3c.ptcompat import ViewPageTemplateFile
 
 # PythonExpr has .text, the text of the expression.
 from zope.tales.pythonexpr import PythonExpr

=== modified file 'lib/lp/services/database/debug.py'
--- lib/lp/services/database/debug.py	2015-10-14 15:22:01 +0000
+++ lib/lp/services/database/debug.py	2016-12-23 10:00:14 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 '''
@@ -72,6 +72,7 @@
 
 _org_connect = None
 
+
 def debug_connect(*args, **kw):
     global _org_connect
     con = ConnectionWrapper(_org_connect(*args, **kw))

=== modified file 'lib/lp/services/looptuner.py'
--- lib/lp/services/looptuner.py	2015-07-08 16:05:11 +0000
+++ lib/lp/services/looptuner.py	2016-12-23 10:00:14 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -15,6 +15,7 @@
 import sys
 import time
 
+from six import reraise
 import transaction
 from zope.interface import (
     implementer,
@@ -215,7 +216,7 @@
                 # failure, so log it.
                 self.log.exception("Unhandled exception in cleanUp")
             # Reraise the original exception.
-            raise exc_info[0], exc_info[1], exc_info[2]
+            reraise(exc_info[0], exc_info[1], tb=exc_info[2])
         else:
             cleanup()
 

=== modified file 'lib/lp/services/mailman/config/__init__.py'
--- lib/lp/services/mailman/config/__init__.py	2010-08-20 20:31:18 +0000
+++ lib/lp/services/mailman/config/__init__.py	2016-12-23 10:00:14 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """ZConfig datatypes for <mailman> and <mailman-build> configuration keys."""
@@ -88,6 +88,6 @@
         addr, password = value.split(':', 1)
     else:
         localpart = random_characters()
-        password  = random_characters()
+        password = random_characters()
         addr = localpart + '@example.com'
     return addr, password

=== modified file 'lib/lp/services/timeout.py'
--- lib/lp/services/timeout.py	2016-07-01 20:07:09 +0000
+++ lib/lp/services/timeout.py	2016-12-23 10:00:14 +0000
@@ -38,6 +38,7 @@
     )
 from requests.packages.urllib3.exceptions import ClosedPoolError
 from requests.packages.urllib3.poolmanager import PoolManager
+from six import reraise
 
 
 default_timeout_function = None
@@ -190,7 +191,7 @@
                 exc_info = t.exc_info
                 # Remove the cyclic reference for faster GC.
                 del t.exc_info
-                raise exc_info[0], exc_info[1], exc_info[2]
+                reraise(exc_info[0], exc_info[1], tb=exc_info[2])
             return t.result
 
         return call_with_timeout

=== modified file 'lib/lp/services/webapp/adapter.py'
--- lib/lp/services/webapp/adapter.py	2016-09-19 12:08:08 +0000
+++ lib/lp/services/webapp/adapter.py	2016-12-23 10:00:14 +0000
@@ -27,6 +27,7 @@
     QueryCanceledError,
     )
 import pytz
+from six import reraise
 from storm.database import register_scheme
 from storm.databases.postgres import (
     Postgres,
@@ -618,7 +619,7 @@
             info = sys.exc_info()
             transaction.doom()
             try:
-                raise info[0], info[1], info[2]
+                reraise(info[0], info[1], tb=info[2])
             finally:
                 info = None
 

=== modified file 'lib/lp/soyuz/model/sourcepackagerelease.py'
--- lib/lp/soyuz/model/sourcepackagerelease.py	2016-07-29 07:37:33 +0000
+++ lib/lp/soyuz/model/sourcepackagerelease.py	2016-12-23 10:00:14 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2014 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -35,12 +35,10 @@
 from storm.store import Store
 from zope.component import getUtility
 from zope.interface import implementer
-from zope.security.proxy import removeSecurityProxy
 
 from lp.app.errors import NotFoundError
 from lp.archiveuploader.utils import determine_source_file_type
 from lp.buildmaster.enums import BuildStatus
-from lp.registry.interfaces.gpg import IGPGKeySet
 from lp.registry.interfaces.person import validate_public_person
 from lp.registry.interfaces.sourcepackage import (
     SourcePackageType,

=== modified file 'lib/lp/soyuz/tests/test_build_notify.py'
--- lib/lp/soyuz/tests/test_build_notify.py	2016-07-29 07:37:33 +0000
+++ lib/lp/soyuz/tests/test_build_notify.py	2016-12-23 10:00:14 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -15,7 +15,6 @@
 from lp.registry.interfaces.person import IPersonSet
 from lp.services.config import config
 from lp.services.mail.sendmail import format_address_for_person
-from lp.services.propertycache import get_property_cache
 from lp.services.webapp import canonical_url
 from lp.soyuz.enums import ArchivePurpose
 from lp.soyuz.interfaces.publishing import PackagePublishingPocket

=== modified file 'lib/lp/testing/layers.py'
--- lib/lp/testing/layers.py	2016-11-03 15:07:36 +0000
+++ lib/lp/testing/layers.py	2016-12-23 10:00:14 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2015 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2016 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Layers used by Launchpad tests.
@@ -98,7 +98,6 @@
     endInteraction,
     getSecurityPolicy,
     )
-from zope.security.proxy import removeSecurityProxy
 from zope.server.logger.pythonlogger import PythonLogger
 
 from lp.services import pidfile


Follow ups