← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/launchpad/megalint-8 into lp:launchpad

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/megalint-8 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jtv/launchpad/megalint-8/+merge/86513

= Summary =

Fixing a few more bits of the reams of lint that we have allowed to persist in files that we edited.

These are all files that we have touched in the past few months, so they _should_ have been more or less lint-free: engineers run "make lint" after editing (or rely on "bzr lp-propose," the command to start a merge proposal, to do it for them), and where possible, fix the warnings that come up.


= Launchpad lint =

There are a few warnings left: code that I didn't want to mess with, cases where I'm not entirely sure what the intention is (in itself a bad sign) or in one case, code that was known to need attention anyway and so has a right to stand out.

./lib/lp/bugs/browser/tests/test_bugtracker_views.py
      48: Line exceeds 78 characters.
      51: Line exceeds 78 characters.
      53: Line exceeds 78 characters.
      36: local variable 'active_tracker2' is assigned to but never used
      35: local variable 'active_tracker1' is assigned to but never used
      48: E501 line too long (80 characters)
./lib/lp/bugs/javascript/bugtarget_portlet_bugtags.js
      46: Expected an identifier and instead saw 'arguments' (a reserved word).
./lib/lp/bugs/interfaces/cve.py
     113: E261 at least two spaces before inline comment
-- 
https://code.launchpad.net/~jtv/launchpad/megalint-8/+merge/86513
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/megalint-8 into lp:launchpad.
=== modified file 'lib/lp/blueprints/browser/specification.py'
--- lib/lp/blueprints/browser/specification.py	2011-11-29 20:35:33 +0000
+++ lib/lp/blueprints/browser/specification.py	2011-12-21 08:37:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Specification views."""
@@ -200,17 +200,17 @@
         """Registers a new specification."""
         self.transform(data)
         spec = getUtility(ISpecificationSet).new(
-            owner = self.user,
-            name = data.get('name'),
-            title = data.get('title'),
-            specurl = data.get('specurl'),
-            summary = data.get('summary'),
-            product = data.get('product'),
-            drafter = data.get('drafter'),
-            assignee = data.get('assignee'),
-            approver = data.get('approver'),
-            distribution = data.get('distribution'),
-            definition_status = data.get('definition_status'))
+            owner=self.user,
+            name=data.get('name'),
+            title=data.get('title'),
+            specurl=data.get('specurl'),
+            summary=data.get('summary'),
+            product=data.get('product'),
+            drafter=data.get('drafter'),
+            assignee=data.get('assignee'),
+            approver=data.get('approver'),
+            distribution=data.get('distribution'),
+            definition_status=data.get('definition_status'))
         # Propose the specification as a series goal, if specified.
         series = data.get('series')
         if series is not None:

=== modified file 'lib/lp/blueprints/browser/tests/test_views.py'
--- lib/lp/blueprints/browser/tests/test_views.py	2011-12-19 23:38:16 +0000
+++ lib/lp/blueprints/browser/tests/test_views.py	2011-12-21 08:37:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """
@@ -55,7 +55,7 @@
         specs = []
         for _ in range(10):
             specs.append(self.factory.makeSpecification(
-                **{targettype:target}))
+                **{targettype: target}))
         collector = QueryCollector()
         collector.register()
         self.addCleanup(collector.unregister)
@@ -90,7 +90,7 @@
         self.check_query_counts_scaling_with_unique_people(
             self.factory.makeDistribution(),
             'distribution')
-    
+
 
 def test_suite():
     suite = unittest.TestLoader().loadTestsFromName(__name__)

=== modified file 'lib/lp/blueprints/interfaces/specificationmessage.py'
--- lib/lp/blueprints/interfaces/specificationmessage.py	2011-12-19 23:38:16 +0000
+++ lib/lp/blueprints/interfaces/specificationmessage.py	2011-12-21 08:37:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 # pylint: disable-msg=E0213
@@ -13,10 +13,7 @@
 
 from lazr.restful.fields import Reference
 from zope.interface import Interface
