]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
trivial: Use 'in' operator
authorStephen Finucane <stephenfinucane@hotmail.com>
Fri, 9 Sep 2016 16:02:58 +0000 (17:02 +0100)
committerStephen Finucane <stephenfinucane@hotmail.com>
Sat, 24 Sep 2016 23:00:20 +0000 (00:00 +0100)
Don't do 'x == a or x == b'. Prefer 'x in [a, b]' instead.

Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
patchwork/models.py
patchwork/parser.py
patchwork/views/__init__.py

index 66fb6ab60e8060173996962b5be281ba03f8958d..cdcd0273569de5b6f3e394efd031e4237f2a8b78 100644 (file)
@@ -430,7 +430,7 @@ class Patch(Submission):
         if not user.is_authenticated():
             return False
 
-        if self.submitter.user == user or self.delegate == user:
+        if user in [self.submitter.user, self.delegate]:
             return True
 
         return self.project.is_editable(user)
index 642b50be06343048f6cba7ee238d29d039fdc14b..0e229ba921bf5133cacca3ab534653bcb7ca9891 100644 (file)
@@ -473,7 +473,7 @@ def parse_patch(content):
                 state = 0
                 commentbuf += buf + line
                 buf = ''
-        elif state == 4 or state == 5:
+        elif state in [4, 5]:
             if line.startswith('-'):
                 lc[0] -= 1
             elif line.startswith('+'):
index c4cfd83c70acfaf0bef44a4c42fa7b139d2ad286..df30f518f58c3fda6663306b2fe1000d51b3c186 100644 (file)
@@ -160,7 +160,7 @@ def set_bundle(request, project, action, data, patches, context):
         return ['no such bundle']
 
     for patch in patches:
-        if action == 'create' or action == 'add':
+        if action in ['create', 'add']:
             bundlepatch_count = BundlePatch.objects.filter(bundle=bundle,
                                                            patch=patch).count()
             if bundlepatch_count == 0: