launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #27303
[Merge] ~cjwatson/launchpad:flake8-unused-imports into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:flake8-unused-imports into launchpad:master.
Commit message:
flake8: Fix/ignore a number of unused imports
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/406114
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:flake8-unused-imports into launchpad:master.
diff --git a/daemons/distributionmirror_http_server.tac b/daemons/distributionmirror_http_server.tac
index a9c1dc9..dae6fe5 100644
--- a/daemons/distributionmirror_http_server.tac
+++ b/daemons/distributionmirror_http_server.tac
@@ -4,9 +4,10 @@
# Twisted Application Configuration file.
# Use with "twistd2.4 -y <file.tac>", e.g. "twistd -noy server.tac"
-import os
-
-from twisted.application import service, internet, strports
+from twisted.application import (
+ service,
+ strports,
+ )
from twisted.web import server
from lp.services.daemons import readyservice
diff --git a/doc/conf.py b/doc/conf.py
index 819c657..212dd6b 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -11,8 +11,6 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
-import sys, os
-
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
diff --git a/lib/launchpad_loggerhead/wsgi.py b/lib/launchpad_loggerhead/wsgi.py
index 3d2892a..d10c7eb 100644
--- a/lib/launchpad_loggerhead/wsgi.py
+++ b/lib/launchpad_loggerhead/wsgi.py
@@ -30,7 +30,7 @@ from launchpad_loggerhead.app import (
)
from launchpad_loggerhead.revision import RevisionHeaderHandler
from launchpad_loggerhead.session import SessionHandler
-import lp.codehosting
+import lp.codehosting # noqa: F401
from lp.services.config import config
from lp.services.pidfile import (
pidfile_path,
diff --git a/lib/lp/answers/model/tests/test_question.py b/lib/lp/answers/model/tests/test_question.py
index 0687f00..28a19da 100644
--- a/lib/lp/answers/model/tests/test_question.py
+++ b/lib/lp/answers/model/tests/test_question.py
@@ -2,18 +2,15 @@
# GNU Affero General Public License version 3 (see the file LICENSE).
from __future__ import absolute_import, print_function, unicode_literals
+
+__metaclass__ = type
+
from datetime import (
datetime,
timedelta,
)
import pytz
-
-from lp.services import database
-
-
-__metaclass__ = type
-
from zope.component import getUtility
from zope.security.proxy import removeSecurityProxy
diff --git a/lib/lp/app/__init__.py b/lib/lp/app/__init__.py
index bd4a213..e79d7bd 100644
--- a/lib/lp/app/__init__.py
+++ b/lib/lp/app/__init__.py
@@ -21,4 +21,4 @@ itemswidgets.EXPLICIT_EMPTY_SELECTION = False
# Load versioninfo.py so that we get errors on start-up rather than waiting
# for first page load.
-import lp.app.versioninfo
+import lp.app.versioninfo # noqa: F401
diff --git a/lib/lp/app/browser/vocabulary.py b/lib/lp/app/browser/vocabulary.py
index 3d4230c..40f75e7 100644
--- a/lib/lp/app/browser/vocabulary.py
+++ b/lib/lp/app/browser/vocabulary.py
@@ -29,7 +29,7 @@ from zope.interface import (
from zope.schema.interfaces import IVocabularyFactory
from zope.security.interfaces import Unauthorized
# This registers the registry.
-import zope.vocabularyregistry.registry
+import zope.vocabularyregistry.registry # noqa: F401
from lp.app.browser.tales import (
DateTimeFormatterAPI,
diff --git a/lib/lp/charms/browser/tests/test_charmrecipebuild.py b/lib/lp/charms/browser/tests/test_charmrecipebuild.py
index 0978a0a..d9c6ebd 100644
--- a/lib/lp/charms/browser/tests/test_charmrecipebuild.py
+++ b/lib/lp/charms/browser/tests/test_charmrecipebuild.py
@@ -22,10 +22,7 @@ from zope.testbrowser.browser import LinkNotFoundError
from lp.app.enums import InformationType
from lp.app.interfaces.launchpad import ILaunchpadCelebrities
from lp.buildmaster.enums import BuildStatus
-from lp.charms.interfaces.charmrecipe import (
- CHARM_RECIPE_ALLOW_CREATE,
- CHARM_RECIPE_PRIVATE_FEATURE_FLAG,
- )
+from lp.charms.interfaces.charmrecipe import CHARM_RECIPE_ALLOW_CREATE
from lp.services.features.testing import FeatureFixture
from lp.services.webapp import canonical_url
from lp.testing import (
diff --git a/lib/lp/code/interfaces/tests/test_branch.py b/lib/lp/code/interfaces/tests/test_branch.py
index ed75d2f..eed7c15 100644
--- a/lib/lp/code/interfaces/tests/test_branch.py
+++ b/lib/lp/code/interfaces/tests/test_branch.py
@@ -15,7 +15,7 @@ from lp.code.bzr import (
ControlFormat,
RepositoryFormat,
)
-import lp.codehosting # For plugins.
+import lp.codehosting # noqa: F401 # For plugins.
from lp.testing import TestCase
diff --git a/lib/lp/codehosting/puller/tests/test_worker_formats.py b/lib/lp/codehosting/puller/tests/test_worker_formats.py
index 6d60ce3..a3c9e14 100644
--- a/lib/lp/codehosting/puller/tests/test_worker_formats.py
+++ b/lib/lp/codehosting/puller/tests/test_worker_formats.py
@@ -19,7 +19,7 @@ from breezy.plugins.weave_fmt.repository import (
from breezy.tests.per_repository import TestCaseWithRepository
from breezy.url_policy_open import BranchOpener
-import lp.codehosting # For brz plugins.
+import lp.codehosting # noqa: F401 # For brz plugins.
from lp.codehosting.puller.tests import PullerWorkerMixin
from lp.codehosting.tests.helpers import LoomTestMixin
diff --git a/lib/lp/codehosting/puller/worker.py b/lib/lp/codehosting/puller/worker.py
index 0b1ac31..918b9ed 100644
--- a/lib/lp/codehosting/puller/worker.py
+++ b/lib/lp/codehosting/puller/worker.py
@@ -10,7 +10,7 @@ import sys
# FIRST Ensure correct plugins are loaded. Do not delete this comment or the
# line below this comment.
-import lp.codehosting
+import lp.codehosting # noqa: F401
from breezy import (
errors,
diff --git a/lib/lp/codehosting/tests/test_breezy.py b/lib/lp/codehosting/tests/test_breezy.py
index da1309f..04096d5 100644
--- a/lib/lp/codehosting/tests/test_breezy.py
+++ b/lib/lp/codehosting/tests/test_breezy.py
@@ -14,6 +14,6 @@ class TestBreezy(TestCase):
def test_has_cextensions(self):
"""Ensure Breezy C extensions are being used."""
try:
- import breezy.bzr._dirstate_helpers_pyx
+ import breezy.bzr._dirstate_helpers_pyx # noqa: F401
except ImportError:
self.fail("Breezy not built with C extensions.")
diff --git a/lib/lp/registry/browser/poll.py b/lib/lp/registry/browser/poll.py
index 8c5debe..42b3e26 100644
--- a/lib/lp/registry/browser/poll.py
+++ b/lib/lp/registry/browser/poll.py
@@ -36,7 +36,6 @@ from lp.app.browser.launchpadform import (
)
from lp.registry.browser.person import PersonView
from lp.registry.interfaces.poll import (
- CannotCreatePoll,
IPoll,
IPollOption,
IPollOptionSet,
@@ -56,7 +55,6 @@ from lp.services.webapp import (
NavigationMenu,
stepthrough,
)
-from lp.services.webapp.authorization import check_permission
from lp.services.webapp.breadcrumb import TitleBreadcrumb
diff --git a/lib/lp/registry/model/ociproject.py b/lib/lp/registry/model/ociproject.py
index 60ee369..965c83c 100644
--- a/lib/lp/registry/model/ociproject.py
+++ b/lib/lp/registry/model/ociproject.py
@@ -33,7 +33,6 @@ from zope.interface import implementer
from zope.security.proxy import removeSecurityProxy
from lp.app.enums import (
- FREE_INFORMATION_TYPES,
PRIVATE_INFORMATION_TYPES,
PUBLIC_INFORMATION_TYPES,
ServiceUsage,
diff --git a/lib/lp/scripts/harness.py b/lib/lp/scripts/harness.py
index 12f5b8d..037c7c8 100644
--- a/lib/lp/scripts/harness.py
+++ b/lib/lp/scripts/harness.py
@@ -23,9 +23,9 @@ import sys
import webbrowser
from pytz import utc
-from storm.expr import *
+from storm.expr import * # noqa: F401,F403
# Bring in useful bits of Storm.
-from storm.locals import *
+from storm.locals import * # noqa: F401,F403
import transaction
from zope.component import getUtility
from zope.interface.verify import verifyObject
diff --git a/lib/lp/services/librarianserver/tests/test_storage_db.py b/lib/lp/services/librarianserver/tests/test_storage_db.py
index 63929b5..94dbec6 100644
--- a/lib/lp/services/librarianserver/tests/test_storage_db.py
+++ b/lib/lp/services/librarianserver/tests/test_storage_db.py
@@ -5,10 +5,8 @@ from __future__ import absolute_import, print_function, unicode_literals
import hashlib
import os.path
-import time
from fixtures import TempDir
-from swiftclient import client as swiftclient
from testtools.testcase import ExpectedException
from testtools.twistedsupport import AsynchronousDeferredRunTest
import transaction
diff --git a/lib/lp/snappy/tests/test_snapbuild.py b/lib/lp/snappy/tests/test_snapbuild.py
index dab737f..24ecc1a 100644
--- a/lib/lp/snappy/tests/test_snapbuild.py
+++ b/lib/lp/snappy/tests/test_snapbuild.py
@@ -50,10 +50,7 @@ from lp.services.config import config
from lp.services.features.testing import FeatureFixture
from lp.services.job.interfaces.job import JobStatus
from lp.services.librarian.browser import ProxiedLibraryFileAlias
-from lp.services.macaroons.interfaces import (
- BadMacaroonContext,
- IMacaroonIssuer,
- )
+from lp.services.macaroons.interfaces import IMacaroonIssuer
from lp.services.macaroons.testing import MacaroonTestMixin
from lp.services.propertycache import clear_property_cache
from lp.services.webapp.interfaces import OAuthPermission
diff --git a/lib/lp/soyuz/scripts/gina/handlers.py b/lib/lp/soyuz/scripts/gina/handlers.py
index 432efcf..1af1352 100644
--- a/lib/lp/soyuz/scripts/gina/handlers.py
+++ b/lib/lp/soyuz/scripts/gina/handlers.py
@@ -25,10 +25,7 @@ import os
import re
import six
-from sqlobject import (
- SQLObjectMoreThanOneResultError,
- SQLObjectNotFound,
- )
+from sqlobject import SQLObjectNotFound
from storm.exceptions import NotOneError
from storm.expr import (
Cast,
@@ -873,7 +870,7 @@ class BinaryPackageHandler:
try:
build = BinaryPackageBuild.selectOne(query, clauseTables)
- except SQLObjectMoreThanOneResultError:
+ except NotOneError:
# XXX kiko 2005-10-27: Untested.
raise MultipleBuildError("More than one build was found "
"for package %s (%s)" % (binary.package, binary.version))
diff --git a/lib/lp/testing/fixture.py b/lib/lp/testing/fixture.py
index 5ad7317..42ea06f 100644
--- a/lib/lp/testing/fixture.py
+++ b/lib/lp/testing/fixture.py
@@ -33,11 +33,7 @@ from zope.component import (
adapter,
getGlobalSiteManager,
)
-from zope.interface import (
- implementedBy,
- Interface,
- )
-from zope.interface.interfaces import ISpecification
+from zope.interface import Interface
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
from zope.security.checker import (
defineChecker,
diff --git a/lib/lp/translations/scripts/translations_to_branch.py b/lib/lp/translations/scripts/translations_to_branch.py
index 5f7a64f..0e57a88 100644
--- a/lib/lp/translations/scripts/translations_to_branch.py
+++ b/lib/lp/translations/scripts/translations_to_branch.py
@@ -15,7 +15,7 @@ import os.path
# FIRST Ensure correct plugins are loaded. Do not delete this comment or the
# line below this comment.
-import lp.codehosting
+import lp.codehosting # noqa: F401
from breezy.errors import NotBranchError
from breezy.revision import NULL_REVISION
diff --git a/lib/sqlobject/__init__.py b/lib/sqlobject/__init__.py
index 19a8410..3e5f9e4 100644
--- a/lib/sqlobject/__init__.py
+++ b/lib/sqlobject/__init__.py
@@ -9,9 +9,8 @@ __metaclass__ = type
import datetime
import six
-from storm.exceptions import NotOneError as SQLObjectMoreThanOneResultError
from storm.expr import SQL
-from storm.sqlobject import *
+from storm.sqlobject import * # noqa: F401,F403
# Provide the same interface from these other locations.
import sys
diff --git a/utilities/get-branch-info b/utilities/get-branch-info
index abcd52c..0e0df53 100755
--- a/utilities/get-branch-info
+++ b/utilities/get-branch-info
@@ -17,7 +17,6 @@ import sys
from breezy.urlutils import join
from zope.component import getUtility
-from lp.code.enums import BranchType
from lp.code.interfaces.branchlookup import IBranchLookup
from lp.codehosting.vfs import branch_id_to_path
from lp.services.config import config
diff --git a/utilities/make-lp-user b/utilities/make-lp-user
index c4bebf5..209fbbc 100755
--- a/utilities/make-lp-user
+++ b/utilities/make-lp-user
@@ -49,7 +49,6 @@ from lp.registry.interfaces.ssh import ISSHKeySet
from lp.registry.interfaces.teammembership import TeamMembershipStatus
from lp.services.gpg.interfaces import (
get_gpg_path,
- GPGKeyAlgorithm,
IGPGHandler,
)
from lp.services.scripts import execute_zcml_for_scripts
diff --git a/utilities/paste b/utilities/paste
index 135b5a1..66d4ddc 100755
--- a/utilities/paste
+++ b/utilities/paste
@@ -7,7 +7,6 @@ from __future__ import absolute_import, print_function
import _pythonpath
-import base64
from optparse import OptionParser
import os
import pwd
@@ -15,10 +14,7 @@ import sys
import webbrowser
from fixtures import MonkeyPatch
-from six.moves.http_cookiejar import (
- Cookie,
- CookieJar,
- )
+from six.moves.http_cookiejar import Cookie
from six.moves.urllib.parse import urljoin
from zope.testbrowser.browser import Browser