From: Stephen Finucane Date: Fri, 9 Sep 2016 16:02:58 +0000 (+0100) Subject: trivial: Use 'in' operator X-Git-Tag: v2.0.0-rc1~229 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9acdbfe521a5a58e8a6a29c41bc479d97a73c5fd;p=thirdparty%2Fpatchwork.git trivial: Use 'in' operator Don't do 'x == a or x == b'. Prefer 'x in [a, b]' instead. Signed-off-by: Stephen Finucane Reviewed-by: Daniel Axtens --- diff --git a/patchwork/models.py b/patchwork/models.py index 66fb6ab6..cdcd0273 100644 --- a/patchwork/models.py +++ b/patchwork/models.py @@ -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) diff --git a/patchwork/parser.py b/patchwork/parser.py index 642b50be..0e229ba9 100644 --- a/patchwork/parser.py +++ b/patchwork/parser.py @@ -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('+'): diff --git a/patchwork/views/__init__.py b/patchwork/views/__init__.py index c4cfd83c..df30f518 100644 --- a/patchwork/views/__init__.py +++ b/patchwork/views/__init__.py @@ -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: