offlineimap/repository files singleton-comparison
This patch change these errors in the repository 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
a186f65444
commit
30afe4645e
@ -109,9 +109,9 @@ class IMAPRepository(BaseRepository):
|
|||||||
|
|
||||||
This requires that self.imapserver has been initialized with an
|
This requires that self.imapserver has been initialized with an
|
||||||
acquireconnection() or it will still be `None`"""
|
acquireconnection() or it will still be `None`"""
|
||||||
assert self.imapserver.delim != None, "'%s' " \
|
assert self.imapserver.delim is not None, "'%s' " \
|
||||||
"repository called getsep() before the folder separator was " \
|
"repository called getsep() before the folder separator was " \
|
||||||
"queried from the server" % self
|
"queried from the server" % self
|
||||||
return self.imapserver.delim
|
return self.imapserver.delim
|
||||||
|
|
||||||
def gethost(self):
|
def gethost(self):
|
||||||
@ -138,7 +138,7 @@ class IMAPRepository(BaseRepository):
|
|||||||
return self._host
|
return self._host
|
||||||
# 2) Check for plain remotehost setting.
|
# 2) Check for plain remotehost setting.
|
||||||
host = self.getconf('remotehost', None)
|
host = self.getconf('remotehost', None)
|
||||||
if host != None:
|
if host is not None:
|
||||||
self._host = host
|
self._host = host
|
||||||
return self._host
|
return self._host
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ class IMAPRepository(BaseRepository):
|
|||||||
we want to authorize as instead of our login name."""
|
we want to authorize as instead of our login name."""
|
||||||
|
|
||||||
identity = self.getconf('remote_identity', default=None)
|
identity = self.getconf('remote_identity', default=None)
|
||||||
if identity != None:
|
if identity is not None:
|
||||||
identity = identity.encode('UTF-8')
|
identity = identity.encode('UTF-8')
|
||||||
return identity
|
return identity
|
||||||
|
|
||||||
@ -182,14 +182,14 @@ class IMAPRepository(BaseRepository):
|
|||||||
|
|
||||||
if self.config.has_option(self.getsection(), 'remoteusereval'):
|
if self.config.has_option(self.getsection(), 'remoteusereval'):
|
||||||
user = self.getconf('remoteusereval')
|
user = self.getconf('remoteusereval')
|
||||||
if user != None:
|
if user is not None:
|
||||||
return localeval.eval(user).encode('UTF-8')
|
return localeval.eval(user).encode('UTF-8')
|
||||||
|
|
||||||
if self.config.has_option(self.getsection(), 'remoteuser'):
|
if self.config.has_option(self.getsection(), 'remoteuser'):
|
||||||
# Assume the configuration file to be UTF-8 encoded so we must not
|
# Assume the configuration file to be UTF-8 encoded so we must not
|
||||||
# encode this string again.
|
# encode this string again.
|
||||||
user = self.getconf('remoteuser')
|
user = self.getconf('remoteuser')
|
||||||
if user != None:
|
if user is not None:
|
||||||
return user
|
return user
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -215,7 +215,7 @@ class IMAPRepository(BaseRepository):
|
|||||||
|
|
||||||
if self.config.has_option(self.getsection(), 'remoteporteval'):
|
if self.config.has_option(self.getsection(), 'remoteporteval'):
|
||||||
port = self.getconf('remoteporteval')
|
port = self.getconf('remoteporteval')
|
||||||
if port != None:
|
if port is not None:
|
||||||
return self.localeval.eval(port)
|
return self.localeval.eval(port)
|
||||||
|
|
||||||
return self.getconfint('remoteport', None)
|
return self.getconfint('remoteport', None)
|
||||||
@ -257,7 +257,7 @@ class IMAPRepository(BaseRepository):
|
|||||||
# Can't use above cacertfile because of abspath.
|
# Can't use above cacertfile because of abspath.
|
||||||
if self.getconf('sslcacertfile', None) == "OS-DEFAULT":
|
if self.getconf('sslcacertfile', None) == "OS-DEFAULT":
|
||||||
cacertfile = get_os_sslcertfile()
|
cacertfile = get_os_sslcertfile()
|
||||||
if cacertfile == None:
|
if cacertfile is None:
|
||||||
searchpath = get_os_sslcertfile_searchpath()
|
searchpath = get_os_sslcertfile_searchpath()
|
||||||
if searchpath:
|
if searchpath:
|
||||||
reason = "Default CA bundle was requested, " \
|
reason = "Default CA bundle was requested, " \
|
||||||
@ -465,8 +465,7 @@ class IMAPRepository(BaseRepository):
|
|||||||
self.imapserver.releaseconnection(imapobj)
|
self.imapserver.releaseconnection(imapobj)
|
||||||
|
|
||||||
for s in listresult:
|
for s in listresult:
|
||||||
if s == None or \
|
if s is None or (isinstance(s, str) and s == ''):
|
||||||
(isinstance(s, str) and s == ''):
|
|
||||||
# Bug in imaplib: empty strings in results from
|
# Bug in imaplib: empty strings in results from
|
||||||
# literals. TODO: still relevant?
|
# literals. TODO: still relevant?
|
||||||
continue
|
continue
|
||||||
|
@ -204,7 +204,7 @@ class MaildirRepository(BaseRepository):
|
|||||||
return retval
|
return retval
|
||||||
|
|
||||||
def getfolders(self):
|
def getfolders(self):
|
||||||
if self.folders == None:
|
if self.folders is None:
|
||||||
self.folders = self._getfolders_scandir(self.root)
|
self.folders = self._getfolders_scandir(self.root)
|
||||||
return self.folders
|
return self.folders
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user