Prune trailing whitespaces from code and documentation
They are redundant in all pruned cases and sometimes even create some problems, e.g., when one tries to jump through paragraphs in vi. Signed-off-by: Eygene Ryabinkin <rea@codelabs.ru>
This commit is contained in:
@ -29,7 +29,7 @@ class CustomConfigParser(SafeConfigParser):
|
||||
return self.get(*(section, option) + args, **kwargs)
|
||||
else:
|
||||
return default
|
||||
|
||||
|
||||
def getdefaultint(self, section, option, default, *args, **kwargs):
|
||||
if self.has_option(section, option):
|
||||
return self.getint (*(section, option) + args, **kwargs)
|
||||
@ -120,7 +120,7 @@ class ConfigHelperMixin:
|
||||
return self._confighelper_runner(option, default,
|
||||
self.getconfig().getdefaultint,
|
||||
self.getconfig().getint)
|
||||
|
||||
|
||||
def getconffloat(self, option, default = CustomConfigDefault):
|
||||
return self._confighelper_runner(option, default,
|
||||
self.getconfig().getdefaultfloat,
|
||||
|
@ -14,6 +14,6 @@ __homepage__ = "http://offlineimap.org"
|
||||
banner = __bigcopyright__
|
||||
|
||||
from offlineimap.error import OfflineImapError
|
||||
# put this last, so we don't run into circular dependencies using
|
||||
# put this last, so we don't run into circular dependencies using
|
||||
# e.g. offlineimap.__version__.
|
||||
from offlineimap.init import OfflineImap
|
||||
|
@ -210,7 +210,7 @@ class BaseFolder(object):
|
||||
If the backend CAN assign a new uid, but cannot find out what
|
||||
this UID is (as is the case with some IMAP servers), it
|
||||
returns 0 but DOES save the message.
|
||||
|
||||
|
||||
IMAP backend should be the only one that can assign a new
|
||||
uid.
|
||||
|
||||
@ -493,7 +493,7 @@ class BaseFolder(object):
|
||||
continue #don't actually remove in a dryrun
|
||||
dstfolder.deletemessagesflags(uids, set(flag))
|
||||
statusfolder.deletemessagesflags(uids, set(flag))
|
||||
|
||||
|
||||
def syncmessagesto(self, dstfolder, statusfolder):
|
||||
"""Syncs messages in this folder to the destination dstfolder.
|
||||
|
||||
@ -514,7 +514,7 @@ class BaseFolder(object):
|
||||
uids present (except for potential negative uids that couldn't
|
||||
be placed anywhere).
|
||||
|
||||
Pass3: Synchronize flag changes
|
||||
Pass3: Synchronize flag changes
|
||||
Compare flag mismatches in self with those in statusfolder. If
|
||||
msg has a valid UID and exists on dstfolder (has not e.g. been
|
||||
deleted there), sync the flag change to both dstfolder and
|
||||
|
@ -44,7 +44,7 @@ class IMAPFolder(BaseFolder):
|
||||
|
||||
Prefer SELECT to EXAMINE if we can, since some servers
|
||||
(Courier) do not stabilize UID validity until the folder is
|
||||
selected.
|
||||
selected.
|
||||
.. todo: Still valid? Needs verification
|
||||
:param: Enforce new SELECT even if we are on that folder already.
|
||||
:returns: raises :exc:`OfflineImapError` severity FOLDER on error"""
|
||||
@ -116,7 +116,7 @@ class IMAPFolder(BaseFolder):
|
||||
maxmsgid = max(long(msgid), maxmsgid)
|
||||
# Different number of messages than last time?
|
||||
if maxmsgid != statusfolder.getmessagecount():
|
||||
return True
|
||||
return True
|
||||
return False
|
||||
|
||||
def cachemessagelist(self):
|
||||
@ -526,7 +526,7 @@ class IMAPFolder(BaseFolder):
|
||||
self.ui.debug('imap', 'savemessage: header is: %s: %s' %\
|
||||
(headername, headervalue))
|
||||
content = self.savemessage_addheader(content, headername,
|
||||
headervalue)
|
||||
headervalue)
|
||||
if len(content)>200:
|
||||
dbg_output = "%s...%s" % (content[:150], content[-50:])
|
||||
else:
|
||||
@ -710,11 +710,11 @@ class IMAPFolder(BaseFolder):
|
||||
def change_message_uid(self, uid, new_uid):
|
||||
"""Change the message from existing uid to new_uid
|
||||
|
||||
If the backend supports it. IMAP does not and will throw errors."""
|
||||
If the backend supports it. IMAP does not and will throw errors."""
|
||||
raise OfflineImapError('IMAP backend cannot change a messages UID from '
|
||||
'%d to %d' % (uid, new_uid),
|
||||
OfflineImapError.ERROR.MESSAGE)
|
||||
|
||||
|
||||
def deletemessage(self, uid):
|
||||
self.deletemessages_noconvert([uid])
|
||||
|
||||
|
@ -35,7 +35,7 @@ class LocalStatusSQLiteFolder(LocalStatusFolder):
|
||||
#though. According to sqlite docs, you need to commit() before
|
||||
#the connection is closed or your changes will be lost!"""
|
||||
#get db connection which autocommits
|
||||
#connection = sqlite.connect(self.filename, isolation_level=None)
|
||||
#connection = sqlite.connect(self.filename, isolation_level=None)
|
||||
#cursor = connection.cursor()
|
||||
#return connection, cursor
|
||||
|
||||
@ -43,7 +43,7 @@ class LocalStatusSQLiteFolder(LocalStatusFolder):
|
||||
cur_version = 1
|
||||
|
||||
def __init__(self, name, repository):
|
||||
super(LocalStatusSQLiteFolder, self).__init__(name, repository)
|
||||
super(LocalStatusSQLiteFolder, self).__init__(name, repository)
|
||||
# dblock protects against concurrent writes in same connection
|
||||
self._dblock = Lock()
|
||||
#Try to establish connection, no need for threadsafety in __init__
|
||||
|
@ -196,7 +196,7 @@ class MaildirFolder(BaseFolder):
|
||||
if sorted(self.getmessageuidlist()) != \
|
||||
sorted(statusfolder.getmessageuidlist()):
|
||||
return True
|
||||
# Also check for flag changes, it's quick on a Maildir
|
||||
# Also check for flag changes, it's quick on a Maildir
|
||||
for (uid, message) in self.getmessagelist().iteritems():
|
||||
if message['flags'] != statusfolder.getmessageflags(uid):
|
||||
return True
|
||||
@ -235,7 +235,7 @@ class MaildirFolder(BaseFolder):
|
||||
return '%d_%d.%d.%s,U=%d,FMD5=%s%s2,%s' % \
|
||||
(timeval, timeseq, os.getpid(), socket.gethostname(),
|
||||
uid, self._foldermd5, self.infosep, ''.join(sorted(flags)))
|
||||
|
||||
|
||||
def savemessage(self, uid, content, flags, rtime):
|
||||
"""Writes a new message, with the specified uid.
|
||||
|
||||
@ -263,7 +263,7 @@ class MaildirFolder(BaseFolder):
|
||||
fd = os.open(os.path.join(tmpdir, messagename),
|
||||
os.O_EXCL|os.O_CREAT|os.O_WRONLY, 0o666)
|
||||
except OSError as e:
|
||||
if e.errno == 17:
|
||||
if e.errno == 17:
|
||||
#FILE EXISTS ALREADY
|
||||
severity = OfflineImapError.ERROR.MESSAGE
|
||||
raise OfflineImapError("Unique filename %s already existing." %\
|
||||
@ -348,7 +348,7 @@ class MaildirFolder(BaseFolder):
|
||||
os.path.join(self.getfullname(), dir_prefix, filename))
|
||||
self.messagelist[new_uid] = self.messagelist[uid]
|
||||
del self.messagelist[uid]
|
||||
|
||||
|
||||
def deletemessage(self, uid):
|
||||
"""Unlinks a message file from the Maildir.
|
||||
|
||||
@ -373,4 +373,4 @@ class MaildirFolder(BaseFolder):
|
||||
os.unlink(filepath)
|
||||
# Yep -- return.
|
||||
del(self.messagelist[uid])
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ class MappedIMAPFolder(IMAPFolder):
|
||||
def _getmapfilename(self):
|
||||
return os.path.join(self.repository.getmapdir(),
|
||||
self.getfolderbasename())
|
||||
|
||||
|
||||
def _loadmaps(self):
|
||||
self.maplock.acquire()
|
||||
try:
|
||||
|
@ -1330,7 +1330,7 @@ class IMAP4(object):
|
||||
self.ouq.put(rqb)
|
||||
return rqb
|
||||
|
||||
# Must setup continuation expectancy *before* ouq.put
|
||||
# Must setup continuation expectancy *before* ouq.put
|
||||
crqb = self._request_push(tag='continuation')
|
||||
|
||||
self.ouq.put(rqb)
|
||||
@ -2442,7 +2442,7 @@ if __name__ == '__main__':
|
||||
run('id', ())
|
||||
run('id', ('("name", "imaplib2")',))
|
||||
run('id', ("version", __version__, "os", os.uname()[0]))
|
||||
|
||||
|
||||
for cmd,args in test_seq2:
|
||||
if (cmd,args) != ('uid', ('SEARCH', 'SUBJECT', 'IMAP4 test')):
|
||||
run(cmd, args)
|
||||
|
@ -137,7 +137,7 @@ class IMAPServer:
|
||||
try:
|
||||
if self.gss_step == self.GSS_STATE_STEP:
|
||||
if not self.gss_vc:
|
||||
rc, self.gss_vc = kerberos.authGSSClientInit('imap@' +
|
||||
rc, self.gss_vc = kerberos.authGSSClientInit('imap@' +
|
||||
self.hostname)
|
||||
response = kerberos.authGSSClientResponse(self.gss_vc)
|
||||
rc = kerberos.authGSSClientStep(self.gss_vc, data)
|
||||
@ -188,7 +188,7 @@ class IMAPServer:
|
||||
self.lastowner[imapobj] = curThread.ident
|
||||
self.connectionlock.release()
|
||||
return imapobj
|
||||
|
||||
|
||||
self.connectionlock.release() # Release until need to modify data
|
||||
|
||||
""" Must be careful here that if we fail we should bail out gracefully
|
||||
@ -433,7 +433,7 @@ class IMAPServer:
|
||||
certnames = []
|
||||
|
||||
# cert expired?
|
||||
notafter = cert.get('notAfter')
|
||||
notafter = cert.get('notAfter')
|
||||
if notafter:
|
||||
if time.time() >= cert_time_to_seconds(notafter):
|
||||
return '%s certificate expired %s' % (errstr, notafter)
|
||||
|
@ -277,7 +277,7 @@ class OfflineImap:
|
||||
|
||||
if options.logfile:
|
||||
sys.stderr = self.ui.logfile
|
||||
|
||||
|
||||
socktimeout = config.getdefaultint("general", "socktimeout", 0)
|
||||
if socktimeout > 0:
|
||||
socket.setdefaulttimeout(socktimeout)
|
||||
|
@ -70,5 +70,3 @@ def genmbnames():
|
||||
file.close()
|
||||
finally:
|
||||
mblock.release()
|
||||
|
||||
|
||||
|
@ -116,7 +116,7 @@ class BaseRepository(CustomConfig.ConfigHelperMixin, object):
|
||||
|
||||
def getlocaleval(self):
|
||||
return self.account.getlocaleval()
|
||||
|
||||
|
||||
def getfolders(self):
|
||||
"""Returns a list of ALL folders on this server."""
|
||||
return []
|
||||
|
@ -28,7 +28,7 @@ class GmailRepository(IMAPRepository):
|
||||
HOSTNAME = "imap.gmail.com"
|
||||
# Gmail IMAP server port
|
||||
PORT = 993
|
||||
|
||||
|
||||
def __init__(self, reposname, account):
|
||||
"""Initialize a GmailRepository object."""
|
||||
# Enforce SSL usage
|
||||
|
@ -362,7 +362,7 @@ class IMAPRepository(BaseRepository):
|
||||
OfflineImapError.ERROR.FOLDER)
|
||||
finally:
|
||||
self.imapserver.releaseconnection(imapobj)
|
||||
|
||||
|
||||
class MappedIMAPRepository(IMAPRepository):
|
||||
def getfoldertype(self):
|
||||
return MappedIMAPFolder
|
||||
|
@ -91,7 +91,7 @@ class LocalStatusRepository(BaseRepository):
|
||||
return folder
|
||||
|
||||
def getfolders(self):
|
||||
"""Returns a list of all cached folders.
|
||||
"""Returns a list of all cached folders.
|
||||
|
||||
Does nothing for this backend. We mangle the folder file names
|
||||
(see getfolderfilename) so we can not derive folder names from
|
||||
|
@ -85,7 +85,7 @@ class MaildirRepository(BaseRepository):
|
||||
if self.account.dryrun:
|
||||
return
|
||||
full_path = os.path.abspath(os.path.join(self.root, foldername))
|
||||
|
||||
|
||||
# sanity tests
|
||||
if self.getsep() == '/':
|
||||
for component in foldername.split('/'):
|
||||
|
@ -79,7 +79,7 @@ class MachineUI(UIBase):
|
||||
s._printData('connecting', "%s\n%s" % (hostname, str(port)))
|
||||
|
||||
def syncfolders(s, srcrepos, destrepos):
|
||||
s._printData('syncfolders', "%s\n%s" % (s.getnicename(srcrepos),
|
||||
s._printData('syncfolders', "%s\n%s" % (s.getnicename(srcrepos),
|
||||
s.getnicename(destrepos)))
|
||||
|
||||
def syncingfolder(s, srcrepos, srcfolder, destrepos, destfolder):
|
||||
|
@ -20,7 +20,7 @@ from offlineimap.ui import TTY, Noninteractive, Machine
|
||||
|
||||
UI_LIST = {'ttyui': TTY.TTYUI,
|
||||
'basic': Noninteractive.Basic,
|
||||
'quiet': Noninteractive.Quiet,
|
||||
'quiet': Noninteractive.Quiet,
|
||||
'machineui': Machine.MachineUI}
|
||||
|
||||
#add Blinkenlights UI if it imports correctly (curses installed)
|
||||
|
@ -25,7 +25,7 @@ class DebuggingLock:
|
||||
def __init__(self, name):
|
||||
self.lock = Lock()
|
||||
self.name = name
|
||||
|
||||
|
||||
def acquire(self, blocking = 1):
|
||||
self.print_tb("Acquire lock")
|
||||
self.lock.acquire(blocking)
|
||||
@ -45,5 +45,5 @@ class DebuggingLock:
|
||||
self.logmsg(".... %s: Thread %s attempting to %s\n" % \
|
||||
(self.name, currentThread().getName(), msg) + \
|
||||
"\n".join(traceback.format_list(traceback.extract_stack())))
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user