-from zope.schema import (
-    Bool,
-    Int,
-    )
+from zope.schema import Bool
 
 from lp.blueprints.interfaces.specification import ISpecification
 from lp.services.messages.interfaces.message import IMessage

=== modified file 'lib/lp/blueprints/interfaces/specificationtarget.py'
--- lib/lp/blueprints/interfaces/specificationtarget.py	2011-12-19 23:38:16 +0000
+++ lib/lp/blueprints/interfaces/specificationtarget.py	2011-12-21 08:37:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 # pylint: disable-msg=E0211,E0213
@@ -102,7 +102,7 @@
 
     @operation_parameters(
         name=TextLine(title=_('The name of the specification')))
-    @operation_returns_entry(Interface) # really ISpecification
+    @operation_returns_entry(Interface)  # really ISpecification
     @export_read_operation()
     @operation_for_version('devel')
     def getSpecification(name):

=== modified file 'lib/lp/blueprints/model/specificationmessage.py'
--- lib/lp/blueprints/model/specificationmessage.py	2011-12-19 23:38:16 +0000
+++ lib/lp/blueprints/model/specificationmessage.py	2011-12-21 08:37:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -13,7 +13,6 @@
     BoolCol,
     ForeignKey,
     )
-from storm.store import Store
 from zope.interface import implements
 
 from canonical.database.sqlbase import SQLBase
@@ -49,9 +48,8 @@
         """See ISpecificationMessageSet."""
         msg = Message(
             owner=owner, rfc822msgid=make_msgid('blueprint'), subject=subject)
-        chunk = MessageChunk(message=msg, content=content, sequence=1)
-        specmsg = SpecificationMessage(specification=spec, message=msg)
-        return specmsg
+        MessageChunk(message=msg, content=content, sequence=1)
+        return SpecificationMessage(specification=spec, message=msg)
 
     def get(self, specmessageid):
         """See ISpecificationMessageSet."""

=== modified file 'lib/lp/blueprints/stories/standalone/subscribing.txt'
--- lib/lp/blueprints/stories/standalone/subscribing.txt	2011-12-08 15:00:00 +0000
+++ lib/lp/blueprints/stories/standalone/subscribing.txt	2011-12-21 08:37:25 +0000
@@ -125,7 +125,8 @@
 
     >>> browser.getControl('Subscriber').value = 'stub'
     >>> browser.getControl('Subscribe').click()
-    >>> 'Stuart Bishop has been subscribed to this blueprint.' in browser.contents
+    >>> msg = "Stuart Bishop has been subscribed to this blueprint."
+    >>> msg in browser.contents
     True
 
 When we subscribe someone else to a blueprint, they get notified by
@@ -275,7 +276,10 @@
     >>> unsubit.click()
     >>> confirm = browser.getControl('Unsubscribe')
     >>> confirm.click()
-    >>> 'Launchpad Administrators has been unsubscribed from this blueprint.' in browser.contents
+    >>> msg = (
+    ...     "Launchpad Administrators has been unsubscribed from this "
+    ...     "blueprint.")
+    >>> msg in browser.contents
     True
 
 We subscribe the Ubuntu Team and an email is sent to the team's

=== modified file 'lib/lp/blueprints/stories/standalone/xx-overview.txt'
--- lib/lp/blueprints/stories/standalone/xx-overview.txt	2011-12-20 18:13:09 +0000
+++ lib/lp/blueprints/stories/standalone/xx-overview.txt	2011-12-21 08:37:25 +0000
@@ -81,7 +81,8 @@
     >>> print extract_text(find_tag_by_id(main, 'series-goal'))
     Series goal: Accepted for 1.0...
 
-We'll also target the blueprint to a milestone. First we'll create a milestone:
+We'll also target the blueprint to a milestone.  First we'll create a
+milestone:
 
     >>> browser.open('http://launchpad.dev/firefox/1.0')
     >>> browser.getLink('Create milestone').click()
