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:
parent
3848bc55f3
commit
068ac7c410
@ -236,7 +236,7 @@ class BaseFolder(object):
|
|||||||
self._base_saved_uidvalidity = None
|
self._base_saved_uidvalidity = None
|
||||||
else:
|
else:
|
||||||
file = open(uidfilename, "rt")
|
file = open(uidfilename, "rt")
|
||||||
self._base_saved_uidvalidity = long(file.readline().strip())
|
self._base_saved_uidvalidity = int(file.readline().strip())
|
||||||
file.close()
|
file.close()
|
||||||
return self._base_saved_uidvalidity
|
return self._base_saved_uidvalidity
|
||||||
|
|
||||||
@ -390,7 +390,7 @@ class BaseFolder(object):
|
|||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
fd = open(uidfile, 'rt')
|
fd = open(uidfile, 'rt')
|
||||||
min_uid = long(fd.readline().strip())
|
min_uid = int(fd.readline().strip())
|
||||||
fd.close()
|
fd.close()
|
||||||
return min_uid
|
return min_uid
|
||||||
except:
|
except:
|
||||||
|
@ -159,7 +159,7 @@ class GmailFolder(IMAPFolder):
|
|||||||
str(options),
|
str(options),
|
||||||
minor = 1)
|
minor = 1)
|
||||||
else:
|
else:
|
||||||
uid = long(options['UID'])
|
uid = int(options['UID'])
|
||||||
self.messagelist[uid] = self.msglist_item_initializer(uid)
|
self.messagelist[uid] = self.msglist_item_initializer(uid)
|
||||||
flags = imaputil.flagsimap2maildir(options['FLAGS'])
|
flags = imaputil.flagsimap2maildir(options['FLAGS'])
|
||||||
m = re.search('\(([^\)]*)\)', options['X-GM-LABELS'])
|
m = re.search('\(([^\)]*)\)', options['X-GM-LABELS'])
|
||||||
|
@ -72,7 +72,7 @@ class GmailMaildirFolder(MaildirFolder):
|
|||||||
if self.synclabels:
|
if self.synclabels:
|
||||||
for uid, msg in self.messagelist.items():
|
for uid, msg in self.messagelist.items():
|
||||||
filepath = os.path.join(self.getfullname(), msg['filename'])
|
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):
|
def getmessagelabels(self, uid):
|
||||||
@ -122,7 +122,7 @@ class GmailMaildirFolder(MaildirFolder):
|
|||||||
# Update the mtime and labels
|
# Update the mtime and labels
|
||||||
filename = self.messagelist[uid]['filename']
|
filename = self.messagelist[uid]['filename']
|
||||||
filepath = os.path.join(self.getfullname(), 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
|
self.messagelist[uid]['labels'] = labels
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ class GmailMaildirFolder(MaildirFolder):
|
|||||||
content = self.deletemessageheaders(content, self.labelsheader)
|
content = self.deletemessageheaders(content, self.labelsheader)
|
||||||
content = self.addmessageheader(content, '\n', self.labelsheader, labels_str)
|
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
|
# write file with new labels to a unique file in tmp
|
||||||
messagename = self.new_message_filename(uid, set())
|
messagename = self.new_message_filename(uid, set())
|
||||||
@ -179,7 +179,7 @@ class GmailMaildirFolder(MaildirFolder):
|
|||||||
os.utime(filepath, (mtime, mtime))
|
os.utime(filepath, (mtime, mtime))
|
||||||
|
|
||||||
# save the new mtime and labels
|
# 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
|
self.messagelist[uid]['labels'] = labels
|
||||||
|
|
||||||
def copymessageto(self, uid, dstfolder, statusfolder, register = 1):
|
def copymessageto(self, uid, dstfolder, statusfolder, register = 1):
|
||||||
@ -319,7 +319,7 @@ class GmailMaildirFolder(MaildirFolder):
|
|||||||
|
|
||||||
filename = self.messagelist[uid]['filename']
|
filename = self.messagelist[uid]['filename']
|
||||||
filepath = os.path.join(self.getfullname(), 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
|
# finally update statusfolder in a single DB transaction
|
||||||
statusfolder.savemessagesmtimebulk(mtimes)
|
statusfolder.savemessagesmtimebulk(mtimes)
|
||||||
|
@ -106,7 +106,7 @@ class IMAPFolder(BaseFolder):
|
|||||||
typ, uidval = imapobj.response('UIDVALIDITY')
|
typ, uidval = imapobj.response('UIDVALIDITY')
|
||||||
assert uidval != [None] and uidval != None, \
|
assert uidval != [None] and uidval != None, \
|
||||||
"response('UIDVALIDITY') returned [None]!"
|
"response('UIDVALIDITY') returned [None]!"
|
||||||
self._uidvalidity = long(uidval[-1])
|
self._uidvalidity = int(uidval[-1])
|
||||||
return self._uidvalidity
|
return self._uidvalidity
|
||||||
finally:
|
finally:
|
||||||
self.imapserver.releaseconnection(imapobj)
|
self.imapserver.releaseconnection(imapobj)
|
||||||
@ -143,7 +143,7 @@ class IMAPFolder(BaseFolder):
|
|||||||
return True
|
return True
|
||||||
maxmsgid = 0
|
maxmsgid = 0
|
||||||
for msgid in imapdata:
|
for msgid in imapdata:
|
||||||
maxmsgid = max(long(msgid), maxmsgid)
|
maxmsgid = max(int(msgid), maxmsgid)
|
||||||
# Different number of messages than last time?
|
# Different number of messages than last time?
|
||||||
if maxmsgid != statusfolder.getmessagecount():
|
if maxmsgid != statusfolder.getmessagecount():
|
||||||
return True
|
return True
|
||||||
@ -251,7 +251,7 @@ class IMAPFolder(BaseFolder):
|
|||||||
str(options),
|
str(options),
|
||||||
minor = 1)
|
minor = 1)
|
||||||
else:
|
else:
|
||||||
uid = long(options['UID'])
|
uid = int(options['UID'])
|
||||||
self.messagelist[uid] = self.msglist_item_initializer(uid)
|
self.messagelist[uid] = self.msglist_item_initializer(uid)
|
||||||
flags = imaputil.flagsimap2maildir(options['FLAGS'])
|
flags = imaputil.flagsimap2maildir(options['FLAGS'])
|
||||||
keywords = imaputil.flagsimap2keywords(options['FLAGS'])
|
keywords = imaputil.flagsimap2keywords(options['FLAGS'])
|
||||||
@ -360,7 +360,7 @@ class IMAPFolder(BaseFolder):
|
|||||||
raise ValueError("While attempting to find UID for message with "
|
raise ValueError("While attempting to find UID for message with "
|
||||||
"header %s, got wrong-sized matchinguids of %s"%\
|
"header %s, got wrong-sized matchinguids of %s"%\
|
||||||
(headername, str(matchinguids)))
|
(headername, str(matchinguids)))
|
||||||
return long(matchinguids[0])
|
return int(matchinguids[0])
|
||||||
|
|
||||||
def __savemessage_fetchheaders(self, imapobj, headername, headervalue):
|
def __savemessage_fetchheaders(self, imapobj, headername, headervalue):
|
||||||
""" We fetch all new mail headers and search for the right
|
""" 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 "
|
self.ui.warn("Server supports UIDPLUS but got no APPENDUID "
|
||||||
"appending a message.")
|
"appending a message.")
|
||||||
return 0
|
return 0
|
||||||
uid = long(resp[-1].split(' ')[1])
|
uid = int(resp[-1].split(' ')[1])
|
||||||
if uid == 0:
|
if uid == 0:
|
||||||
self.ui.warn("savemessage: Server supports UIDPLUS, but"
|
self.ui.warn("savemessage: Server supports UIDPLUS, but"
|
||||||
" we got no usable uid back. APPENDUID reponse was "
|
" 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.
|
# Compensate for servers that don't return a UID attribute.
|
||||||
continue
|
continue
|
||||||
flagstr = attributehash['FLAGS']
|
flagstr = attributehash['FLAGS']
|
||||||
uid = long(attributehash['UID'])
|
uid = int(attributehash['UID'])
|
||||||
self.messagelist[uid]['flags'] = imaputil.flagsimap2maildir(flagstr)
|
self.messagelist[uid]['flags'] = imaputil.flagsimap2maildir(flagstr)
|
||||||
try:
|
try:
|
||||||
needupdate.remove(uid)
|
needupdate.remove(uid)
|
||||||
|
@ -68,7 +68,7 @@ class LocalStatusFolder(BaseFolder):
|
|||||||
line = line.strip()
|
line = line.strip()
|
||||||
try:
|
try:
|
||||||
uid, flags = line.split(':')
|
uid, flags = line.split(':')
|
||||||
uid = long(uid)
|
uid = int(uid)
|
||||||
flags = set(flags)
|
flags = set(flags)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
errstr = "Corrupt line '%s' in cache file '%s'" % \
|
errstr = "Corrupt line '%s' in cache file '%s'" % \
|
||||||
@ -89,9 +89,9 @@ class LocalStatusFolder(BaseFolder):
|
|||||||
line = line.strip()
|
line = line.strip()
|
||||||
try:
|
try:
|
||||||
uid, flags, mtime, labels = line.split('|')
|
uid, flags, mtime, labels = line.split('|')
|
||||||
uid = long(uid)
|
uid = int(uid)
|
||||||
flags = set(flags)
|
flags = set(flags)
|
||||||
mtime = long(mtime)
|
mtime = int(mtime)
|
||||||
labels = set([lb.strip() for lb in labels.split(',') if len(lb.strip()) > 0])
|
labels = set([lb.strip() for lb in labels.split(',') if len(lb.strip()) > 0])
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
errstr = "Corrupt line '%s' in cache file '%s'"% \
|
errstr = "Corrupt line '%s' in cache file '%s'"% \
|
||||||
|
@ -46,7 +46,7 @@ def _gettimeseq(date=None):
|
|||||||
timelock.acquire()
|
timelock.acquire()
|
||||||
try:
|
try:
|
||||||
if date is None:
|
if date is None:
|
||||||
date = long(time.time())
|
date = int(time.time())
|
||||||
if timehash.has_key(date):
|
if timehash.has_key(date):
|
||||||
timehash[date] += 1
|
timehash[date] += 1
|
||||||
else:
|
else:
|
||||||
@ -97,7 +97,7 @@ class MaildirFolder(BaseFolder):
|
|||||||
if not timestampmatch:
|
if not timestampmatch:
|
||||||
return True
|
return True
|
||||||
timestampstr = timestampmatch.group()
|
timestampstr = timestampmatch.group()
|
||||||
timestamplong = long(timestampstr)
|
timestamplong = int(timestampstr)
|
||||||
if(timestamplong < time.mktime(date)):
|
if(timestamplong < time.mktime(date)):
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
@ -131,7 +131,7 @@ class MaildirFolder(BaseFolder):
|
|||||||
if foldermatch:
|
if foldermatch:
|
||||||
uidmatch = re_uidmatch.search(filename)
|
uidmatch = re_uidmatch.search(filename)
|
||||||
if uidmatch:
|
if uidmatch:
|
||||||
uid = long(uidmatch.group(1))
|
uid = int(uidmatch.group(1))
|
||||||
flagmatch = self.re_flagmatch.search(filename)
|
flagmatch = self.re_flagmatch.search(filename)
|
||||||
if flagmatch:
|
if flagmatch:
|
||||||
flags = set((c for c in flagmatch.group(1)))
|
flags = set((c for c in flagmatch.group(1)))
|
||||||
@ -182,7 +182,7 @@ class MaildirFolder(BaseFolder):
|
|||||||
uid = nouidcounter
|
uid = nouidcounter
|
||||||
nouidcounter -= 1
|
nouidcounter -= 1
|
||||||
else:
|
else:
|
||||||
uid = long(uidmatch.group(1))
|
uid = int(uidmatch.group(1))
|
||||||
if min_uid != None and uid > 0 and uid < min_uid:
|
if min_uid != None and uid > 0 and uid < min_uid:
|
||||||
continue
|
continue
|
||||||
if min_date != None and not self._iswithintime(filename, min_date):
|
if min_date != None and not self._iswithintime(filename, min_date):
|
||||||
|
@ -64,8 +64,8 @@ class MappedIMAPFolder(IMAPFolder):
|
|||||||
raise Exception("Corrupt line '%s' in UID mapping file '%s'"%
|
raise Exception("Corrupt line '%s' in UID mapping file '%s'"%
|
||||||
(line, mapfilename)), None, exc_info()[2]
|
(line, mapfilename)), None, exc_info()[2]
|
||||||
(str1, str2) = line.split(':')
|
(str1, str2) = line.split(':')
|
||||||
loc = long(str1)
|
loc = int(str1)
|
||||||
rem = long(str2)
|
rem = int(str2)
|
||||||
r2l[rem] = loc
|
r2l[rem] = loc
|
||||||
l2r[loc] = rem
|
l2r[loc] = rem
|
||||||
return (r2l, l2r)
|
return (r2l, l2r)
|
||||||
|
Loading…
Reference in New Issue
Block a user