← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~twom/launchpad:lint-e713 into launchpad:master

 

Tom Wardill has proposed merging ~twom/launchpad:lint-e713 into launchpad:master.

Commit message:
Remove E713 lint violations

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~twom/launchpad/+git/launchpad/+merge/406631
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/launchpad:lint-e713 into launchpad:master.
diff --git a/lib/lp/app/browser/launchpad.py b/lib/lp/app/browser/launchpad.py
index af75881..822f161 100644
--- a/lib/lp/app/browser/launchpad.py
+++ b/lib/lp/app/browser/launchpad.py
@@ -1174,7 +1174,7 @@ def get_launchpad_views(cookies):
                 # The cookie is malformed, possibly hacked.
                 continue
             key, value = parts
-            if not key in views:
+            if key not in views:
                 # The cookie may be hacked.
                 continue
             # 'false' is the value that the browser script sets to disable a
diff --git a/lib/lp/app/browser/tales.py b/lib/lp/app/browser/tales.py
index 37c55de..0ec7220 100644
--- a/lib/lp/app/browser/tales.py
+++ b/lib/lp/app/browser/tales.py
@@ -151,7 +151,7 @@ class MenuLinksDict(dict):
             self._all_link_names.extend(extras)
 
     def __getitem__(self, link_name):
-        if not link_name in self._all_link_names:
+        if link_name not in self._all_link_names:
             raise KeyError(link_name)
 
         link = dict.get(self, link_name, None)
@@ -161,7 +161,7 @@ class MenuLinksDict(dict):
             else:
                 link = self._menu.initLink(link_name, self._request_url)
 
-        if not link_name in self._extra_link_names:
+        if link_name not in self._extra_link_names:
             self._menu.updateLink(link, self._request_url)
 
         self[link_name] = link
diff --git a/lib/lp/blueprints/model/specification.py b/lib/lp/blueprints/model/specification.py
index 404481a..58d57e8 100644
--- a/lib/lp/blueprints/model/specification.py
+++ b/lib/lp/blueprints/model/specification.py
@@ -412,7 +412,7 @@ class Specification(SQLBase, BugLinkTargetMixin, InformationTypeMixin):
     def _list_to_dict_of_frequency(self, list):
         dictionary = {}
         for item in list:
-            if not item in dictionary:
+            if item not in dictionary:
                 dictionary[item] = 1
             else:
                 dictionary[item] += 1
diff --git a/lib/lp/code/model/branch.py b/lib/lp/code/model/branch.py
index c9a98cd..4e63062 100644
--- a/lib/lp/code/model/branch.py
+++ b/lib/lp/code/model/branch.py
@@ -248,7 +248,7 @@ class Branch(SQLBase, WebhookTargetMixin, BzrIdentityMixin):
         # For private +junk branches, we calculate the wanted grants.
         if (not self.product and
             not self.sourcepackagename and
-            not self.information_type in PUBLIC_INFORMATION_TYPES):
+            self.information_type not in PUBLIC_INFORMATION_TYPES):
             aasource = getUtility(IAccessArtifactSource)
             [abstract_artifact] = aasource.ensure([self])
             wanted_links = set(
diff --git a/lib/lp/code/model/gitrepository.py b/lib/lp/code/model/gitrepository.py
index d5a5b38..d9c351b 100644
--- a/lib/lp/code/model/gitrepository.py
+++ b/lib/lp/code/model/gitrepository.py
@@ -612,7 +612,7 @@ class GitRepository(StormBase, WebhookTargetMixin, GitIdentityMixin):
         pillars = []
         # For private personal repositories, we calculate the wanted grants.
         if (not self.project and not self.distribution and
-            not self.information_type in PUBLIC_INFORMATION_TYPES):
+            self.information_type not in PUBLIC_INFORMATION_TYPES):
             aasource = getUtility(IAccessArtifactSource)
             [abstract_artifact] = aasource.ensure([self])
             wanted_links = set(
diff --git a/lib/lp/registry/browser/person.py b/lib/lp/registry/browser/person.py
index 233113d..28239d7 100644
--- a/lib/lp/registry/browser/person.py
+++ b/lib/lp/registry/browser/person.py
@@ -2862,7 +2862,7 @@ class PersonEditEmailsView(LaunchpadFormView):
         emailset = set(self.context.unvalidatedemails)
         emailset = emailset.union(
             [guessed for guessed in self.context.guessedemails
-             if not guessed.email in emailset])
+             if guessed.email not in emailset])
         return emailset
 
     def validate_action_remove_validated(self, action, data):