@@ -182,7 +183,8 @@
     >>> print extract_text(find_tag_by_id(browser.contents, 'series-goal'))
     Series goal: Accepted for grumpy...
 
-We'll also target the blueprint to a milestone. First we'll create a milestone:
+We'll also target the blueprint to a milestone.  First we'll create a
+milestone:
 
     >>> browser.open('http://launchpad.dev/ubuntu/grumpy/')
     >>> browser.getLink('Create milestone').click()

=== modified file 'lib/lp/blueprints/tests/test_specification.py'
--- lib/lp/blueprints/tests/test_specification.py	2011-12-19 23:38:16 +0000
+++ lib/lp/blueprints/tests/test_specification.py	2011-12-21 08:37:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Unit tests for Specification."""
@@ -65,8 +65,7 @@
         product2 = self.factory.makeProduct()
         specification1 = self.factory.makeSpecification(
             product=product1, name="foo")
-        specification2 = self.factory.makeSpecification(
-            product=product2, name="foo")
+        self.factory.makeSpecification(product=product2, name="foo")
         self.assertRaises(
             TargetAlreadyHasSpecification,
             removeSecurityProxy(specification1).retarget, product2)
@@ -83,7 +82,7 @@
         product2 = self.factory.makeProduct()
         specification1 = self.factory.makeSpecification(
             product=product1, name="foo")
-        specification2 = self.factory.makeSpecification(
+        self.factory.makeSpecification(
             product=product2, name="foo")
         self.assertRaises(
             TargetAlreadyHasSpecification, specification1.validateMove,

=== modified file 'lib/lp/blueprints/vocabularies/tests/test_specificationdependency.py'
--- lib/lp/blueprints/vocabularies/tests/test_specificationdependency.py	2011-12-19 23:38:16 +0000
+++ lib/lp/blueprints/vocabularies/tests/test_specificationdependency.py	2011-12-21 08:37:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for `SpecificationDepCandidatesVocabulary`.
@@ -220,7 +220,8 @@
         # Specs on the same distribution are returned first.
         mint = self.factory.makeDistribution()
         spec = self.factory.makeSpecification(distribution=mint)
-        foo_b = self.factory.makeSpecification(name='foo-b', distribution=mint)
+        foo_b = self.factory.makeSpecification(
+            name='foo-b', distribution=mint)
         foo_a = self.factory.makeSpecification(name='foo-a')
         vocab = self.getVocabularyForSpec(spec)
         results = vocab.searchForTerms('foo')
@@ -235,9 +236,11 @@
         next = self.factory.makeDistroSeries(mint)
         spec = self.factory.makeSpecification(distribution=mint)
         spec.proposeGoal(next, mint.owner)
-        foo_c = self.factory.makeSpecification(name='foo-c', distribution=mint)
+        foo_c = self.factory.makeSpecification(
+            name='foo-c', distribution=mint)
         foo_c.proposeGoal(next, mint.owner)
-        foo_b = self.factory.makeSpecification(name='foo-b', distribution=mint)
+        foo_b = self.factory.makeSpecification(
+            name='foo-b', distribution=mint)
         foo_a = self.factory.makeSpecification(name='foo-a')
         vocab = self.getVocabularyForSpec(spec)
         results = vocab.searchForTerms('foo')

=== modified file 'lib/lp/bugs/browser/bugsubscriptionfilter.py'
--- lib/lp/bugs/browser/bugsubscriptionfilter.py	2011-12-19 23:38:16 +0000
+++ lib/lp/bugs/browser/bugsubscriptionfilter.py	2011-12-21 08:37:25 +0000
@@ -119,8 +119,9 @@
     custom_widget("importances", LabeledMultiCheckBoxWidget)
     custom_widget("tags", BugTagsFrozenSetWidget, displayWidth=35)
 
-    target = None # Define in concrete subclass to be the target of the
+    # Define in concrete subclass to be the target of the
     # structural subscription that we are modifying.
+    target = None
 
     # This is used by the AdvancedSubscriptionMixin.
     current_user_subscription = None

=== modified file 'lib/lp/bugs/browser/bugtarget.py'
--- lib/lp/bugs/browser/bugtarget.py	2011-12-19 23:38:16 +0000
+++ lib/lp/bugs/browser/bugtarget.py	2011-12-21 08:37:25 +0000
@@ -1220,7 +1220,8 @@
         elif IProduct(self.context, None):
             milestone_resultset = self.context.milestones
         else:
-            raise AssertionError("milestones_list called with illegal context")
+            raise AssertionError(
+                "milestones_list called with illegal context")
         return list(milestone_resultset)
 
     @property
@@ -1320,7 +1321,6 @@
         official_tags = self.context.official_bug_tags
         tags = self.context.getUsedBugTagsWithOpenCounts(
             self.user, 10, official_tags)
-        max_count = float(max([1] + tags.values()))
 
         return sorted(
             [dict(

=== modified file 'lib/lp/bugs/browser/cvereport.py'
--- lib/lp/bugs/browser/cvereport.py	2011-12-14 18:58:48 +0000
+++ lib/lp/bugs/browser/cvereport.py	2011-12-21 08:37:25 +0000
@@ -1,7 +1,7 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
-"""Views to generate CVE reports (as in distro and distroseries/+cve pages)."""
+"""Views to generate CVE reports (as in distro & distroseries/+cve pages)."""
 
 __metaclass__ = type
 
@@ -48,16 +48,16 @@
 
     @cachedproperty
     def open_cve_bugtasks(self):
-        """Return BugTaskCves for bugs with open bugtasks in the context."""
-        search_params = BugTaskSearchParams(self.user,
-            status=any(*UNRESOLVED_BUGTASK_STATUSES))
+        """Find BugTaskCves for bugs with open bugtasks in the context."""
+        search_params = BugTaskSearchParams(
+            self.user, status=any(*UNRESOLVED_BUGTASK_STATUSES))
         return self._buildBugTaskCves(search_params)
 
     @cachedproperty
     def resolved_cve_bugtasks(self):
-        """Return BugTaskCves for bugs with resolved bugtasks in the context."""
-        search_params = BugTaskSearchParams(self.user,
-            status=any(*RESOLVED_BUGTASK_STATUSES))
+        """Find BugTaskCves for bugs with resolved bugtasks in the context."""
+        search_params = BugTaskSearchParams(
+            self.user, status=any(*RESOLVED_BUGTASK_STATUSES))
         return self._buildBugTaskCves(search_params)
 
     def setContextForParams(self, params):
@@ -87,16 +87,15 @@
                 has_bug_branch=badges['has_branch'],
                 has_specification=badges['has_specification'],
                 has_patch=badges['has_patch'])
-            if not bugtaskcves.has_key(bugtask.bug.id):
+            if bugtask.bug.id not in bugtaskcves:
                 bugtaskcves[bugtask.bug.id] = BugTaskCve()
             bugtaskcves[bugtask.bug.id].bugtasks.append(bugtask)
 
         bugcves = getUtility(ICveSet).getBugCvesForBugTasks(bugtasks)
         for bugcve in bugcves:
-            assert bugtaskcves.has_key(bugcve.bug.id)
+            assert bugcve.bug.id in bugtaskcves, "Bug missing in bugcves."
             bugtaskcves[bugcve.bug.id].cves.append(bugcve.cve)
 
         # Order the dictionary items by bug ID and then return only the
         # bugtaskcve objects.
         return [bugtaskcve for bug, bugtaskcve in sorted(bugtaskcves.items())]
-

=== modified file 'lib/lp/bugs/browser/tests/bug-nomination-views.txt'
--- lib/lp/bugs/browser/tests/bug-nomination-views.txt	2011-12-08 21:27:03 +0000
+++ lib/lp/bugs/browser/tests/bug-nomination-views.txt	2011-12-21 08:37:25 +0000
@@ -1,4 +1,5 @@
-= Bug Nomination Pages =
+Bug Nomination Pages
+====================
 
 Series targeting is done on the +nominate page of a bug. From here,
 bug supervisors can propose that the bug be fixed in specific distribution
@@ -39,7 +40,8 @@
     >>> launchbag = getUtility(IOpenLaunchBag)
 
 
-== Submitting Nominations ==
+Submitting Nominations
+----------------------
 
 BugNominationView is a LaunchpadFormView. It expects a "submit" action
 to process nominations.
@@ -123,9 +125,11 @@
     Added nominations for: Mozilla Firefox trunk
 
 
-== Approving and Declining Nominations ==
+Approving and Declining Nominations
+-----------------------------------
 
-=== On the bug page ===
+On the bug page
+...............
 
 Nominations are listed in the same table on the bug page that shows
 bugtasks, rendered in a way that makes them look obviously different
@@ -163,7 +167,8 @@
     False
 
 
-=== From a series listing ===
+From a series listing
+.....................
 
 Nominations are also listed on the +nomination page for a series.
 
@@ -211,7 +216,8 @@
     Ubuntu bug: True
 
 
-== Series Targeting For Release Managers ==
+Series Targeting For Release Managers
+-------------------------------------
 
 When a release manager "nominates" a bug, the nomination is immediately
 approved. The nomination is created only to communicate when and by whom
@@ -295,7 +301,8 @@
     Targeted bug to: Ubuntu Grumpy
 
 
-== IPrimaryContext for BugNominations ==
+IPrimaryContext for BugNominations
+----------------------------------
 
 A BugNomination can be adapted to its IPrimaryContext for use with
 menus. The IPrimaryContext for a BugNomination is the IBugTarget

=== modified file 'lib/lp/bugs/browser/tests/test_bugsubscriptionfilter.py'
--- lib/lp/bugs/browser/tests/test_bugsubscriptionfilter.py	2011-12-19 23:38:16 +0000
+++ lib/lp/bugs/browser/tests/test_bugsubscriptionfilter.py	2011-12-21 08:37:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for bug subscription filter browser code."""
@@ -31,7 +31,6 @@
     )
 from lp.testing import (
     anonymous_logged_in,
-    feature_flags,
     login_person,
     normalize_whitespace,
     person_logged_in,

=== modified file 'lib/lp/bugs/browser/tests/test_bugtarget_tags.py'
--- lib/lp/bugs/browser/tests/test_bugtarget_tags.py	2011-12-19 23:38:16 +0000
+++ lib/lp/bugs/browser/tests/test_bugtarget_tags.py	2011-12-21 08:37:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 __metaclass__ = type
@@ -39,10 +39,12 @@
     def test_tags_order(self):
         """Test that the tags are ordered by most used first"""
         self.factory.makeBug(product=self.target_product, tags=['tag-last'])
-        for i in range(0, 2):
-            self.factory.makeBug(product=self.target_product, tags=['tag-middle'])
-        for i in range(0, 3):
-            self.factory.makeBug(product=self.target_product, tags=['tag-first'])
+        for counter in range(0, 2):
+            self.factory.makeBug(
+                product=self.target_product, tags=['tag-middle'])
+        for counter in range(0, 3):
+            self.factory.makeBug(
+                product=self.target_product, tags=['tag-first'])
         view = create_view(
             self.project,
             name="+bugtarget-portlet-tags-content",

=== modified file 'lib/lp/bugs/browser/tests/test_bugtracker_views.py'
--- lib/lp/bugs/browser/tests/test_bugtracker_views.py	2011-12-19 23:38:16 +0000
+++ lib/lp/bugs/browser/tests/test_bugtracker_views.py	2011-12-21 08:37:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for BugTracker views."""
@@ -7,13 +7,11 @@
 
 from zope.component import getUtility
 
-from canonical.launchpad.testing.pages import find_tag_by_id
 from canonical.launchpad.webapp import canonical_url
 from canonical.testing.layers import DatabaseFunctionalLayer
 from lp.bugs.interfaces.bugtracker import IBugTrackerSet
 from lp.registry.interfaces.person import IPersonSet
 from lp.testing import (
-    login,
     person_logged_in,
     TestCaseWithFactory,
     )
@@ -55,4 +53,3 @@
         #    find_tag_by_id(content, 'lower-batch-nav-batchnav-next')['class'])
         # Instead we check the string appears.
         self.assertTrue('upper-batch-nav-batchnav-next' in content)
-

=== modified file 'lib/lp/bugs/browser/tests/test_bugwatch_views.py'
--- lib/lp/bugs/browser/tests/test_bugwatch_views.py	2011-12-19 23:38:16 +0000
+++ lib/lp/bugs/browser/tests/test_bugwatch_views.py	2011-12-21 08:37:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests for BugWatch views."""
@@ -51,7 +51,7 @@
         # We need to log in as an admin here as only admins can link a
         # watch to a comment.
         login(ADMIN_EMAIL)
-        bug_message = self.bug_watch.addComment('comment-id', message)
+        self.bug_watch.addComment('comment-id', message)
         login_person(self.person)
         view = create_initialized_view(self.bug_watch, '+edit')
         self.assertFalse(

=== modified file 'lib/lp/bugs/interfaces/cve.py'
--- lib/lp/bugs/interfaces/cve.py	2011-12-19 15:09:08 +0000
+++ lib/lp/bugs/interfaces/cve.py	2011-12-21 08:37:25 +0000
@@ -110,9 +110,9 @@
         CollectionField(
             title=_('Bugs related to this CVE entry.'),
             readonly=True,
-            value_type=Reference(schema=Interface))) # Redefined in bug.py
+            value_type=Reference(schema=Interface))) #  Redefined in bug.py.
 
