launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #28889
[Merge] ~cjwatson/launchpad:simplify-flake8-config into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:simplify-flake8-config into launchpad:master.
Commit message:
Simplify flake8 configuration
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/427422
Remove Python 2 builtins and all the whitespace-only ignore directives, now that we're using `black` so that it's pretty easy to comply with those. I fixed up some remaining violations, including a small amount of manual adjustment in the handful of files that still require Python 2 support so that we can't yet run `black` properly.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:simplify-flake8-config into launchpad:master.
diff --git a/cronscripts/foaf-update-karma-cache.py b/cronscripts/foaf-update-karma-cache.py
index 5d24300..9f16cc9 100755
--- a/cronscripts/foaf-update-karma-cache.py
+++ b/cronscripts/foaf-update-karma-cache.py
@@ -132,12 +132,12 @@ class KarmaCacheUpdater(LaunchpadCronScript):
# corresponding rows in the Person table so the bulk insert cannot
# fail. We don't bother at the moment as this would involve granting
# UPDATE rights on the Person table to the karmacacheupdater user.
- ## cur.execute("BEGIN")
- ## cur.execute("""
- ## SELECT * FROM Person
- ## WHERE id NOT IN (SELECT person FROM KarmaTotalCache)
- ## FOR UPDATE
- ## """)
+ # cur.execute("BEGIN")
+ # cur.execute("""
+ # SELECT * FROM Person
+ # WHERE id NOT IN (SELECT person FROM KarmaTotalCache)
+ # FOR UPDATE
+ # """)
self.cur.execute(
"""
@@ -148,7 +148,7 @@ class KarmaCacheUpdater(LaunchpadCronScript):
"""
)
- ## self.cur.execute("COMMIT")
+ # self.cur.execute("COMMIT")
def C_add_karmacache_sums(self):
self.logger.info("Step C: Calculating KarmaCache sums")
diff --git a/lib/devscripts/sourcecode.py b/lib/devscripts/sourcecode.py
index f088b1a..7293245 100644
--- a/lib/devscripts/sourcecode.py
+++ b/lib/devscripts/sourcecode.py
@@ -9,7 +9,7 @@ __all__ = [
'interpret_config',
'parse_config_file',
'plan_update',
- ]
+]
import errno
import json
@@ -38,13 +38,10 @@ except ImportError:
BzrError,
IncompatibleRepositories,
NotBranchError,
- )
+ )
from bzrlib.plugin import load_plugins
from bzrlib.revisionspec import RevisionSpec
- from bzrlib.trace import (
- enable_default_logging,
- report_exception,
- )
+ from bzrlib.trace import enable_default_logging, report_exception
from bzrlib.upgrade import upgrade
from bzrlib.workingtree import WorkingTree
@@ -212,8 +209,8 @@ def get_branches(sourcecode_directory, new_branches,
possible_transports.append(
get_controldir(remote_branch).root_transport)
if not quiet:
- print('Getting %s from %s at %s' % (
- project, branch_url, _format_revision_name(revision, tip)))
+ print('Getting %s from %s at %s' %
+ (project, branch_url, _format_revision_name(revision, tip)))
# If the 'optional' flag is set, then it's a branch that shares
# history with Launchpad, so we should share repositories. Otherwise,
# we should avoid sharing repositories to avoid format
@@ -284,8 +281,8 @@ def update_branches(sourcecode_directory, update_branches,
# Update project from branch_url.
destination = os.path.join(sourcecode_directory, project)
if not quiet:
- print('Updating %s to %s' % (
- project, _format_revision_name(revision, tip)))
+ print('Updating %s to %s' %
+ (project, _format_revision_name(revision, tip)))
local_tree = WorkingTree.open(destination)
try:
remote_branch = Branch.open(
diff --git a/lib/lp/app/browser/launchpad.py b/lib/lp/app/browser/launchpad.py
index d967aea..5ba6b9b 100644
--- a/lib/lp/app/browser/launchpad.py
+++ b/lib/lp/app/browser/launchpad.py
@@ -901,9 +901,9 @@ class LaunchpadRootNavigation(Navigation):
"temporary-blobs": ITemporaryStorageManager,
# These three have been renamed, and no redirects done, as the old
# urls now point to the product pages.
- #'bazaar': IBazaarApplication,
- #'malone': IMaloneApplication,
- #'rosetta': IRosettaApplication,
+ # "bazaar": IBazaarApplication,
+ # "malone": IMaloneApplication,
+ # "rosetta": IRosettaApplication,
}
@stepto("products")
diff --git a/lib/lp/app/widgets/product.py b/lib/lp/app/widgets/product.py
index e1165b9..ad5db85 100644
--- a/lib/lp/app/widgets/product.py
+++ b/lib/lp/app/widgets/product.py
@@ -76,8 +76,8 @@ class ProductBugTrackerWidget(LaunchpadRadioWidget):
)
# Upstream email address field and widget.
- ## This is to make email address bug trackers appear
- ## separately from the main bug tracker list.
+ # This is to make email address bug trackers appear
+ # separately from the main bug tracker list.
self.upstream_email_address = StrippedTextLine(
required=False,
constraint=email_validator,
@@ -95,8 +95,8 @@ class ProductBugTrackerWidget(LaunchpadRadioWidget):
value="",
context=self.upstream_email_address.context,
)
- ## Select the corresponding radio option automatically if
- ## the user starts typing.
+ # Select the corresponding radio option automatically if
+ # the user starts typing.
if self.upstream_email_address_widget.extra is None:
self.upstream_email_address_widget.extra = ""
self.upstream_email_address_widget.extra += (
@@ -210,8 +210,8 @@ class ProductBugTrackerWidget(LaunchpadRadioWidget):
)
# External bug tracker.
- ## The bugtracker widget can't be within the <label> tag,
- ## since Firefox doesn't cope with it well.
+ # The bugtracker widget can't be within the <label> tag,
+ # since Firefox doesn't cope with it well.
external_bugtracker_text = "%s %s" % (
self._renderLabel("In a registered bug tracker:", 2),
self.bugtracker_widget(),
diff --git a/lib/lp/archiveuploader/nascentuploadfile.py b/lib/lp/archiveuploader/nascentuploadfile.py
index 6d3b37f..c7773f0 100644
--- a/lib/lp/archiveuploader/nascentuploadfile.py
+++ b/lib/lp/archiveuploader/nascentuploadfile.py
@@ -262,7 +262,7 @@ class CustomUploadFile(NascentUploadFile):
"""
# This is a marker as per the comment in lib/lp/soyuz/enums.py:
- ##CUSTOMFORMAT##
+ # ##CUSTOMFORMAT##
# Essentially if you change anything to do with custom formats, grep for
# the marker in the codebase and make sure the same changes are made
# everywhere which needs them.
diff --git a/lib/lp/code/model/branchmergeproposal.py b/lib/lp/code/model/branchmergeproposal.py
index 077a9ee..20e0cea 100644
--- a/lib/lp/code/model/branchmergeproposal.py
+++ b/lib/lp/code/model/branchmergeproposal.py
@@ -1125,15 +1125,14 @@ class BranchMergeProposal(SQLBase, BugLinkTargetMixin):
vote=None,
review_type=None,
parent=None,
+ # The date the message was created. Provided only for testing
+ # purposes, as it can break BranchMergeProposal.root_message.
_date_created=DEFAULT,
previewdiff_id=None,
inline_comments=None,
_notify_listeners=True,
):
"""See `IBranchMergeProposal`."""
- #:param _date_created: The date the message was created. Provided
- # only for testing purposes, as it can break
- # BranchMergeProposal.root_message.
review_type = self._normalizeReviewType(review_type)
assert owner is not None, "Merge proposal messages need a sender"
parent_message = None
diff --git a/lib/lp/registry/adapters.py b/lib/lp/registry/adapters.py
index de7ce44..b37efd5 100644
--- a/lib/lp/registry/adapters.py
+++ b/lib/lp/registry/adapters.py
@@ -55,7 +55,7 @@ def person_from_principal(principal):
#
# When Zope3 interfaces allow returning None for "cannot adapt"
# we can return None here.
- ##return None
+ # return None
raise ComponentLookupError
diff --git a/lib/lp/registry/browser/product.py b/lib/lp/registry/browser/product.py
index 3c0ef63..afcd8cf 100644
--- a/lib/lp/registry/browser/product.py
+++ b/lib/lp/registry/browser/product.py
@@ -368,7 +368,7 @@ class ProductInvolvementView(PillarInvolvementView):
"configure_bugtracker",
"configure_translations",
"configure_answers",
- #'configure_blueprints',
+ # "configure_blueprints",
]
config_list = []
config_statuses = self.configuration_states
diff --git a/lib/lp/registry/browser/team.py b/lib/lp/registry/browser/team.py
index e716f19..7495823 100644
--- a/lib/lp/registry/browser/team.py
+++ b/lib/lp/registry/browser/team.py
@@ -978,7 +978,7 @@ class TeamMailingListModerationView(MailingListTeamBaseView):
:return: Number of message being held for moderator approval.
"""
- ## return self.mailing_list.getReviewableMessages().count()
+ # return self.mailing_list.getReviewableMessages().count()
# This looks like it would be more efficient, but it raises
# LocationError.
return self.held_messages.currentBatch().listlength
diff --git a/lib/lp/registry/model/codeofconduct.py b/lib/lp/registry/model/codeofconduct.py
index ea45fdd..0e91fdb 100644
--- a/lib/lp/registry/model/codeofconduct.py
+++ b/lib/lp/registry/model/codeofconduct.py
@@ -54,9 +54,9 @@ from lp.services.webapp import canonical_url
class CodeOfConductConf:
"""Abstract Component to store the current CoC configuration."""
- ## XXX: cprov 2005-02-17
- ## Integrate this class with LaunchpadCentral configuration
- ## in the future.
+ # XXX: cprov 2005-02-17
+ # Integrate this class with LaunchpadCentral configuration
+ # in the future.
path = "lib/lp/registry/codesofconduct/"
prefix = "Ubuntu Code of Conduct - "
@@ -86,8 +86,8 @@ class CodeOfConduct:
def title(self):
"""Return preformatted title (config_prefix + version)."""
- ## XXX: cprov 2005-02-18
- ## Missed doctest, problems initing ZopeComponentLookupError.
+ # XXX: cprov 2005-02-18
+ # Missed doctest, problems initing ZopeComponentLookupError.
# Recover the prefix for CoC from a Component
prefix = getUtility(ICodeOfConductConf).prefix
diff --git a/lib/lp/services/database/sqlobject/__init__.py b/lib/lp/services/database/sqlobject/__init__.py
index 940ce94..e1fcf9d 100644
--- a/lib/lp/services/database/sqlobject/__init__.py
+++ b/lib/lp/services/database/sqlobject/__init__.py
@@ -19,6 +19,7 @@ _sqlStringReplace = [
("\t", "\\t"),
]
+
# XXX 2007-03-07 jamesh:
# This is a cut down version of sqlobject's sqlrepr() method. Ideally
# we can get rid of this as code is converted to use store.execute().
diff --git a/lib/lp/services/identity/adapters/account.py b/lib/lp/services/identity/adapters/account.py
index 558a0e7..eea1cb5 100644
--- a/lib/lp/services/identity/adapters/account.py
+++ b/lib/lp/services/identity/adapters/account.py
@@ -19,5 +19,5 @@ def accountFromPrincipal(principal):
#
# When Zope3 interfaces allow returning None for "cannot adapt"
# we can return None here.
- ##return None
+ # return None
raise ComponentLookupError
diff --git a/lib/lp/soyuz/scripts/custom_uploads_copier.py b/lib/lp/soyuz/scripts/custom_uploads_copier.py
index 0817d3c..8eae9be 100644
--- a/lib/lp/soyuz/scripts/custom_uploads_copier.py
+++ b/lib/lp/soyuz/scripts/custom_uploads_copier.py
@@ -28,7 +28,7 @@ class CustomUploadsCopier:
"""Copy `PackageUploadCustom` objects into a new `DistroSeries`."""
# This is a marker as per the comment in lib/lp/soyuz/enums.py:
- ##CUSTOMFORMAT##
+ # ##CUSTOMFORMAT##
# Essentially, if you alter anything to do with what custom formats are,
# what their tags are, or anything along those lines, you should grep
# for the marker in the source tree and fix it up in every place so
diff --git a/setup.cfg b/setup.cfg
index 70311e8..ac125e1 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -192,55 +192,11 @@ console_scripts =
with-xvfb = lp.scripts.utilities.withxvfb:main
[flake8]
-# These Python 2 builtins are needed until such time as we finish moving to
-# Python 3.
-builtins =
- file,
- long
exclude =
# Code here is imported from elsewhere and may not necessarily conform
# to Launchpad's style.
lib/contrib
ignore =
- # Skip all the pure whitespace issues for now. There are too many of
- # them to be worth fixing manually, and most of them will get sorted out
- # automatically when we eventually switch to black.
- E111,
- E114,
- E115,
- E116,
- E117,
- E121,
- E122,
- E123,
- E124,
- E125,
- E126,
- E127,
- E128,
- E129,
- E131,
- E133,
- E201,
- E202,
- E211,
- E221,
- E222,
- E225,
- E226,
- E227,
- E231,
- E241,
- E251,
- E261,
- E262,
- E265,
- E266,
- E271,
- E302,
- E303,
- E305,
- E306,
# Incompatible with Black.
E203,
# ==/!= comparisons with True/False/None are common idioms with Storm.
diff --git a/utilities/community-contributions.py b/utilities/community-contributions.py
index edaac47..4999cde 100755
--- a/utilities/community-contributions.py
+++ b/utilities/community-contributions.py
@@ -208,7 +208,7 @@ known_canonical_lp_devs = \
u'ubuntu <ubuntu {_AT_} lp-dev>',
u'Ursula Junque',
u'William Grant <william.grant {_AT_} canonical.com>',
- )]
+ )]
# People known to work for Canonical but not on the Launchpad team.
# Anyone with "@canonical.com" in their email address is considered to
@@ -310,10 +310,10 @@ merge_names_pairs = (
u'Kit Randel <kit.randel {_AT_} canonical.com>'),
(u'william.grant {_AT_} canonical.com',
u'William Grant <william.grant {_AT_} canonical.com>'),
- )
+)
# Then put it in dictionary form with the correct encodings.
merge_names_map = {wiki_encode(a): wiki_encode(b)
- for a, b in merge_names_pairs}
+ for a, b in merge_names_pairs}
class ContainerRevision():
@@ -325,9 +325,11 @@ class ContainerRevision():
:param top_lr: The top-level LogRevision.
:param branch_info: The BranchInfo for the containing branch.
"""
- self.top_rev = top_lr # e.g. LogRevision for r9371.
- self.contained_revs = [] # e.g. [ {9369.1.1}, {9206.4.4}, ... ],
- # where "{X}" means "LogRevision for X"
+ # e.g. LogRevision for r9371.
+ self.top_rev = top_lr
+ # e.g. [ {9369.1.1}, {9206.4.4}, ... ],
+ # where "{X}" means "LogRevision for X"
+ self.contained_revs = []
self.branch_info = branch_info
def add_subrev(self, lr):
@@ -387,7 +389,7 @@ class ContainerRevision():
" '''Commits:'''\n ",
commits_block,
"\n",
- ]
+ ]
return ''.join(text)
@@ -442,7 +444,7 @@ class ExCon():
key=lambda x: x.top_rev.rev.timestamp,
reverse=True))),
"\n",
- ]
+ ]
return ''.join(text)
@@ -541,7 +543,7 @@ class LogExCons(log.LogFormatter):
non_canonical_contributors = [x for x in self.all_ex_cons.values()
if not x.is_canonical]
canonical_contributors = [x for x in self.all_ex_cons.values()
- if x.is_canonical]
+ if x.is_canonical]
# Sort them.
non_canonical_contributors = sorted(non_canonical_contributors,
key=lambda x: x.num_landings(),
@@ -554,12 +556,12 @@ class LogExCons(log.LogFormatter):
"-----\n\n",
"= Who =\n\n"
"== Contributors (from outside Canonical) ==\n\n",
- ]
+ ]
text.extend(self._toc(non_canonical_contributors))
text.extend([
"== Contributors (from Canonical, but outside "
"the Launchpad team) ==\n\n",
- ])
+ ])
text.extend(self._toc(canonical_contributors))
text.extend(["\n-----\n\n",
"= What =\n\n",
@@ -692,7 +694,7 @@ def main():
devel_path, '~launchpad-pqm/launchpad/devel'),
BranchInfo(
db_devel_path, '~launchpad-pqm/launchpad/db-devel', 'db-devel'),
- )
+ )
lec = LogExCons()
diff --git a/utilities/update-sourcecode b/utilities/update-sourcecode
index e1aabde..1f2189a 100755
--- a/utilities/update-sourcecode
+++ b/utilities/update-sourcecode
@@ -8,10 +8,11 @@
import os
import sys
-sys.path.insert(0,
- os.path.join(os.path.dirname(os.path.dirname(__file__)), 'lib'))
+sys.path.insert(
+ 0, os.path.join(os.path.dirname(os.path.dirname(__file__)), "lib")
+)
from devscripts import sourcecode # noqa: E402
-if __name__ == '__main__':
+if __name__ == "__main__":
sys.exit(sourcecode.main(sys.argv))