diff --git a/lib/lp/registry/model/product.py b/lib/lp/registry/model/product.py
index af880bf..9f53c70 100644
--- a/lib/lp/registry/model/product.py
+++ b/lib/lp/registry/model/product.py
@@ -1600,7 +1600,7 @@ def get_precached_products(products, need_licences=False,
             ProductLicense,
             ProductLicense.productID.is_in(product_ids)):
             cache = caches[license.productID]
-            if not license.license in cache._cached_licenses:
+            if license.license not in cache._cached_licenses:
                 cache._cached_licenses.append(license.license)
     if need_projectgroups:
         bulk.load_related(
diff --git a/lib/lp/registry/model/sharingjob.py b/lib/lp/registry/model/sharingjob.py
index b123547..2714ed8 100644
--- a/lib/lp/registry/model/sharingjob.py
+++ b/lib/lp/registry/model/sharingjob.py
@@ -354,7 +354,7 @@ class RemoveArtifactSubscriptionsJob(SharingJobDerived):
 
     @property
     def information_types(self):
-        if not 'information_types' in self.metadata:
+        if 'information_types' not in self.metadata:
             return []
         return [
             InformationType.items[value]
diff --git a/lib/lp/registry/model/sourcepackagename.py b/lib/lp/registry/model/sourcepackagename.py
index 49e6335..9fe65e1 100644
--- a/lib/lp/registry/model/sourcepackagename.py
+++ b/lib/lp/registry/model/sourcepackagename.py
@@ -144,7 +144,7 @@ def getSourcePackageDescriptions(
 
     descriptions = {}
     for binarypackagename, sourcepackagename in cur.fetchall():
-        if not sourcepackagename in descriptions:
+        if sourcepackagename not in descriptions:
             descriptions[sourcepackagename] = (
                 "Source of: %s" % binarypackagename)
         else:
diff --git a/lib/lp/registry/services/sharingservice.py b/lib/lp/registry/services/sharingservice.py
index 2e59510..36c89d4 100644
--- a/lib/lp/registry/services/sharingservice.py
+++ b/lib/lp/registry/services/sharingservice.py
@@ -568,7 +568,7 @@ class SharingService:
                 ]
 
         if (pillar.branch_sharing_policy and
-            not pillar.branch_sharing_policy in allowed_policies):
+            pillar.branch_sharing_policy not in allowed_policies):
             allowed_policies.append(pillar.branch_sharing_policy)
 
         return self._makeEnumData(allowed_policies)
@@ -596,7 +596,7 @@ class SharingService:
                 ]
 
         if (pillar.bug_sharing_policy and
-            not pillar.bug_sharing_policy in allowed_policies):
+            pillar.bug_sharing_policy not in allowed_policies):
             allowed_policies.append(pillar.bug_sharing_policy)
 
         return self._makeEnumData(allowed_policies)
@@ -624,7 +624,7 @@ class SharingService:
                 ]
 
         if (pillar.specification_sharing_policy and
-            not pillar.specification_sharing_policy in allowed_policies):
+            pillar.specification_sharing_policy not in allowed_policies):
             allowed_policies.append(pillar.specification_sharing_policy)
 
         return self._makeEnumData(allowed_policies)
diff --git a/lib/lp/testing/swift/fakeswift.py b/lib/lp/testing/swift/fakeswift.py
index 2039e74..ebd7917 100644
--- a/lib/lp/testing/swift/fakeswift.py
+++ b/lib/lp/testing/swift/fakeswift.py
@@ -124,20 +124,20 @@ class FakeKeystone(resource.Resource):
         # XXX cjwatson 2020-06-15: Python 3.5 doesn't allow this to be a
         # binary file; 3.6 does.
         credentials = json.loads(request.content.read().decode("UTF-8"))
-        if not "auth" in credentials:
+        if "auth" not in credentials:
             request.setResponseCode(http.FORBIDDEN)
             return b""
-        if ((not "tenantName" in credentials["auth"] or
-             not "passwordCredentials" in credentials["auth"])):
+        if (("tenantName" not in credentials["auth"] or
+            "passwordCredentials" not in credentials["auth"])):
             request.setResponseCode(http.FORBIDDEN)
             return b""
         tenant_name = credentials["auth"]["tenantName"]
         pw_creds = credentials["auth"]["passwordCredentials"]
         username, password = pw_creds.get("username"), pw_creds.get("password")
-        if not tenant_name in self.root.tenants:
+        if tenant_name not in self.root.tenants:
             request.setResponseCode(http.FORBIDDEN)
             return b""
-        if not username in self.users:
+        if username not in self.users:
             request.setResponseCode(http.FORBIDDEN)
             return b""
         if password != DEFAULT_PASSWORD:

Follow ups