dict.has_key(a) --> a in dict
has_key() is gone in python3, so use a more modern syntax here. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
parent
8aba2800e6
commit
5c598d7e74
@ -186,7 +186,7 @@ class IMAPFolder(BaseFolder):
|
|||||||
continue
|
continue
|
||||||
messagestr = messagestr.split(' ', 1)[1]
|
messagestr = messagestr.split(' ', 1)[1]
|
||||||
options = imaputil.flags2hash(messagestr)
|
options = imaputil.flags2hash(messagestr)
|
||||||
if not options.has_key('UID'):
|
if not 'UID' in options:
|
||||||
self.ui.warn('No UID in message with options %s' %\
|
self.ui.warn('No UID in message with options %s' %\
|
||||||
str(options),
|
str(options),
|
||||||
minor = 1)
|
minor = 1)
|
||||||
|
@ -94,7 +94,7 @@ class MappedIMAPFolder(IMAPFolder):
|
|||||||
# summary that have been deleted from the folder.
|
# summary that have been deleted from the folder.
|
||||||
|
|
||||||
for luid in self.diskl2r.keys():
|
for luid in self.diskl2r.keys():
|
||||||
if not reallist.has_key(luid):
|
if not luid in reallist:
|
||||||
ruid = self.diskl2r[luid]
|
ruid = self.diskl2r[luid]
|
||||||
del self.diskr2l[ruid]
|
del self.diskr2l[ruid]
|
||||||
del self.diskl2r[luid]
|
del self.diskl2r[luid]
|
||||||
@ -107,7 +107,7 @@ class MappedIMAPFolder(IMAPFolder):
|
|||||||
self.l2r = self.diskl2r.copy()
|
self.l2r = self.diskl2r.copy()
|
||||||
|
|
||||||
for luid in reallist.keys():
|
for luid in reallist.keys():
|
||||||
if not self.l2r.has_key(luid):
|
if not luid in self.l2r:
|
||||||
ruid = nextneg
|
ruid = nextneg
|
||||||
nextneg -= 1
|
nextneg -= 1
|
||||||
self.l2r[luid] = ruid
|
self.l2r[luid] = ruid
|
||||||
|
@ -137,7 +137,7 @@ class WrappedIMAP4_SSL(UsefulIMAPMixIn, IMAP4_SSL):
|
|||||||
"""Improved version of imaplib.IMAP4_SSL overriding select()"""
|
"""Improved version of imaplib.IMAP4_SSL overriding select()"""
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self._fingerprint = kwargs.get('fingerprint', None)
|
self._fingerprint = kwargs.get('fingerprint', None)
|
||||||
if kwargs.has_key('fingerprint'):
|
if 'fingerprint' in kwargs:
|
||||||
del kwargs['fingerprint']
|
del kwargs['fingerprint']
|
||||||
super(WrappedIMAP4_SSL, self).__init__(*args, **kwargs)
|
super(WrappedIMAP4_SSL, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ def initInstanceLimit(instancename, instancemax):
|
|||||||
"""Initialize the instance-limited thread implementation to permit
|
"""Initialize the instance-limited thread implementation to permit
|
||||||
up to intancemax threads with the given instancename."""
|
up to intancemax threads with the given instancename."""
|
||||||
instancelimitedlock.acquire()
|
instancelimitedlock.acquire()
|
||||||
if not instancelimitedsems.has_key(instancename):
|
if not instancename in instancelimitedsems:
|
||||||
instancelimitedsems[instancename] = BoundedSemaphore(instancemax)
|
instancelimitedsems[instancename] = BoundedSemaphore(instancemax)
|
||||||
instancelimitedlock.release()
|
instancelimitedlock.release()
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ class UIBase(object):
|
|||||||
|
|
||||||
def unregisterthread(self, thr):
|
def unregisterthread(self, thr):
|
||||||
"""Unregister a thread as being associated with an account name"""
|
"""Unregister a thread as being associated with an account name"""
|
||||||
if self.threadaccounts.has_key(thr):
|
if thr in self.threadaccounts:
|
||||||
del self.threadaccounts[thr]
|
del self.threadaccounts[thr]
|
||||||
self.debug('thread', "Unregister thread '%s'" % thr.getName())
|
self.debug('thread', "Unregister thread '%s'" % thr.getName())
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ class UIBase(object):
|
|||||||
|
|
||||||
def debug(self, debugtype, msg):
|
def debug(self, debugtype, msg):
|
||||||
cur_thread = threading.currentThread()
|
cur_thread = threading.currentThread()
|
||||||
if not self.debugmessages.has_key(cur_thread):
|
if not cur_thread in self.debugmessages:
|
||||||
# deque(..., self.debugmsglen) would be handy but was
|
# deque(..., self.debugmsglen) would be handy but was
|
||||||
# introduced in p2.6 only, so we'll need to work around and
|
# introduced in p2.6 only, so we'll need to work around and
|
||||||
# shorten our debugmsg list manually :-(
|
# shorten our debugmsg list manually :-(
|
||||||
@ -403,7 +403,7 @@ class UIBase(object):
|
|||||||
################################################## Threads
|
################################################## Threads
|
||||||
|
|
||||||
def getThreadDebugLog(self, thread):
|
def getThreadDebugLog(self, thread):
|
||||||
if self.debugmessages.has_key(thread):
|
if thread in self.debugmessages:
|
||||||
message = "\nLast %d debug messages logged for %s prior to exception:\n"\
|
message = "\nLast %d debug messages logged for %s prior to exception:\n"\
|
||||||
% (len(self.debugmessages[thread]), thread.getName())
|
% (len(self.debugmessages[thread]), thread.getName())
|
||||||
message += "\n".join(self.debugmessages[thread])
|
message += "\n".join(self.debugmessages[thread])
|
||||||
|
Loading…
Reference in New Issue
Block a user