offlineimap/ files singleton-comparison
This patch change these errors in the offlineimap folder C0121: Comparison to None should be 'expr is None' (singleton-comparison) C0121: Comparison to None should be 'expr is not None' (singleton-comparison)
This commit is contained in:
parent
da2baaaeb7
commit
1a529b6b0e
@ -140,7 +140,7 @@ class CustomConfigParser(SafeConfigParser):
|
|||||||
|
|
||||||
Returns transformed string."""
|
Returns transformed string."""
|
||||||
|
|
||||||
if string == None:
|
if string is None:
|
||||||
return None
|
return None
|
||||||
for f in transforms:
|
for f in transforms:
|
||||||
string = f(string)
|
string = f(string)
|
||||||
|
@ -561,7 +561,7 @@ def syncfolder(account, remotefolder, quick):
|
|||||||
|
|
||||||
new.cachemessagelist()
|
new.cachemessagelist()
|
||||||
min_uid = partial.retrieve_min_uid()
|
min_uid = partial.retrieve_min_uid()
|
||||||
if min_uid == None: # min_uid file didn't exist
|
if min_uid is None: # min_uid file didn't exist
|
||||||
if len(new.getmessageuidlist()) > 0:
|
if len(new.getmessageuidlist()) > 0:
|
||||||
raise OfflineImapError("To use startdate on Repository %s, "
|
raise OfflineImapError("To use startdate on Repository %s, "
|
||||||
"Repository %s must be empty" %
|
"Repository %s must be empty" %
|
||||||
@ -612,27 +612,27 @@ def syncfolder(account, remotefolder, quick):
|
|||||||
maxage = localfolder.getmaxage()
|
maxage = localfolder.getmaxage()
|
||||||
localstart = localfolder.getstartdate()
|
localstart = localfolder.getstartdate()
|
||||||
remotestart = remotefolder.getstartdate()
|
remotestart = remotefolder.getstartdate()
|
||||||
if (maxage != None) + (localstart != None) + (remotestart != None) > 1:
|
if (maxage is not None) + (localstart is not None) + (remotestart is not None) > 1:
|
||||||
six.reraise(OfflineImapError,
|
six.reraise(OfflineImapError,
|
||||||
OfflineImapError("You can set at most one of the "
|
OfflineImapError("You can set at most one of the "
|
||||||
"following: maxage, startdate (for the local "
|
"following: maxage, startdate (for the local "
|
||||||
"folder), startdate (for the remote folder)",
|
"folder), startdate (for the remote folder)",
|
||||||
OfflineImapError.ERROR.REPO),
|
OfflineImapError.ERROR.REPO),
|
||||||
exc_info()[2])
|
exc_info()[2])
|
||||||
if (maxage != None or localstart or remotestart) and quick:
|
if (maxage is not None or localstart or remotestart) and quick:
|
||||||
# IMAP quickchanged isn't compatible with options that
|
# IMAP quickchanged isn't compatible with options that
|
||||||
# involve restricting the messagelist, since the "quick"
|
# involve restricting the messagelist, since the "quick"
|
||||||
# check can only retrieve a full list of UIDs in the folder.
|
# check can only retrieve a full list of UIDs in the folder.
|
||||||
ui.warn("Quick syncs (-q) not supported in conjunction "
|
ui.warn("Quick syncs (-q) not supported in conjunction "
|
||||||
"with maxage or startdate; ignoring -q.")
|
"with maxage or startdate; ignoring -q.")
|
||||||
if maxage != None:
|
if maxage is not None:
|
||||||
cachemessagelists_upto_date(maxage)
|
cachemessagelists_upto_date(maxage)
|
||||||
check_uid_validity()
|
check_uid_validity()
|
||||||
elif localstart != None:
|
elif localstart is not None:
|
||||||
cachemessagelists_startdate(remotefolder, localfolder,
|
cachemessagelists_startdate(remotefolder, localfolder,
|
||||||
localstart)
|
localstart)
|
||||||
check_uid_validity()
|
check_uid_validity()
|
||||||
elif remotestart != None:
|
elif remotestart is not None:
|
||||||
cachemessagelists_startdate(localfolder, remotefolder,
|
cachemessagelists_startdate(localfolder, remotefolder,
|
||||||
remotestart)
|
remotestart)
|
||||||
check_uid_validity()
|
check_uid_validity()
|
||||||
|
@ -171,10 +171,10 @@ class IMAPServer():
|
|||||||
def __getpassword(self):
|
def __getpassword(self):
|
||||||
"""Returns the server password or None"""
|
"""Returns the server password or None"""
|
||||||
|
|
||||||
if self.goodpassword != None: # use cached good one first
|
if self.goodpassword is not None: # use cached good one first
|
||||||
return self.goodpassword
|
return self.goodpassword
|
||||||
|
|
||||||
if self.password != None and self.passworderror == None:
|
if self.password is not None and self.passworderror is None:
|
||||||
return self.password # non-failed preconfigured one
|
return self.password # non-failed preconfigured one
|
||||||
|
|
||||||
# get 1) configured password first 2) fall back to asking via UI
|
# get 1) configured password first 2) fall back to asking via UI
|
||||||
@ -211,7 +211,7 @@ class IMAPServer():
|
|||||||
passwd = self.__getpassword()
|
passwd = self.__getpassword()
|
||||||
authz = ''
|
authz = ''
|
||||||
NULL = '\x00'
|
NULL = '\x00'
|
||||||
if self.user_identity != None:
|
if self.user_identity is not None:
|
||||||
authz = self.user_identity
|
authz = self.user_identity
|
||||||
|
|
||||||
retval = NULL.join((authz, authc, passwd))
|
retval = NULL.join((authz, authc, passwd))
|
||||||
@ -598,13 +598,13 @@ class IMAPServer():
|
|||||||
if dat != [None]:
|
if dat != [None]:
|
||||||
imapobj.capabilities = tuple(dat[-1].upper().split())
|
imapobj.capabilities = tuple(dat[-1].upper().split())
|
||||||
|
|
||||||
if self.delim == None:
|
if self.delim is None:
|
||||||
listres = imapobj.list(self.reference, '')[1]
|
listres = imapobj.list(self.reference, '')[1]
|
||||||
if listres == [None] or listres == None:
|
if listres == [None] or listres is None:
|
||||||
# Some buggy IMAP servers do not respond well to LIST "" ""
|
# Some buggy IMAP servers do not respond well to LIST "" ""
|
||||||
# Work around them.
|
# Work around them.
|
||||||
listres = imapobj.list(self.reference, '"*"')[1]
|
listres = imapobj.list(self.reference, '"*"')[1]
|
||||||
if listres == [None] or listres == None:
|
if listres == [None] or listres is None:
|
||||||
# No Folders were returned. This occurs, e.g. if the
|
# No Folders were returned. This occurs, e.g. if the
|
||||||
# 'reference' prefix does not exist on the mail
|
# 'reference' prefix does not exist on the mail
|
||||||
# server. Raise exception.
|
# server. Raise exception.
|
||||||
|
@ -208,7 +208,7 @@ def uid_sequence(uidlist):
|
|||||||
|
|
||||||
for item in iter(sorted_uids):
|
for item in iter(sorted_uids):
|
||||||
item = int(item)
|
item = int(item)
|
||||||
if start == None: # First item
|
if start is None: # First item
|
||||||
start, end = item, item
|
start, end = item, item
|
||||||
elif item == end + 1: # Next item in a range
|
elif item == end + 1: # Next item in a range
|
||||||
end = item
|
end = item
|
||||||
|
@ -245,7 +245,7 @@ class OfflineImap():
|
|||||||
|
|
||||||
# Which ui to use? CLI option overrides config file.
|
# Which ui to use? CLI option overrides config file.
|
||||||
ui_type = config.getdefault('general', 'ui', 'ttyui')
|
ui_type = config.getdefault('general', 'ui', 'ttyui')
|
||||||
if options.interface != None:
|
if options.interface is not None:
|
||||||
ui_type = options.interface
|
ui_type = options.interface
|
||||||
if '.' in ui_type:
|
if '.' in ui_type:
|
||||||
# Transform Curses.Blinkenlights -> Blinkenlights.
|
# Transform Curses.Blinkenlights -> Blinkenlights.
|
||||||
|
Loading…
Reference in New Issue
Block a user