← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/code-pyflakes into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/code-pyflakes into lp:launchpad.

Commit message:
Fix various pyflakes/lint errors in code/codehosting.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/code-pyflakes/+merge/222682

Fix various pyflakes/lint errors in code/codehosting.
-- 
https://code.launchpad.net/~cjwatson/launchpad/code-pyflakes/+merge/222682
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/code-pyflakes into lp:launchpad.
=== modified file 'lib/lp/code/browser/tests/test_branchmergequeue.py'
--- lib/lp/code/browser/tests/test_branchmergequeue.py	2012-01-01 02:58:52 +0000
+++ lib/lp/code/browser/tests/test_branchmergequeue.py	2014-06-10 16:22:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2014 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for the branch merge queue view classes and templates."""
@@ -39,13 +39,8 @@
         """Test the index page of a branch merge queue."""
         with person_logged_in(ANONYMOUS):
             queue = self.factory.makeBranchMergeQueue()
-            queue_owner = queue.owner.displayname
-            queue_registrant = queue.registrant.displayname
-            queue_description = queue.description
-            queue_url = canonical_url(queue)
 
             branch = self.factory.makeBranch()
-            branch_name = branch.bzr_identity
             with person_logged_in(branch.owner):
                 branch.addToQueue(queue)
 
@@ -77,7 +72,6 @@
             rockstar = self.factory.makePerson(name='rockstar')
             branch = self.factory.makeBranch(owner=rockstar)
             self.factory.makeBranch(product=branch.product)
-            owner_name = branch.owner.name
 
         browser = self.getUserBrowser(canonical_url(branch), user=rockstar)
 
@@ -119,7 +113,6 @@
             rockstar = self.factory.makePerson(name='rockstar')
             branch = self.factory.makeBranch(owner=rockstar)
             self.factory.makeBranch(product=branch.product)
-            owner_name = branch.owner.name
 
         browser = self.getUserBrowser(canonical_url(branch), user=rockstar)
         self.assertRaises(

=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipelisting.py'
--- lib/lp/code/browser/tests/test_sourcepackagerecipelisting.py	2012-01-01 02:58:52 +0000
+++ lib/lp/code/browser/tests/test_sourcepackagerecipelisting.py	2014-06-10 16:22:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2014 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for sourcepackagerecipe listings."""
@@ -19,7 +19,7 @@
         # only one will redirect to that recipe.
         branch = self.factory.makeProductBranch()
         recipe = self.factory.makeSourcePackageRecipe(branches=[branch])
