Replace calls to long with int calls

long was removed from Python3

Signed-off-by: Łukasz Żarnowiecki <dolohow@outlook.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Łukasz Żarnowiecki 2016-05-08 16:42:52 +02:00 committed by Nicolas Sebrecht
parent 3848bc55f3
commit 068ac7c410
7 changed files with 23 additions and 23 deletions

View File

@ -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:

View File

@ -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'])

View File

@ -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)

View File

@ -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)

View File

@ -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'"% \

View File

@ -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):

View File

@ -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)