-    # other attributes
+    # Other attributes.
     url = exported(
         TextLine(title=_('URL'),
                  description=_("Return a URL to the site that has the CVE "

=== modified file 'lib/lp/bugs/interfaces/personsubscriptioninfo.py'
--- lib/lp/bugs/interfaces/personsubscriptioninfo.py	2011-12-19 23:38:16 +0000
+++ lib/lp/bugs/interfaces/personsubscriptioninfo.py	2011-12-21 08:37:25 +0000
@@ -17,12 +17,7 @@
     Attribute,
     Interface,
     )
-from zope.schema import (
-    Bool,
-    Choice,
-    Datetime,
-    Int,
-    )
+from zope.schema import Bool
 
 from canonical.launchpad import _
 from lp.services.fields import (
@@ -59,12 +54,12 @@
 
     security_contact_tasks = Attribute(
         """A collection of targets of the info's bug for which the
-        principal is a security contact (which causes direct subscriptions for 
+        principal is a security contact (which causes direct subscriptions for
         security related bugs at this time).""")
 
     bug_supervisor_tasks = Attribute(
         """A collection of targets of the info's bug for which the
-        principal is a bug supervisor (which causes direct subscriptions for 
+        principal is a bug supervisor (which causes direct subscriptions for
         private bugs at this time).""")
 
 
@@ -157,7 +152,7 @@
 
     def getDataForClient():
         """Get data for use in client-side code.
-        
+
         Returns two dicts, subscription info and references.  references is
         expected to be used as
         IJSONRequestCache(request).objects.extend(references).
@@ -166,7 +161,7 @@
         structure, values are strings that are keys into the "references"
         map.  With expected usage, then, on the client side LP.cache[name]
         would return the desired value.
-        
+
         subscription info roughly mirrors the structure of the
         IPersonSubscriptions that sends it.
         """

=== modified file 'lib/lp/bugs/javascript/bugtarget_portlet_bugtags.js'
--- lib/lp/bugs/javascript/bugtarget_portlet_bugtags.js	2011-11-10 04:11:45 +0000
+++ lib/lp/bugs/javascript/bugtarget_portlet_bugtags.js	2011-12-21 08:37:25 +0000
@@ -20,31 +20,32 @@
     var io_config = {on: {start: namespace.show_spinner,
                           success: namespace.on_success,
                           end: namespace.hide_spinner}};
-    var url = Y.one('#tags-content-link').getAttribute('href').replace('bugs.', '');
+    var url = Y.one('#tags-content-link').getAttribute('href').replace(
+        'bugs.', '');
     var io_provider = Y.lp.client.get_configured_io_provider(config);
     io_provider.io(url, io_config);
-}
+};
 
 /**
  * Show the loading spinner.
  */
 namespace.show_spinner = function() {
     spinner.removeClass('hidden');
-}
+};
 
 /**
  * Hide the loading spinner.
  */
 namespace.hide_spinner = function() {
     spinner.addClass('hidden');
-}
+};
 
 /**
  * Display the tag list and set up events for showing more/less tags.
  */
 namespace.on_success = function(transactionid, response, arguments) {
     var portlet = Y.one('#portlet-tags');
-    if (Y.Lang.trim(response.responseText).length == 0) {
+    if (Y.Lang.trim(response.responseText).length === 0) {
         portlet.addClass('hidden');
     }
     else {
@@ -70,6 +71,6 @@
             });
         }
     }
