From 068ac7c410b833d34abca2bab4b3f2704988c2ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20=C5=BBarnowiecki?= Date: Sun, 8 May 2016 16:42:52 +0200 Subject: [PATCH] Replace calls to long with int calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit long was removed from Python3 Signed-off-by: Łukasz Żarnowiecki Signed-off-by: Nicolas Sebrecht --- offlineimap/folder/Base.py | 4 ++-- offlineimap/folder/Gmail.py | 2 +- offlineimap/folder/GmailMaildir.py | 10 +++++----- offlineimap/folder/IMAP.py | 12 ++++++------ offlineimap/folder/LocalStatus.py | 6 +++--- offlineimap/folder/Maildir.py | 8 ++++---- offlineimap/folder/UIDMaps.py | 4 ++-- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py index 5ac3eb2..06cf451 100644 --- a/offlineimap/folder/Base.py +++ b/offlineimap/folder/Base.py @@ -236,7 +236,7 @@ class BaseFolder(object): self._base_saved_uidvalidity = None else: file = open(uidfilename, "rt") - self._base_saved_uidvalidity = long(file.readline().strip()) + self._base_saved_uidvalidity = int(file.readline().strip()) file.close() return self._base_saved_uidvalidity @@ -390,7 +390,7 @@ class BaseFolder(object): return None try: fd = open(uidfile, 'rt') - min_uid = long(fd.readline().strip()) + min_uid = int(fd.readline().strip()) fd.close() return min_uid except: diff --git a/offlineimap/folder/Gmail.py b/offlineimap/folder/Gmail.py index 970d836..0abd221 100644 --- a/offlineimap/folder/Gmail.py +++ b/offlineimap/folder/Gmail.py @@ -159,7 +159,7 @@ class GmailFolder(IMAPFolder): str(options), minor = 1) else: - uid = long(options['UID']) + uid = int(options['UID']) self.messagelist[uid] = self.msglist_item_initializer(uid) flags = imaputil.flagsimap2maildir(options['FLAGS']) m = re.search('\(([^\)]*)\)', options['X-GM-LABELS']) diff --git a/offlineimap/folder/GmailMaildir.py b/offlineimap/folder/GmailMaildir.py index 05f7d79..125e440 100644 --- a/offlineimap/folder/GmailMaildir.py +++ b/offlineimap/folder/GmailMaildir.py @@ -72,7 +72,7 @@ class GmailMaildirFolder(MaildirFolder): if self.synclabels: for uid, msg in self.messagelist.items(): filepath = os.path.join(self.getfullname(), msg['filename']) - msg['mtime'] = long(os.stat(filepath).st_mtime) + msg['mtime'] = int(os.stat(filepath).st_mtime) def getmessagelabels(self, uid): @@ -122,7 +122,7 @@ class GmailMaildirFolder(MaildirFolder): # Update the mtime and labels filename = self.messagelist[uid]['filename'] filepath = os.path.join(self.getfullname(), filename) - self.messagelist[uid]['mtime'] = long(os.stat(filepath).st_mtime) + self.messagelist[uid]['mtime'] = int(os.stat(filepath).st_mtime) self.messagelist[uid]['labels'] = labels return ret @@ -159,7 +159,7 @@ class GmailMaildirFolder(MaildirFolder): content = self.deletemessageheaders(content, self.labelsheader) content = self.addmessageheader(content, '\n', self.labelsheader, labels_str) - mtime = long(os.stat(filepath).st_mtime) + mtime = int(os.stat(filepath).st_mtime) # write file with new labels to a unique file in tmp messagename = self.new_message_filename(uid, set()) @@ -179,7 +179,7 @@ class GmailMaildirFolder(MaildirFolder): os.utime(filepath, (mtime, mtime)) # save the new mtime and labels - self.messagelist[uid]['mtime'] = long(os.stat(filepath).st_mtime) + self.messagelist[uid]['mtime'] = int(os.stat(filepath).st_mtime) self.messagelist[uid]['labels'] = labels def copymessageto(self, uid, dstfolder, statusfolder, register = 1): @@ -319,7 +319,7 @@ class GmailMaildirFolder(MaildirFolder): filename = self.messagelist[uid]['filename'] filepath = os.path.join(self.getfullname(), filename) - mtimes[uid] = long(os.stat(filepath).st_mtime) + mtimes[uid] = int(os.stat(filepath).st_mtime) # finally update statusfolder in a single DB transaction statusfolder.savemessagesmtimebulk(mtimes) diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index c305334..48eec82 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -106,7 +106,7 @@ class IMAPFolder(BaseFolder): typ, uidval = imapobj.response('UIDVALIDITY') assert uidval != [None] and uidval != None, \ "response('UIDVALIDITY') returned [None]!" - self._uidvalidity = long(uidval[-1]) + self._uidvalidity = int(uidval[-1]) return self._uidvalidity finally: self.imapserver.releaseconnection(imapobj) @@ -143,7 +143,7 @@ class IMAPFolder(BaseFolder): return True maxmsgid = 0 for msgid in imapdata: - maxmsgid = max(long(msgid), maxmsgid) + maxmsgid = max(int(msgid), maxmsgid) # Different number of messages than last time? if maxmsgid != statusfolder.getmessagecount(): return True @@ -251,7 +251,7 @@ class IMAPFolder(BaseFolder): str(options), minor = 1) else: - uid = long(options['UID']) + uid = int(options['UID']) self.messagelist[uid] = self.msglist_item_initializer(uid) flags = imaputil.flagsimap2maildir(options['FLAGS']) keywords = imaputil.flagsimap2keywords(options['FLAGS']) @@ -360,7 +360,7 @@ class IMAPFolder(BaseFolder): raise ValueError("While attempting to find UID for message with " "header %s, got wrong-sized matchinguids of %s"%\ (headername, str(matchinguids))) - return long(matchinguids[0]) + return int(matchinguids[0]) def __savemessage_fetchheaders(self, imapobj, headername, headervalue): """ We fetch all new mail headers and search for the right @@ -643,7 +643,7 @@ class IMAPFolder(BaseFolder): self.ui.warn("Server supports UIDPLUS but got no APPENDUID " "appending a message.") return 0 - uid = long(resp[-1].split(' ')[1]) + uid = int(resp[-1].split(' ')[1]) if uid == 0: self.ui.warn("savemessage: Server supports UIDPLUS, but" " we got no usable uid back. APPENDUID reponse was " @@ -823,7 +823,7 @@ class IMAPFolder(BaseFolder): # Compensate for servers that don't return a UID attribute. continue flagstr = attributehash['FLAGS'] - uid = long(attributehash['UID']) + uid = int(attributehash['UID']) self.messagelist[uid]['flags'] = imaputil.flagsimap2maildir(flagstr) try: needupdate.remove(uid) diff --git a/offlineimap/folder/LocalStatus.py b/offlineimap/folder/LocalStatus.py index d9b9b70..e8b3a39 100644 --- a/offlineimap/folder/LocalStatus.py +++ b/offlineimap/folder/LocalStatus.py @@ -68,7 +68,7 @@ class LocalStatusFolder(BaseFolder): line = line.strip() try: uid, flags = line.split(':') - uid = long(uid) + uid = int(uid) flags = set(flags) except ValueError as e: errstr = "Corrupt line '%s' in cache file '%s'" % \ @@ -89,9 +89,9 @@ class LocalStatusFolder(BaseFolder): line = line.strip() try: uid, flags, mtime, labels = line.split('|') - uid = long(uid) + uid = int(uid) flags = set(flags) - mtime = long(mtime) + mtime = int(mtime) labels = set([lb.strip() for lb in labels.split(',') if len(lb.strip()) > 0]) except ValueError as e: errstr = "Corrupt line '%s' in cache file '%s'"% \ diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py index d97b0d3..94b2d08 100644 --- a/offlineimap/folder/Maildir.py +++ b/offlineimap/folder/Maildir.py @@ -46,7 +46,7 @@ def _gettimeseq(date=None): timelock.acquire() try: if date is None: - date = long(time.time()) + date = int(time.time()) if timehash.has_key(date): timehash[date] += 1 else: @@ -97,7 +97,7 @@ class MaildirFolder(BaseFolder): if not timestampmatch: return True timestampstr = timestampmatch.group() - timestamplong = long(timestampstr) + timestamplong = int(timestampstr) if(timestamplong < time.mktime(date)): return False else: @@ -131,7 +131,7 @@ class MaildirFolder(BaseFolder): if foldermatch: uidmatch = re_uidmatch.search(filename) if uidmatch: - uid = long(uidmatch.group(1)) + uid = int(uidmatch.group(1)) flagmatch = self.re_flagmatch.search(filename) if flagmatch: flags = set((c for c in flagmatch.group(1))) @@ -182,7 +182,7 @@ class MaildirFolder(BaseFolder): uid = nouidcounter nouidcounter -= 1 else: - uid = long(uidmatch.group(1)) + uid = int(uidmatch.group(1)) if min_uid != None and uid > 0 and uid < min_uid: continue if min_date != None and not self._iswithintime(filename, min_date): diff --git a/offlineimap/folder/UIDMaps.py b/offlineimap/folder/UIDMaps.py index 1e54f2b..8848e9a 100644 --- a/offlineimap/folder/UIDMaps.py +++ b/offlineimap/folder/UIDMaps.py @@ -64,8 +64,8 @@ class MappedIMAPFolder(IMAPFolder): raise Exception("Corrupt line '%s' in UID mapping file '%s'"% (line, mapfilename)), None, exc_info()[2] (str1, str2) = line.split(':') - loc = long(str1) - rem = long(str2) + loc = int(str1) + rem = int(str2) r2l[rem] = loc l2r[loc] = rem return (r2l, l2r)