launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #05150
[Merge] lp:~jtv/launchpad/minilint-3 into lp:launchpad
Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/minilint-3 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jtv/launchpad/minilint-3/+merge/77731
= Summary =
Cleaning up some lint that people left lying around in files they touched.
= Launchpad lint =
I had to leave a little bit behind myself. Hopefully this will soon become unusual enough that people will notice and fix it (even if it takes a bit more creativity).
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/registry/stories/person/xx-person-bugs.txt
lib/lp/bugs/doc/security-teams.txt
scripts/ftpmaster-tools/archive-integrity-check.py
lib/lp/registry/model/productseries.py
lib/lp/archivepublisher/tests/test_generate_contents_files.py
lib/lp/bugs/doc/initial-bug-contacts.txt
lib/lp/bugs/doc/bugsubscription.txt
lib/lp/bugs/stories/webservice/xx-bug.txt
lib/lp/soyuz/scripts/ftpmaster.py
lib/lp/bugs/interfaces/bugtarget.py
lib/lp/bugs/doc/bug-heat.txt
lib/lp/code/model/tests/test_revision.py
./lib/lp/bugs/stories/webservice/xx-bug.txt
53: want exceeds 78 characters.
170: source exceeds 78 characters.
176: source exceeds 78 characters.
265: source exceeds 78 characters.
349: want exceeds 78 characters.
839: source exceeds 78 characters.
1152: want exceeds 78 characters.
1196: want exceeds 78 characters.
1319: want exceeds 78 characters.
1370: want exceeds 78 characters.
1625: source exceeds 78 characters.
1998: source exceeds 78 characters.
2108: want exceeds 78 characters.
--
https://code.launchpad.net/~jtv/launchpad/minilint-3/+merge/77731
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/minilint-3 into lp:launchpad.
=== modified file 'lib/lp/archivepublisher/tests/test_generate_contents_files.py'
--- lib/lp/archivepublisher/tests/test_generate_contents_files.py 2011-09-28 00:34:04 +0000
+++ lib/lp/archivepublisher/tests/test_generate_contents_files.py 2011-09-30 16:09:36 +0000
@@ -7,7 +7,6 @@
from optparse import OptionValueError
import os
-from textwrap import dedent
from testtools.matchers import StartsWith
=== modified file 'lib/lp/bugs/doc/bug-heat.txt'
--- lib/lp/bugs/doc/bug-heat.txt 2011-09-27 12:35:43 +0000
+++ lib/lp/bugs/doc/bug-heat.txt 2011-09-30 16:09:36 +0000
@@ -68,7 +68,8 @@
We current use a feature flag for some privacy related subscription stuff.
>>> from lp.services.features.testing import FeatureFixture
- >>> feature_flag = {'disclosure.enhanced_private_bug_subscriptions.enabled': 'on'}
+ >>> feature_flag = {
+ ... 'disclosure.enhanced_private_bug_subscriptions.enabled': 'on'}
>>> flags = FeatureFixture(feature_flag)
>>> flags.setUp()
=== modified file 'lib/lp/bugs/doc/bugsubscription.txt'
--- lib/lp/bugs/doc/bugsubscription.txt 2011-09-27 12:10:50 +0000
+++ lib/lp/bugs/doc/bugsubscription.txt 2011-09-30 16:09:36 +0000
@@ -383,11 +383,12 @@
will be automatically subscribed, and only specifically allowed existing
direct subscribers (eg bugtask pillar maintainers) will remain subscribed.
-We current use a feature flag to control who is subscribed when a bug is made
-private.
+We currently use a feature flag to control who is subscribed when a bug is
+made private.
>>> from lp.services.features.testing import FeatureFixture
- >>> feature_flag = {'disclosure.enhanced_private_bug_subscriptions.enabled': 'on'}
+ >>> feature_flag = {
+ ... 'disclosure.enhanced_private_bug_subscriptions.enabled': 'on'}
>>> flags = FeatureFixture(feature_flag)
>>> flags.setUp()
=== modified file 'lib/lp/bugs/doc/initial-bug-contacts.txt'
--- lib/lp/bugs/doc/initial-bug-contacts.txt 2011-09-27 12:10:50 +0000
+++ lib/lp/bugs/doc/initial-bug-contacts.txt 2011-09-30 16:09:36 +0000
@@ -289,11 +289,12 @@
u'Ubuntu Team']
-We current use a feature flag to control who is subscribed when a bug is made
-private.
+We currently use a feature flag to control who is subscribed when a bug is
+made private.
>>> from lp.services.features.testing import FeatureFixture
- >>> feature_flag = {'disclosure.enhanced_private_bug_subscriptions.enabled': 'on'}
+ >>> feature_flag = {
+ ... 'disclosure.enhanced_private_bug_subscriptions.enabled': 'on'}
>>> flags = FeatureFixture(feature_flag)
>>> flags.setUp()
=== modified file 'lib/lp/bugs/doc/security-teams.txt'
--- lib/lp/bugs/doc/security-teams.txt 2011-09-27 12:30:39 +0000
+++ lib/lp/bugs/doc/security-teams.txt 2011-09-30 16:09:36 +0000
@@ -283,11 +283,12 @@
affects are subscribed to it. This happens regardless of whether the feature
flag is set.
-We current use a feature flag to control who is subscribed when a bug is made
-security related.
+We currently use a feature flag to control who is subscribed when a bug is
+made security related.
>>> from lp.services.features.testing import FeatureFixture
- >>> feature_flag = {'disclosure.enhanced_private_bug_subscriptions.enabled': 'on'}
+ >>> feature_flag = {
+ ... 'disclosure.enhanced_private_bug_subscriptions.enabled': 'on'}
>>> flags = FeatureFixture(feature_flag)
>>> flags.setUp()
=== modified file 'lib/lp/bugs/interfaces/bugtarget.py'
--- lib/lp/bugs/interfaces/bugtarget.py 2011-09-28 03:28:50 +0000
+++ lib/lp/bugs/interfaces/bugtarget.py 2011-09-30 16:09:36 +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).
# pylint: disable-msg=E0211,E0213
@@ -223,10 +223,10 @@
@operation_parameters(**search_tasks_params_for_api_devel)
@operation_returns_collection_of(IBugTask)
@export_read_operation()
-
+ #
# Pop the *default* version (decorators are run last to first).
@operation_removed_in_version('devel')
-
+ #
# searchTasks default API declaration.
@call_with(search_params=None, user=REQUEST_USER)
@operation_parameters(**search_tasks_params_for_api_default)
@@ -401,12 +401,13 @@
"""Return name and bug count of tags having open bugs.
:param user: The user who wants the report.
- :param tag_limit: The number of tags to return (excludes those found by
- matching include_tags). If 0 then all tags are returned. If
+ :param tag_limit: The number of tags to return (excludes those found
+ by matching include_tags). If 0 then all tags are returned. If
non-zero then the most frequently used tags are returned.
:param include_tags: A list of string tags to return irrespective of
- usage. Tags in this list that have no open bugs are returned with a
- count of 0. May be None if there are tags to require inclusion of.
+ usage. Tags in this list that have no open bugs are returned with
+ a count of 0. May be None if there are tags to require inclusion
+ of.
:return: A dict from tag -> count.
"""
@@ -456,8 +457,8 @@
target = Object(
title=u'The target of this bug tag.',
schema=IOfficialBugTagTarget,
- description=
- u'The distribution or product having this official bug tag.')
+ description=(
+ u'The distribution or product having this official bug tag.'))
class ISeriesBugTarget(Interface):
=== modified file 'lib/lp/bugs/stories/webservice/xx-bug.txt'
--- lib/lp/bugs/stories/webservice/xx-bug.txt 2011-09-28 23:28:22 +0000
+++ lib/lp/bugs/stories/webservice/xx-bug.txt 2011-09-30 16:09:36 +0000
@@ -2055,8 +2055,8 @@
Bug expiration
--------------
-In addition to can_expire bugs have an isExpirable method to which a custom time
-period, days_old, can be passed. This is then used with
+In addition to can_expire bugs have an isExpirable method to which a custom
+time period, days_old, can be passed. This is then used with
findExpirableBugTasks. This allows projects to create their own janitor using
a different period for bug expiration.
=== modified file 'lib/lp/code/model/tests/test_revision.py'
--- lib/lp/code/model/tests/test_revision.py 2011-09-08 03:28:55 +0000
+++ lib/lp/code/model/tests/test_revision.py 2011-09-30 16:09:36 +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).
"""Tests for Revisions."""
@@ -25,7 +25,6 @@
)
from canonical.launchpad.interfaces.account import AccountStatus
from canonical.launchpad.interfaces.lpstorm import IMasterObject
-from lp.scripts.garbo import RevisionAuthorEmailLinker
from canonical.launchpad.webapp.interfaces import (
DEFAULT_FLAVOR,
IStoreSelector,
@@ -40,6 +39,7 @@
RevisionSet,
)
from lp.registry.model.karma import Karma
+from lp.scripts.garbo import RevisionAuthorEmailLinker
from lp.services.log.logger import DevNullLogger
from lp.testing import (
TestCaseWithFactory,
@@ -309,7 +309,7 @@
def testAllowPrivateReturnsPrivateBranch(self):
# If the allow_private flag is set, then private branches can be
# returned if they are the best match.
- b1 = self.makeBranchWithRevision(1)
+ self.makeBranchWithRevision(1)
b2 = self.makeBranchWithRevision(1, owner=self.author)
removeSecurityProxy(b2).explicitly_private = True
self.assertEqual(b2, self.revision.getBranch(allow_private=True))
@@ -503,7 +503,7 @@
# The revision must be in a branch for the product.
# returned.
rev1 = self._makeRevisionInBranch(product=self.product)
- rev2 = self._makeRevisionInBranch()
+ self._makeRevisionInBranch()
self.assertEqual([rev1], self._getRevisions())
@@ -526,7 +526,7 @@
# The revision must be in a branch for the product.
# returned.
rev1 = self._makeRevisionInBranch(product=self.product)
- rev2 = self._makeRevisionInBranch()
+ self._makeRevisionInBranch()
self.assertEqual([rev1], self._getRevisions())
def testProjectRevisions(self):
@@ -534,7 +534,7 @@
another_product = self.factory.makeProduct(project=self.project)
rev1 = self._makeRevisionInBranch(product=self.product)
rev2 = self._makeRevisionInBranch(product=another_product)
- rev3 = self._makeRevisionInBranch()
+ self._makeRevisionInBranch()
self.assertEqual([rev2, rev1], self._getRevisions())
@@ -553,18 +553,17 @@
def testRevisionAuthorMatchesRevision(self):
# The revision author returned with the revision is the same as the
# author for the revision.
- rev1 = self._makeRevisionInBranch(product=self.product)
+ self._makeRevisionInBranch(product=self.product)
results = self._getRecentRevisions()
- self.assertEqual(1, len(results))
- revision, revision_author = results[0]
+ [(revision, revision_author)] = results
self.assertEqual(revision.revision_author, revision_author)
def testRevisionsMustBeInABranchOfProduct(self):
# The revisions returned revision must be in a branch for the product.
rev1 = self._makeRevisionInBranch(product=self.product)
- rev2 = self._makeRevisionInBranch()
- self.assertEqual([(rev1, rev1.revision_author)],
- self._getRecentRevisions())
+ self._makeRevisionInBranch()
+ self.assertEqual(
+ [(rev1, rev1.revision_author)], self._getRecentRevisions())
def testRevisionsMustBeInActiveBranches(self):
# The revisions returned revision must be in a branch for the product.
@@ -636,8 +635,7 @@
self._breakTransaction()
self.assertEqual(1, len(revisions))
revision = revisions[0]
- self.assertEqual(self.branches[0].last_scanned_id,
- revision.revision_id)
+ self.assertEqual(last_scanned_id, revision.revision_id)
# By accessing to the revision_author we can confirm that the
# revision author has in fact been retrieved already.
revision_author = revision.revision_author
=== modified file 'lib/lp/registry/model/productseries.py'
--- lib/lp/registry/model/productseries.py 2011-09-28 03:28:50 +0000
+++ lib/lp/registry/model/productseries.py 2011-09-30 16:09:36 +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=E0611,W0212
@@ -68,14 +68,11 @@
ISeriesBugTarget,
)
from lp.bugs.interfaces.bugtaskfilter import OrderedBugTask
-from lp.bugs.model.bug import (
- get_bug_tags,
- )
+from lp.bugs.model.bug import get_bug_tags
from lp.bugs.model.bugtarget import (
BugTargetBase,
HasBugHeatMixin,
)
-from lp.bugs.model.bugtask import BugTask
from lp.bugs.model.structuralsubscription import (
StructuralSubscriptionTargetMixin,
)
@@ -581,12 +578,12 @@
origin = [Language, POFile, POTemplate]
query = store.using(*origin).find(
(Language, POFile),
- POFile.language==Language.id,
- Language.visible==True,
- POFile.potemplate==POTemplate.id,
- POTemplate.productseries==self,
- POTemplate.iscurrent==True,
- Language.id!=english.id)
+ POFile.language == Language.id,
+ Language.visible == True,
+ POFile.potemplate == POTemplate.id,
+ POTemplate.productseries == self,
+ POTemplate.iscurrent == True,
+ Language.id != english.id)
ordered_results = query.order_by(['Language.englishname'])
@@ -605,9 +602,10 @@
else:
# If there is more than one template, do a single
# query to count total messages in all templates.
- query = store.find(Sum(POTemplate.messagecount),
- POTemplate.productseries==self,
- POTemplate.iscurrent==True)
+ query = store.find(
+ Sum(POTemplate.messagecount),
+ POTemplate.productseries == self,
+ POTemplate.iscurrent == True)
total, = query
# And another query to fetch all Languages with translations
# in this ProductSeries, along with their cumulative stats
@@ -620,12 +618,12 @@
Sum(POFile.rosettacount),
Sum(POFile.unreviewed_count),
Max(POFile.date_changed)),
- POFile.language==Language.id,
- Language.visible==True,
- POFile.potemplate==POTemplate.id,
- POTemplate.productseries==self,
- POTemplate.iscurrent==True,
- Language.id!=english.id).group_by(Language)
+ POFile.language == Language.id,
+ Language.visible == True,
+ POFile.potemplate == POTemplate.id,
+ POTemplate.productseries == self,
+ POTemplate.iscurrent == True,
+ Language.id != english.id).group_by(Language)
ordered_results = query.order_by(['Language.englishname'])
=== modified file 'lib/lp/registry/stories/person/xx-person-bugs.txt'
--- lib/lp/registry/stories/person/xx-person-bugs.txt 2011-09-30 01:33:40 +0000
+++ lib/lp/registry/stories/person/xx-person-bugs.txt 2011-09-30 16:09:36 +0000
@@ -1,4 +1,5 @@
-= Bugs a given user is involved with =
+Bugs a given user is involved with
+==================================
When visiting the 'Bugs' facet of a person, the report that is displayed
lists the bug assigned to that person.
@@ -7,11 +8,12 @@
>>> anon_browser.getLink('Bugs').click()
>>> print anon_browser.title
Related bugs
+
>>> print anon_browser.url
http://bugs.launchpad.dev/~name12
-Note that we may see each bug more than once in case it's reported against
-more than one target (https://launchpad.net/bugs/1357).
+Note that we may see each bug more than once in case it's reported
+against more than one target (https://launchpad.net/bugs/1357).
>>> from lp.bugs.tests.bug import print_bugtasks
>>> print_bugtasks(anon_browser.contents)
@@ -50,17 +52,20 @@
Related bugs
-== More specific listings ==
-
-On a person bugs facet we get links to all listings of bugs we have for that
-person.
-
-
-=== Assigned bugs ===
+More specific listings
+----------------------
+
+On a person bugs facet we get links to all listings of bugs we have for
+that person.
+
+
+Assigned bugs
+.............
>>> anon_browser.getLink('Assigned bugs').click()
>>> print anon_browser.title
Assigned bugs : Sample Person
+
>>> print anon_browser.url
http://bugs.launchpad.dev/~name12/+assignedbugs
@@ -73,18 +78,20 @@
Confirmed
-=== Commented bugs ===
+Commented bugs
+..............
>>> anon_browser.getLink('Commented bugs').click()
>>> print anon_browser.title
Commented bugs : Sample Person
+
>>> print anon_browser.url
http://bugs.launchpad.dev/~name12/+commentedbugs
-No Privileges Person has commented on two bugs, which will be returned by the
-commented bug search (the bugs will be listed several times over; it is enough
-for us to test for the first instances of each here. This is an instance of Bug
-1357).
+No Privileges Person has commented on two bugs, which will be returned
+by the commented bug search (the bugs will be listed several times over;
+it is enough for us to test for the first instances of each here. This
+is an instance of Bug 1357).
>>> print_bugtasks(anon_browser.contents)
1 Firefox does not support SVG
@@ -94,11 +101,13 @@
...
-=== Reported bugs ===
+Reported bugs
+.............
>>> anon_browser.getLink('Reported bugs').click()
>>> print anon_browser.title
Reported bugs : Sample Person
+
>>> print anon_browser.url
http://bugs.launchpad.dev/~name12/+reportedbugs
@@ -123,11 +132,13 @@
Launchpad Undecided New
-=== Subscribed bugs ===
+Subscribed bugs
+...............
>>> anon_browser.getLink('Subscribed bugs').click()
>>> print anon_browser.title
Subscribed bugs : Sample Person
+
>>> print anon_browser.url
http://bugs.launchpad.dev/~name12/+subscribedbugs
@@ -145,24 +156,33 @@
13 Launchpad CSS and JS is not testible
Launchpad Undecided New
-=== Person bugs menu ===
-
-The person bugs page can be accessed without being in the bugs
-site, yet all the menu links point to the bugs site.
+
+Person bugs menu
+................
+
+The person bugs page can be accessed without being in the bugs site, yet
+all the menu links point to the bugs site.
>>> anon_browser.open('http://launchpad.dev/~name12/+assignedbugs')
>>> print anon_browser.getLink('Commented bugs').url
http://bugs.launchpad.dev/~name12/+commentedbugs
+
>>> print anon_browser.getLink('Reported bugs').url
http://bugs.launchpad.dev/~name12/+reportedbugs
+
>>> print anon_browser.getLink('Subscribed bugs').url
http://bugs.launchpad.dev/~name12/+subscribedbugs
+
>>> print anon_browser.getLink('All related bugs').url
http://bugs.launchpad.dev/~name12
+
>>> print anon_browser.getLink('Subscribed packages').url
http://bugs.launchpad.dev/~name12/+packagebugs
+
>>> anon_browser.open('http://launchpad.dev/~name12/+commentedbugs')
>>> print anon_browser.getLink('Assigned bugs').url
http://bugs.launchpad.dev/~name12/+assignedbugs
+
>>> print anon_browser.getLink('Affecting bugs').url
http://bugs.launchpad.dev/~name12/+affectingbugs
+
=== modified file 'lib/lp/soyuz/scripts/ftpmaster.py'
--- lib/lp/soyuz/scripts/ftpmaster.py 2011-09-29 13:01:04 +0000
+++ lib/lp/soyuz/scripts/ftpmaster.py 2011-09-30 16:09:36 +0000
@@ -17,15 +17,12 @@
'SyncSourceError',
]
-import commands
import hashlib
import os
import stat
import sys
-import tempfile
import time
-import apt_pkg
from debian.deb822 import Changes
from zope.component import getUtility
@@ -37,17 +34,9 @@
)
from canonical.librarian.utils import copy_and_close
from lp.app.errors import NotFoundError
-from lp.app.interfaces.launchpad import ILaunchpadCelebrities
-from lp.archiveuploader.utils import (
- determine_source_file_type,
- re_extract_src_version,
- )
-from lp.registry.interfaces.distribution import IDistributionSet
+from lp.archiveuploader.utils import determine_source_file_type
from lp.registry.interfaces.person import IPersonSet
-from lp.registry.interfaces.pocket import (
- PackagePublishingPocket,
- pocketsuffix,
- )
+from lp.registry.interfaces.pocket import pocketsuffix
from lp.registry.interfaces.series import SeriesStatus
from lp.registry.interfaces.sourcepackage import SourcePackageFileType
from lp.services.browser_helpers import get_plural_text
@@ -60,7 +49,6 @@
PackageLocationError,
)
from lp.soyuz.enums import PackagePublishingStatus
-from lp.soyuz.interfaces.binarypackagename import IBinaryPackageNameSet
from lp.soyuz.scripts.ftpmasterbase import (
SoyuzScript,
SoyuzScriptError,
=== modified file 'scripts/ftpmaster-tools/archive-integrity-check.py'
--- scripts/ftpmaster-tools/archive-integrity-check.py 2011-09-30 01:21:17 +0000
+++ scripts/ftpmaster-tools/archive-integrity-check.py 2011-09-30 16:09:36 +0000
@@ -1,11 +1,11 @@
#!/usr/bin/python
#
-# 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).
# Check the integrity of an archive via it's indices files
-################################################################################
+##############################################################################
import commands
import os
@@ -15,18 +15,20 @@
import apt_pkg
-################################################################################
+##############################################################################
Filelist = None
ArchiveRoot = "/srv/launchpad.net/ubuntu-archive/ubuntu/"
Count = 0
-################################################################################
+##############################################################################
+
def error(msg):
sys.stderr.write("E: %s\n" % (msg))
-################################################################################
+##############################################################################
+
def check_file(filename, md5sum_expected, size_expected):
global Count
@@ -59,14 +61,16 @@
sys.stdout.write(".")
sys.stdout.flush()
-################################################################################
-
+##############################################################################
+
+
def validate_sources(sources_filename, suite, component):
if suite == "dapper":
return
sys.stdout.write("Checking %s/%s/source: " % (suite, component))
sys.stdout.flush()
- # apt_pkg.ParseTagFile needs a real file handle and can't handle a GzipFile instance...
+ # apt_pkg.ParseTagFile needs a real file handle and can't handle a
+ # GzipFile instance...
sources = NamedTemporaryFile()
(result, output) = commands.getstatusoutput("gunzip -c %s > %s" \
% (sources_filename,
@@ -87,7 +91,8 @@
sys.stdout.flush()
sources.close()
-################################################################################
+##############################################################################
+
def validate_packages(packages_filename, suite, component, architecture):
if suite == "dapper":
@@ -95,7 +100,8 @@
sys.stdout.write("Checking %s/%s/%s: " % (suite, component, architecture))
sys.stdout.flush()
- # apt_pkg.ParseTagFile needs a real file handle and can't handle a GzipFile instance...
+ # apt_pkg.ParseTagFile needs a real file handle and can't handle a
+ # GzipFile instance...
packages = NamedTemporaryFile()
(result, output) = commands.getstatusoutput("gunzip -c %s > %s"
% (packages_filename,
@@ -116,7 +122,8 @@
sys.stdout.flush()
packages.close()
-################################################################################
+##############################################################################
+
def _process_dir(_, dirname, filenames):
global Filelist
@@ -133,9 +140,11 @@
if architecture == "source":
validate_sources(full_filename, suite, component)
else:
- validate_packages(full_filename, suite, component, architecture)
-
-################################################################################
+ validate_packages(
+ full_filename, suite, component, architecture)
+
+##############################################################################
+
def main():
global Filelist
@@ -148,7 +157,7 @@
return 0
-################################################################################
+##############################################################################
if __name__ == '__main__':
sys.exit(main())