-        recipe2 = self.factory.makeSourcePackageRecipe(branches=[branch])
+        self.factory.makeSourcePackageRecipe(branches=[branch])
         text = self.getMainText(recipe.base_branch, '+recipes')
         self.assertTextMatchesExpressionIgnoreWhitespace("""
             Source Package Recipes for lp:.*
@@ -31,7 +31,7 @@
         # only one will redirect to that recipe.
         branch = self.factory.makePackageBranch()
         recipe = self.factory.makeSourcePackageRecipe(branches=[branch])
-        recipe2 = self.factory.makeSourcePackageRecipe(branches=[branch])
+        self.factory.makeSourcePackageRecipe(branches=[branch])
         text = self.getMainText(recipe.base_branch, '+recipes')
         self.assertTextMatchesExpressionIgnoreWhitespace("""
             Source Package Recipes for lp:.*

=== modified file 'lib/lp/code/bzr.py'
--- lib/lp/code/bzr.py	2013-08-16 05:16:07 +0000
+++ lib/lp/code/bzr.py	2014-06-10 16:22:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2014 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Enumerations relating to Bazaar formats."""
@@ -71,7 +71,6 @@
     RepositoryFormatKnit3,
     RepositoryFormatKnit4,
     )
-from bzrlib.tsort import topo_sort
 from lazr.enum import (
     DBEnumeratedType,
     DBItem,

=== modified file 'lib/lp/code/interfaces/branchlink.py'
--- lib/lp/code/interfaces/branchlink.py	2012-04-16 23:02:44 +0000
+++ lib/lp/code/interfaces/branchlink.py	2014-06-10 16:22:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2014 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Interfaces for linking Specifications and Branches."""
@@ -7,8 +7,6 @@
 
 __all__ = [
     "IHasLinkedBranches",
-    "ISpecificationBranch",
-    "ISpecificationBranchSet",
     ]
 
 from lazr.restful.declarations import (
@@ -61,4 +59,3 @@
         :param branch: The branch being unlinked from.
         :param user: The user unlinking the branch.
         """
-

=== modified file 'lib/lp/code/mail/tests/test_codehandler.py'
--- lib/lp/code/mail/tests/test_codehandler.py	2013-05-08 00:56:03 +0000
+++ lib/lp/code/mail/tests/test_codehandler.py	2014-06-10 16:22:47 +0000
@@ -1,11 +1,10 @@
-# Copyright 2009-2012 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2014 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Testing the CodeHandler."""
 
 __metaclass__ = type
 
-from difflib import unified_diff
 from textwrap import dedent
 
 from storm.store import Store
@@ -31,7 +30,6 @@
     BranchMergeProposalJob,
     BranchMergeProposalJobType,
     )
-from lp.code.model.diff import PreviewDiff
 from lp.code.tests.helpers import make_merge_proposal_without_reviewers
 from lp.services.config import config
 from lp.services.mail.handlers import mail_handlers
@@ -382,7 +380,7 @@
     def test_reviewer_with_diff(self):
         """Requesting a review with a diff works."""
         bmp = make_merge_proposal_without_reviewers(self.factory)
-        preview_diff = self.factory.makePreviewDiff(merge_proposal=bmp)
+        self.factory.makePreviewDiff(merge_proposal=bmp)
         # To record the diff in the librarian.
         transaction.commit()
         eric = self.factory.makePerson(name="eric", email="eric@xxxxxxxxxxx")

=== modified file 'lib/lp/code/mail/tests/test_codeimport.py'
--- lib/lp/code/mail/tests/test_codeimport.py	2012-10-09 00:09:15 +0000
+++ lib/lp/code/mail/tests/test_codeimport.py	2014-06-10 16:22:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2014 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for code import related mailings"""
@@ -27,7 +27,7 @@
         fooix = self.factory.makeProduct(name='fooix')
         # Eric needs to be logged in for the mail to be sent.
         login_person(eric)
-        code_import = self.factory.makeProductCodeImport(
+        self.factory.makeProductCodeImport(
             cvs_root=':pserver:anonymouse@xxxxxxxxxxxxxxx:/cvsroot',
             cvs_module='a_module', branch_name='import',
             product=fooix, registrant=eric)
@@ -50,7 +50,7 @@
         fooix = self.factory.makeProduct(name='fooix')
         # Eric needs to be logged in for the mail to be sent.
         login_person(eric)
-        code_import = self.factory.makeProductCodeImport(
+        self.factory.makeProductCodeImport(
             svn_branch_url='svn://svn.example.com/fooix/trunk',
             branch_name='trunk', product=fooix, registrant=eric,
             rcs_type=RevisionControlSystems.BZR_SVN)
@@ -73,7 +73,7 @@
         fooix = self.factory.makeProduct(name='fooix')
         # Eric needs to be logged in for the mail to be sent.
         login_person(eric)
-        code_import = self.factory.makeProductCodeImport(
+        self.factory.makeProductCodeImport(
             git_repo_url='git://git.example.com/fooix.git',
             branch_name='master', product=fooix, registrant=eric)
         transaction.commit()
@@ -100,7 +100,7 @@
             sourcepackagename='fooix', distroseries=series)
         # Eric needs to be logged in for the mail to be sent.
         login_person(eric)
-        code_import = self.factory.makePackageCodeImport(
+        self.factory.makePackageCodeImport(
             git_repo_url='git://git.example.com/fooix.git',
             branch_name='master', sourcepackage=fooix, registrant=eric)
         transaction.commit()

=== modified file 'lib/lp/code/model/branchjob.py'
--- lib/lp/code/model/branchjob.py	2013-07-04 08:32:03 +0000
+++ lib/lp/code/model/branchjob.py	2014-06-10 16:22:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2014 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __all__ = [
@@ -12,7 +12,6 @@
     'RosettaUploadJob',
 ]
 
-import contextlib
 import operator
 import os
 import shutil
@@ -118,10 +117,7 @@
     BaseRunnableJobSource,
     )
 from lp.services.mail.sendmail import format_address_for_person
-from lp.services.webapp import (
-    canonical_url,
-    errorlog,
-    )
+from lp.services.webapp import canonical_url
 from lp.translations.interfaces.translationimportqueue import (
     ITranslationImportQueue,
     )

=== modified file 'lib/lp/code/model/tests/test_branchlistingqueryoptimiser.py'
--- lib/lp/code/model/tests/test_branchlistingqueryoptimiser.py	2012-01-01 02:58:52 +0000
+++ lib/lp/code/model/tests/test_branchlistingqueryoptimiser.py	2014-06-10 16:22:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2014 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for the branch listing query optimiser."""
@@ -94,8 +94,7 @@
         branch = self.branches[0]
         gamma = self.product.newSeries(
             self.product.owner, "gamma", "summary", branch)
-        beta = self.product.newSeries(
-            self.product.owner, "beta", "summary")
+        self.product.newSeries(self.product.owner, "beta", "summary")
         self.assertSeriesBranches([gamma])
 
     def test_import_branches_also_linked(self):

=== modified file 'lib/lp/code/model/tests/test_branchmergeproposal.py'
--- lib/lp/code/model/tests/test_branchmergeproposal.py	2014-05-07 06:12:40 +0000
+++ lib/lp/code/model/tests/test_branchmergeproposal.py	2014-06-10 16:22:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2013 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2014 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for BranchMergeProposals."""
@@ -48,9 +48,6 @@
     IBranchMergeProposalGetter,
     notify_modified,
     )
-from lp.code.interfaces.codereviewinlinecomment import (
-    ICodeReviewInlineCommentSet,
-    )
 from lp.code.model.branchmergeproposal import (
     BranchMergeProposalGetter,
     is_valid_transition,

=== modified file 'lib/lp/code/model/tests/test_hasrecipes.py'
--- lib/lp/code/model/tests/test_hasrecipes.py	2013-01-07 02:40:55 +0000
+++ lib/lp/code/model/tests/test_hasrecipes.py	2014-06-10 16:22:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2014 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for classes that implement IHasRecipes."""
@@ -24,9 +24,9 @@
         # IBranch.recipes should provide all the SourcePackageRecipes attached
         # to that branch.
         base_branch = self.factory.makeBranch()
-        recipe1 = self.factory.makeSourcePackageRecipe(branches=[base_branch])
-        recipe2 = self.factory.makeSourcePackageRecipe(branches=[base_branch])
-        recipe_ignored = self.factory.makeSourcePackageRecipe()
+        self.factory.makeSourcePackageRecipe(branches=[base_branch])
+        self.factory.makeSourcePackageRecipe(branches=[base_branch])
+        self.factory.makeSourcePackageRecipe()
         self.assertEqual(2, base_branch.recipes.count())
 
     def test_branch_recipes_nonbase(self):
@@ -36,7 +36,7 @@
         nonbase_branch = self.factory.makeBranch()
         recipe = self.factory.makeSourcePackageRecipe(
             branches=[base_branch, nonbase_branch])
-        recipe_ignored = self.factory.makeSourcePackageRecipe()
+        self.factory.makeSourcePackageRecipe()
         self.assertEqual(recipe, nonbase_branch.recipes.one())
 
     def test_person_implements_hasrecipes(self):
@@ -48,9 +48,9 @@
         # IPerson.recipes should provide all the SourcePackageRecipes
         # owned by that person.
         person = self.factory.makePerson()
-        recipe1 = self.factory.makeSourcePackageRecipe(owner=person)
-        recipe2 = self.factory.makeSourcePackageRecipe(owner=person)
-        recipe_ignored = self.factory.makeSourcePackageRecipe()
+        self.factory.makeSourcePackageRecipe(owner=person)
+        self.factory.makeSourcePackageRecipe(owner=person)
+        self.factory.makeSourcePackageRecipe()
         self.assertEqual(2, person.recipes.count())
 
     def test_product_implements_hasrecipes(self):
@@ -63,7 +63,7 @@
         # attached to that product's branches.
         product = self.factory.makeProduct()
         branch = self.factory.makeBranch(product=product)
-        recipe1 = self.factory.makeSourcePackageRecipe(branches=[branch])
-        recipe2 = self.factory.makeSourcePackageRecipe(branches=[branch])
-        recipe_ignored = self.factory.makeSourcePackageRecipe()
+        self.factory.makeSourcePackageRecipe(branches=[branch])
+        self.factory.makeSourcePackageRecipe(branches=[branch])
+        self.factory.makeSourcePackageRecipe()
         self.assertEqual(2, product.recipes.count())

=== modified file 'lib/lp/codehosting/tests/test_bzrutils.py'
--- lib/lp/codehosting/tests/test_bzrutils.py	2012-10-09 00:09:15 +0000
+++ lib/lp/codehosting/tests/test_bzrutils.py	2014-06-10 16:22:47 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2014 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for bzrutils."""
@@ -175,8 +175,6 @@
 
     def test_doesnt_call_hook_for_non_important_exception(self):
         # Some exceptions are exempt from OOPSes.
-        exceptions = []
-
         self.assertEqual(0, len(self.oopses))
         hook = install_oops_handler(1000)
         self.addCleanup(remove_exception_logging_hook, hook)


Follow ups