Replace dictionary iteration methods
Signed-off-by: Łukasz Żarnowiecki <dolohow@outlook.com> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
05c75e8c8d
commit
2465e1ce6a
@ -48,11 +48,11 @@ class GmailMaildirFolder(MaildirFolder):
|
||||
sorted(statusfolder.getmessageuidlist()):
|
||||
return True
|
||||
# check for flag changes, it's quick on a Maildir
|
||||
for (uid, message) in self.getmessagelist().iteritems():
|
||||
for (uid, message) in self.getmessagelist().items():
|
||||
if message['flags'] != statusfolder.getmessageflags(uid):
|
||||
return True
|
||||
# check for newer mtimes. it is also fast
|
||||
for (uid, message) in self.getmessagelist().iteritems():
|
||||
for (uid, message) in self.getmessagelist().items():
|
||||
if message['mtime'] > statusfolder.getmessagemtime(uid):
|
||||
return True
|
||||
return False #Nope, nothing changed
|
||||
@ -70,7 +70,7 @@ class GmailMaildirFolder(MaildirFolder):
|
||||
|
||||
# Get mtimes
|
||||
if self.synclabels:
|
||||
for uid, msg in self.messagelist.items():
|
||||
for uid, msg in list(self.messagelist.items()):
|
||||
filepath = os.path.join(self.getfullname(), msg['filename'])
|
||||
msg['mtime'] = int(os.stat(filepath).st_mtime)
|
||||
|
||||
|
@ -230,7 +230,7 @@ class MaildirFolder(BaseFolder):
|
||||
sorted(statusfolder.getmessageuidlist()):
|
||||
return True
|
||||
# Also check for flag changes, it's quick on a Maildir.
|
||||
for (uid, message) in self.getmessagelist().iteritems():
|
||||
for (uid, message) in self.getmessagelist().items():
|
||||
if message['flags'] != statusfolder.getmessageflags(uid):
|
||||
return True
|
||||
return False # Nope, nothing changed.
|
||||
@ -495,7 +495,7 @@ class MaildirFolder(BaseFolder):
|
||||
"""
|
||||
oldfmd5 = md5(self.name).hexdigest()
|
||||
msglist = self._scanfolder()
|
||||
for mkey, mvalue in msglist.iteritems():
|
||||
for mkey, mvalue in msglist.items():
|
||||
filename = os.path.join(self.getfullname(), mvalue['filename'])
|
||||
match = re.search("FMD5=([a-fA-F0-9]+)", filename)
|
||||
if match is None:
|
||||
|
@ -77,7 +77,7 @@ class MappedIMAPFolder(IMAPFolder):
|
||||
if dolock: self.maplock.acquire()
|
||||
try:
|
||||
file = open(mapfilename + ".tmp", 'wt')
|
||||
for (key, value) in self.diskl2r.iteritems():
|
||||
for (key, value) in self.diskl2r.items():
|
||||
file.write("%d:%d\n"% (key, value))
|
||||
file.close()
|
||||
os.rename(mapfilename + '.tmp', mapfilename)
|
||||
@ -162,7 +162,7 @@ class MappedIMAPFolder(IMAPFolder):
|
||||
localhash = self._mb.getmessagelist()
|
||||
self.maplock.acquire()
|
||||
try:
|
||||
for key, value in localhash.items():
|
||||
for key, value in list(localhash.items()):
|
||||
try:
|
||||
key = self.l2r[key]
|
||||
except KeyError:
|
||||
|
@ -291,7 +291,7 @@ class OfflineImap:
|
||||
d = collections.defaultdict(lambda: 0)
|
||||
for v in l:
|
||||
d[tuple(v)] += 1
|
||||
return list((k, v) for k, v in d.iteritems())
|
||||
return list((k, v) for k, v in d.items())
|
||||
|
||||
stack_displays = []
|
||||
for threadId, stack in sys._current_frames().items():
|
||||
|
@ -190,7 +190,7 @@ class BaseRepository(CustomConfig.ConfigHelperMixin, object):
|
||||
dst_repo.getsep(), src_repo.getsep())] = folder
|
||||
|
||||
# Find and create new folders on src_repo.
|
||||
for src_name_t, src_folder in src_hash.iteritems():
|
||||
for src_name_t, src_folder in src_hash.items():
|
||||
# Don't create on dst_repo, if it is readonly.
|
||||
if not dst_repo.get_create_folders():
|
||||
break
|
||||
@ -207,7 +207,7 @@ class BaseRepository(CustomConfig.ConfigHelperMixin, object):
|
||||
status_repo.makefolder(src_name_t.replace(dst_repo.getsep(),
|
||||
status_repo.getsep()))
|
||||
# Find and create new folders on dst_repo.
|
||||
for dst_name_t, dst_folder in dst_hash.iteritems():
|
||||
for dst_name_t, dst_folder in dst_hash.items():
|
||||
if not src_repo.get_create_folders():
|
||||
# Don't create missing folder on readonly repo.
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user