[PATCH 2/2] fix style issues

Abdo Roig-Maranges abdo.roig at gmail.com
Mon Apr 6 22:05:28 BST 2015


---
 offlineimap/folder/Gmail.py        | 19 ++++++++++---------
 offlineimap/folder/GmailMaildir.py | 14 +++++++-------
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/offlineimap/folder/Gmail.py b/offlineimap/folder/Gmail.py
index d8502c7..3fa2def 100644
--- a/offlineimap/folder/Gmail.py
+++ b/offlineimap/folder/Gmail.py
@@ -330,39 +330,40 @@ class GmailFolder(IMAPFolder):
             if uid < 0 or not dstfolder.uidexists(uid):
                 continue
 
-            selflabels = self.getmessagelabels(uid) - self.ignorelabels
+            gmaillabels = self.getmessagelabels(uid) - self.ignorelabels
 
             if statusfolder.uidexists(uid):
                 statuslabels = statusfolder.getmessagelabels(uid) - self.ignorelabels
             else:
                 statuslabels = set()
 
-            if selflabels != statuslabels:
+            if gmaillabels != statuslabels:
                 uidlist.append(uid)
 
-        # now sync labels (slow)
+        # Now sync labels.
         mtimes = {}
         labels = {}
+        # This can be slow if there is a lot of modified messages
         for i, uid in enumerate(uidlist):
             # bail out on CTRL-C or SIGTERM
             if offlineimap.accounts.Account.abort_NOW_signal.is_set():
                 break
 
-            selflabels = self.getmessagelabels(uid) - self.ignorelabels
+            gmaillabels = self.getmessagelabels(uid) - self.ignorelabels
 
             if statusfolder.uidexists(uid):
                 statuslabels = statusfolder.getmessagelabels(uid) - self.ignorelabels
             else:
                 statuslabels = set()
 
-            if selflabels != statuslabels:
-                self.ui.settinglabels(uid, i+1, len(uidlist), sorted(selflabels), dstfolder)
+            if gmaillabels != statuslabels:
+                self.ui.settinglabels(uid, i+1, len(uidlist), sorted(gmaillabels), dstfolder)
                 if self.repository.account.dryrun:
-                    continue #don't actually add in a dryrun
-                dstfolder.savemessagelabels(uid, selflabels, ignorelabels = self.ignorelabels)
+                    continue # don't actually add in a dryrun
+                dstfolder.savemessagelabels(uid, gmaillabels, ignorelabels=self.ignorelabels)
                 mtime = dstfolder.getmessagemtime(uid)
                 mtimes[uid] = mtime
-                labels[uid] = selflabels
+                labels[uid] = gmaillabels
 
         # Update statusfolder in a single DB transaction. It is safe, as if something fails,
         # statusfolder will be updated on the next run.
diff --git a/offlineimap/folder/GmailMaildir.py b/offlineimap/folder/GmailMaildir.py
index 84d82c9..bd29163 100644
--- a/offlineimap/folder/GmailMaildir.py
+++ b/offlineimap/folder/GmailMaildir.py
@@ -260,21 +260,21 @@ class GmailMaildirFolder(MaildirFolder):
                 uidlist.append(uid)
 
         self.ui.collectingdata(uidlist, self)
-        # This can be slow if there is a lot of modified files
+        # This can be slow if there is a lot of files.
         for uid in uidlist:
             # bail out on CTRL-C or SIGTERM
             if offlineimap.accounts.Account.abort_NOW_signal.is_set():
                 break
 
-            selflabels = self.getmessagelabels(uid)
+            locallabels = self.getmessagelabels(uid)
 
             if statusfolder.uidexists(uid):
                 statuslabels = statusfolder.getmessagelabels(uid)
             else:
                 statuslabels = set()
 
-            addlabels = selflabels - statuslabels
-            dellabels = statuslabels - selflabels
+            addlabels = locallabels - statuslabels
+            dellabels = statuslabels - locallabels
 
             for lb in addlabels:
                 if not lb in addlabellist:
@@ -293,7 +293,7 @@ class GmailMaildirFolder(MaildirFolder):
 
             self.ui.addinglabels(uids, lb, dstfolder)
             if self.repository.account.dryrun:
-                continue #don't actually add in a dryrun
+                continue # don't actually add in a dryrun
             dstfolder.addmessageslabels(uids, set([lb]))
             statusfolder.addmessageslabels(uids, set([lb]))
 
@@ -304,7 +304,7 @@ class GmailMaildirFolder(MaildirFolder):
 
             self.ui.deletinglabels(uids, lb, dstfolder)
             if self.repository.account.dryrun:
-                continue #don't actually remove in a dryrun
+                continue # don't actually remove in a dryrun
             dstfolder.deletemessageslabels(uids, set([lb]))
             statusfolder.deletemessageslabels(uids, set([lb]))
 
@@ -317,7 +317,7 @@ class GmailMaildirFolder(MaildirFolder):
                 break
 
             if self.repository.account.dryrun:
-                continue #don't actually update statusfolder
+                continue # don't actually update statusfolder
 
             filename = self.messagelist[uid]['filename']
             filepath = os.path.join(self.getfullname(), filename)
-- 
2.3.5





More information about the OfflineIMAP-project mailing list