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:
Sebastian Spaeth 2012-02-05 13:40:06 +01:00
parent 8aba2800e6
commit 5c598d7e74
5 changed files with 8 additions and 8 deletions

View File

@ -186,7 +186,7 @@ class IMAPFolder(BaseFolder):
continue
messagestr = messagestr.split(' ', 1)[1]
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' %\
str(options),
minor = 1)

View File

@ -94,7 +94,7 @@ class MappedIMAPFolder(IMAPFolder):
# summary that have been deleted from the folder.
for luid in self.diskl2r.keys():
if not reallist.has_key(luid):
if not luid in reallist:
ruid = self.diskl2r[luid]
del self.diskr2l[ruid]
del self.diskl2r[luid]
@ -107,7 +107,7 @@ class MappedIMAPFolder(IMAPFolder):
self.l2r = self.diskl2r.copy()
for luid in reallist.keys():
if not self.l2r.has_key(luid):
if not luid in self.l2r:
ruid = nextneg
nextneg -= 1
self.l2r[luid] = ruid

View File

@ -137,7 +137,7 @@ class WrappedIMAP4_SSL(UsefulIMAPMixIn, IMAP4_SSL):
"""Improved version of imaplib.IMAP4_SSL overriding select()"""
def __init__(self, *args, **kwargs):
self._fingerprint = kwargs.get('fingerprint', None)
if kwargs.has_key('fingerprint'):
if 'fingerprint' in kwargs:
del kwargs['fingerprint']
super(WrappedIMAP4_SSL, self).__init__(*args, **kwargs)

View File

@ -209,7 +209,7 @@ def initInstanceLimit(instancename, instancemax):
"""Initialize the instance-limited thread implementation to permit
up to intancemax threads with the given instancename."""
instancelimitedlock.acquire()
if not instancelimitedsems.has_key(instancename):
if not instancename in instancelimitedsems:
instancelimitedsems[instancename] = BoundedSemaphore(instancemax)
instancelimitedlock.release()

View File

@ -159,7 +159,7 @@ class UIBase(object):
def unregisterthread(self, thr):
"""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]
self.debug('thread', "Unregister thread '%s'" % thr.getName())
@ -175,7 +175,7 @@ class UIBase(object):
def debug(self, debugtype, msg):
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
# introduced in p2.6 only, so we'll need to work around and
# shorten our debugmsg list manually :-(
@ -403,7 +403,7 @@ class UIBase(object):
################################################## Threads
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"\
% (len(self.debugmessages[thread]), thread.getName())
message += "\n".join(self.debugmessages[thread])