-}
+};
 
 }, "0.1", {"requires": ["node", 'io-base']});

=== modified file 'lib/lp/bugs/javascript/tests/test_bugtarget_portlet_bugtags.js'
--- lib/lp/bugs/javascript/tests/test_bugtarget_portlet_bugtags.js	2011-11-18 01:45:41 +0000
+++ lib/lp/bugs/javascript/tests/test_bugtarget_portlet_bugtags.js	2011-12-21 08:37:25 +0000
@@ -1,5 +1,5 @@
-YUI().use('lp.testing.runner', 'lp.testing.mockio', 'test', 'console', 
-          'lp.client', 'node-event-simulate', 'lp.bugs.bugtask.taglist', 
+YUI().use('lp.testing.runner', 'lp.testing.mockio', 'test', 'console',
+          'lp.client', 'node-event-simulate', 'lp.bugs.bugtask.taglist',
     function(Y) {
 
     var module = Y.lp.bugs.bugtask.taglist;
@@ -13,46 +13,51 @@
                 Y.one('#show-more-tags-link').addClass('hidden');
                 Y.one('#show-less-tags-link').addClass('hidden');
             },
-        
+
         test_io_url: function() {
             var mockio = new Y.lp.testing.mockio.MockIo();
             module.setup_taglist({io_provider: mockio});
             mockio.success({
-                responseText: '<div class="portletBody"><div class="section">'+
-                              '<h2>Tags</h2><ul class="tag-list">'+
-                              '</ul></div></div>',
+                responseText:
+                    '<div class="portletBody"><div class="section">' +
+                    '<h2>Tags</h2><ul class="tag-list">' +
+                    '</ul></div></div>',
                 responseHeaders: {'Content-type': 'text/html'}});
             Y.Assert.areEqual('/launchpad/+bugtarget-portlet-tags-content',
                               mockio.last_request.url,
                               'The url should have been set');
             },
-        
+
         test_no_tags: function() {
             var mockio = new Y.lp.testing.mockio.MockIo();
             module.setup_taglist({io_provider: mockio});
             mockio.success({
-                responseText: '<div class="portletBody"><div class="section">'+
-                              '<h2>Tags</h2><ul class="tag-list">'+
-                              '</ul></div></div>',
+                responseText:
+                    '<div class="portletBody"><div class="section">' +
+                    '<h2>Tags</h2><ul class="tag-list">' +
+                    '</ul></div></div>',
                 responseHeaders: {'Content-type': 'text/html'}});
             var tags = Y.all('.tag-list li');
             var show_more_link = Y.one('#show-more-tags-link');
             var show_less_link = Y.one('#show-less-tags-link');
             Y.Assert.areEqual(0, tags.size(), 'The list should be empty');
-            Y.Assert.isTrue(show_more_link.hasClass('hidden'),
-                'The show more link should be hidden');
-            Y.Assert.isTrue(show_less_link.hasClass('hidden'),
-                'The show less link should be hidden');
+            Y.Assert.isTrue(
+                show_more_link.hasClass('hidden'),
+                "The 'show more' link should be hidden.");
+            Y.Assert.isTrue(
+                show_less_link.hasClass('hidden'),
+                "The 'show less' link should be hidden.");
             },
-        
+
         test_twenty_tags_or_less: function() {
             var mockio = new Y.lp.testing.mockio.MockIo();
+            var response = '<div class="portletBody"><div class="section">' +
+                '<h2>Tags</h2><ul class="tag-list">';
+            var i;
             module.setup_taglist({io_provider: mockio});
-            var response = '<div class="portletBody"><div class="section">'+
-                              '<h2>Tags</h2><ul class="tag-list">';
-            for (var i=0; i<=5; i++) {
-                response += '<li><span class="tag-count">'+i+'</span>'+
-                        '<a href="+bugs?field.tag=crash">tag'+i+'</a></li>';
+            for (i=0; i<=5; i++) {
+                response += '<li><span class="tag-count">'+i+'</span>' +
+                    '<a href="+bugs?field.tag=crash">tag'+i+'</a></li>';
             }
             response += '</ul></div></div>';
             mockio.success({
@@ -62,21 +67,22 @@
             var show_more_link = Y.one('#show-more-tags-link');
             var show_less_link = Y.one('#show-less-tags-link');
             Y.assert(tags.size() <= 20,
-                'The list should have twenty tags or less');
+                "The list should have twenty tags or less.");
             Y.Assert.isTrue(show_more_link.hasClass('hidden'),
-                'The show more link should be hidden');
+                "The 'show more' link should be hidden.");
             Y.Assert.isTrue(show_less_link.hasClass('hidden'),
-                'The show less link should be hidden');
+                "The 'show less' link should be hidden.");
             },
 
         test_more_than_twenty_tags: function() {
             var mockio = new Y.lp.testing.mockio.MockIo();
+            var response = '<div class="portletBody"><div class="section">' +
+                '<h2>Tags</h2><ul class="tag-list">';
+            var i;
             module.setup_taglist({io_provider: mockio});
-            var response = '<div class="portletBody"><div class="section">'+
-                              '<h2>Tags</h2><ul class="tag-list">';
-            for (var i=0; i<=22; i++) {
-                response += '<li><span class="tag-count">'+i+'</span>'+
-                        '<a href="+bugs?field.tag=crash">tag'+i+'</a></li>';
+            for (i=0; i<=22; i++) {
+                response += '<li><span class="tag-count">' + i + '</span>' +
+                    '<a href="+bugs?field.tag=crash">tag'+ i + '</a></li>';
             }
             response += '</ul></div></div>';
             mockio.success({
@@ -85,7 +91,7 @@
             var tags = Y.all('.tag-list li');
             var show_more_link = Y.one('#show-more-tags-link');
             var show_less_link = Y.one('#show-less-tags-link');
-            var tag_count = tags.size()
+            var tag_count = tags.size();
             Y.assert(tag_count > 20,
                 'The list should have more than twenty tags');
             Y.Assert.areEqual(20, tag_count - tags.filter('.hidden').size(),
@@ -108,7 +114,7 @@
                 'The show less link should now be hidden');
             Y.Assert.isFalse(show_more_link.hasClass('hidden'),
                 'The show more link should now be visible');
-            },
+            }
         }));
 
     Y.lp.testing.Runner.run(suite);