diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py index c89b191..7900099 100644 --- a/offlineimap/folder/Base.py +++ b/offlineimap/folder/Base.py @@ -223,7 +223,7 @@ class BaseFolder(): :returns: Boolean indicating the match. Returns True in case it implicitely saved the UIDVALIDITY.""" - if self.get_saveduidvalidity() != None: + if self.get_saveduidvalidity() is not None: return self.get_saveduidvalidity() == self.get_uidvalidity() else: self.save_uidvalidity() @@ -939,7 +939,7 @@ class BaseFolder(): # Execute new mail hook if we have new mail. if self.have_newmail: - if self.newmail_hook != None: + if self.newmail_hook is not None: self.newmail_hook() def __syncmessagesto_delete(self, dstfolder, statusfolder): diff --git a/offlineimap/folder/Gmail.py b/offlineimap/folder/Gmail.py index 8f1b8ef..f3d2cf3 100644 --- a/offlineimap/folder/Gmail.py +++ b/offlineimap/folder/Gmail.py @@ -148,7 +148,7 @@ class GmailFolder(IMAPFolder): for messagestr in response: # looks like: '1 (FLAGS (\\Seen Old) X-GM-LABELS (\\Inbox \\Favorites) UID 4807)' or None if no msg # Discard initial message number. - if messagestr == None: + if messagestr is None: continue messagestr = messagestr.split(' ', 1)[1] # e.g.: {'X-GM-LABELS': '("Webserver (RW.net)" "\\Inbox" GInbox)', 'FLAGS': '(\\Seen)', 'UID': '275440'} diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index bbbd32a..e574a38 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -140,7 +140,7 @@ class IMAPFolder(BaseFolder): # SELECT (if not already done) and get current UIDVALIDITY. self.__selectro(imapobj) typ, uidval = imapobj.response('UIDVALIDITY') - assert uidval != [None] and uidval != None, \ + assert uidval != [None] and uidval is not None, \ "response('UIDVALIDITY') returned [None]!" self._uidvalidity = int(uidval[-1]) return self._uidvalidity @@ -237,16 +237,16 @@ class IMAPFolder(BaseFolder): conditions = [] # 1. min_uid condition. - if min_uid != None: + if min_uid is not None: conditions.append("UID %d:*" % min_uid) # 2. date condition. - elif min_date != None: + elif min_date is not None: # Find out what the oldest message is that we should look at. conditions.append("SINCE %02d-%s-%d" % ( min_date[2], MonthNames[min_date[1]], min_date[0])) # 3. maxsize condition. maxsize = self.getmaxsize() - if maxsize != None: + if maxsize is not None: conditions.append("SMALLER %d" % maxsize) if len(conditions) >= 1: @@ -535,7 +535,7 @@ class IMAPFolder(BaseFolder): if rtime is None: rtime = emailutil.get_message_date(content) - if rtime == None: + if rtime is None: return None datetuple = time.localtime(rtime) diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py index 590a93c..86f4f6e 100644 --- a/offlineimap/folder/Maildir.py +++ b/offlineimap/folder/Maildir.py @@ -199,9 +199,9 @@ class MaildirFolder(BaseFolder): nouidcounter -= 1 else: uid = int(uidmatch.group(1)) - if min_uid != None and uid > 0 and uid < min_uid: + if min_uid is not None and uid > 0 and uid < min_uid: continue - if min_date != None and not self._iswithintime(filename, min_date): + if min_date is not None and not self._iswithintime(filename, min_date): # Keep track of messages outside of the time limit, because they # still might have UID > min(UIDs of within-min_date). We hit # this case for maxage if any message had a known/valid datetime @@ -218,7 +218,7 @@ class MaildirFolder(BaseFolder): retval[uid] = self.msglist_item_initializer(uid) retval[uid]['flags'] = flags retval[uid]['filename'] = filepath - if min_date != None: + if min_date is not None: # Re-include messages with high enough uid's. positive_uids = [uid for uid in retval if uid > 0] if positive_uids: