From a8ac4da80f873aac35d8ae3e38b975b9757c1398 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Thu, 3 Jan 2019 21:57:48 +0100 Subject: [PATCH] Fix comparison operators --- django/archives/mailarchives/views.py | 2 +- loader/lib/parser.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/django/archives/mailarchives/views.py b/django/archives/mailarchives/views.py index a9b1d33..dfb4874 100644 --- a/django/archives/mailarchives/views.py +++ b/django/archives/mailarchives/views.py @@ -670,7 +670,7 @@ def search(request): if 's' in request.POST: list_sort = request.POST['s'] - if not list_sort in ('d', 'r', 'i'): + if list_sort not in ('d', 'r', 'i'): list_stort = 'r' else: list_sort = 'r' diff --git a/loader/lib/parser.py b/loader/lib/parser.py index 334fc34..d22d8b0 100644 --- a/loader/lib/parser.py +++ b/loader/lib/parser.py @@ -62,7 +62,7 @@ class ArchivesParser(object): # mailers that add the same reference more than once. And we can't # use a set() to make it unique, because order is very important for m in cleaned_msgids: - if m and not m in self.parents: + if m and m not in self.parents: self.parents.append(m) def clean_charset(self, charset): @@ -230,7 +230,7 @@ class ArchivesParser(object): # This was not a multipart, but it leaked... Give up! return None for p in pl: - if p.get_params() == None: + if p.get_params() is None: # MIME multipart/mixed, but no MIME type on the part log.status("Found multipart/mixed in message '%s', but no MIME type on part. Trying text/plain." % self.msgid) return self.get_payload_as_unicode(p) @@ -296,7 +296,7 @@ class ArchivesParser(object): # ignore it... return for p in container.get_payload(): - if p.get_params() == None: + if p.get_params() is None: continue self.recursive_get_attachments(p) elif container.get_content_type() == 'multipart/alternative': @@ -480,7 +480,7 @@ class ArchivesParser(object): _re_mailworkaround = re.compile('"(=\?[^\?]+\?[QB]\?[^\?]+\?=)"', re.IGNORECASE) def _decode_mime_header(self, hdr, email_workaround): - if hdr == None: + if hdr is None: return None # Per http://bugs.python.org/issue504152 (and lots of testing), it seems @@ -524,7 +524,7 @@ class ArchivesParser(object): def get_mandatory(self, fieldname): try: x = self.msg[fieldname] - if x == None: + if x is None: raise Exception() return x except: -- 2.39.5