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:
Eygene Ryabinkin 2013-07-21 23:00:23 +04:00
parent e8c40a9285
commit 41cb0f577f
25 changed files with 60 additions and 62 deletions

View File

@ -122,7 +122,7 @@ OfflineIMAP v6.5.2 (2012-01-17)
* Some sanity checks and improved error messages.
* Revert 6.5.1.1 change to use public imaplib2 function, it was reported to
* Revert 6.5.1.1 change to use public imaplib2 function, it was reported to
not always work.
* Don't fail when ~/netrc is not readable by us.
@ -280,7 +280,7 @@ Changes
* Refresh server capabilities after login, so we know that Gmail
supports UIDPLUS (it only announces that after login, not
before). This prevents us from adding custom headers to Gmail uploads.
Bug Fixes
---------
@ -338,7 +338,7 @@ New Features
* When a message upload/download fails, we do not abort the whole folder
synchronization, but only skip that message, informing the user at the
end of the sync run.
* If you connect via ssl and 'cert_fingerprint' is configured, we check
that the server certificate is actually known and identical by
comparing the stored sha1 fingerprint with the current one.
@ -437,7 +437,7 @@ Notes
-----
This was a very active rc1 and we could expect a lot of new fixes for the next
release.
release.
The most important fix is about a bug that could lead to data loss. Find more
information about his bug here:
@ -588,7 +588,7 @@ I'd like to thank reporters who involved in this cycle:
- Pan Tsu
- Vincent Beffara
- Will Styler
(my apologies if I forget somebody) ...and all active developers, of course!
The imaplib2 migration looks to go the right way to be definetly released but

View File

@ -40,7 +40,7 @@ Most configuration is done via the configuration file. However, any setting can
OfflineImap is well suited to be frequently invoked by cron jobs, or can run in daemon mode to periodically check your email (however, it will exit in some error situations).
The documentation is included in the git repository and can be created by
The documentation is included in the git repository and can be created by
issueing `make dev-doc` in the `doc` folder (python-sphinx required), or it can
be viewed online at http://docs.offlineimap.org.
@ -420,7 +420,7 @@ This is an example of a setup where "TheOtherImap" requires all folders to be un
# The below will put all GMAIL folders as sub-folders of the 'local' INBOX,
# assuming that your path separator on 'local' is a dot.
nametrans = lambda x: 'INBOX.' + x
[Repository TheOtherImap]
#This is the 'local' repository
type = IMAP
@ -437,7 +437,7 @@ Add this to the remote gmail repository section to only sync mails which are in
To only get the All Mail folder from a Gmail account, you would e.g. do::
folderfilter = lambda folder: folder.startswith('[Gmail]/All Mail')
folderfilter = lambda folder: folder.startswith('[Gmail]/All Mail')
Another nametrans transpose example
@ -464,25 +464,25 @@ offlineimap.conf::
ui = ttyui
pythonfile=~/bin/offlineimap-helpers.py
socktimeout = 90
[Account acc1]
localrepository = acc1local
remoterepository = acc1remote
autorefresh = 2
[Account acc2]
localrepository = acc2local
remoterepository = acc2remote
autorefresh = 4
[Repository acc1local]
type = Maildir
localfolders = ~/Mail/acc1
[Repository acc2local]
type = Maildir
localfolders = ~/Mail/acc2
[Repository acc1remote]
type = IMAP
remotehost = imap.acc1.com
@ -494,7 +494,7 @@ offlineimap.conf::
# Folders to get:
folderfilter = lambda foldername: foldername in [
'INBOX', 'Drafts', 'Sent', 'archiv']
[Repository acc2remote]
type = IMAP
remotehost = imap.acc2.net
@ -532,7 +532,7 @@ Offlineimap handles the renaming correctly in both directions::
retval = "acc1." + foldername
retval = re.sub("/", ".", retval)
return retval
def oimaptransfolder_acc2(foldername):
if(foldername == "INBOX"):
retval = "acc2"

View File

@ -9,7 +9,7 @@
Within :mod:`offlineimap`, the classes :class:`OfflineImap` provides the high-level functionality. The rest of the classes should usually not needed to be touched by the user. Email repositories are represented by a :class:`offlineimap.repository.Base.BaseRepository` or derivatives (see :mod:`offlineimap.repository` for details). A folder within a repository is represented by a :class:`offlineimap.folder.Base.BaseFolder` or any derivative from :mod:`offlineimap.folder`.
This page contains the main API overview of OfflineImap |release|.
This page contains the main API overview of OfflineImap |release|.
OfflineImap can be imported as::
@ -22,7 +22,7 @@ be merged into the main documentation.
:mod:`offlineimap` -- The OfflineImap module
=============================================
.. module:: offlineimap
.. autoclass:: offlineimap.OfflineImap(cmdline_opts = None)

View File

@ -67,13 +67,13 @@ based in instructions submitted by Chris Walker::
First, you must run OfflineIMAP in the Cygwin environment. The Windows
filesystem is not powerful enough to accomodate Maildir by itself.
Next, youll need to mount your Maildir directory in a special
way. There is information for doing that at
http://barnson.org/node/295. That site gives this example::
mount -f -s -b -o managed "d:/tmp/mail" "/home/of/mail"
That URL also has more details on making OfflineIMAP work with Windows.
@ -383,9 +383,9 @@ youll list this::
[mbnames]
enabled = yes
filename = ~/Mutt/muttrc.mailboxes
header = "mailboxes "
peritem = "+%(accountname)s/%(foldername)s"
sep = " "
header = "mailboxes "
peritem = "+%(accountname)s/%(foldername)s"
sep = " "
footer = "\n"
Then in your ``.muttrc``::
@ -448,7 +448,7 @@ written in Korn, so youll need ksh, pdksh, or mksh to run it::
# remove any old instances of this shell script or offlineimap
for pid in $(pgrep offlineimap)
do
if $pid -ne $$
if $pid -ne $$
then
kill $pid
fi

View File

@ -440,7 +440,7 @@ Know the status of your patch after submission
of the branch in which your patch has been merged (i.e. it will not
tell you if your patch is merged in pu if you rebase on top of
master).
.. * Read the git mailing list, the maintainer regularly posts messages
entitled "What's cooking in git.git" and "What's in git.git" giving
the status of various proposed changes.

View File

@ -190,7 +190,7 @@ remoterepository = RemoteExample
# In this case a call to imapfilter to filter mail before the sync process
# starts and a custom shell script after the sync completes.
# The pre sync script has to complete before a sync to the account will
# start.
# start.
# presynchook = imapfilter
# postsynchook = notifysync.sh

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -70,5 +70,3 @@ def genmbnames():
file.close()
finally:
mblock.release()

View File

@ -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 []

View File

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

View File

@ -362,7 +362,7 @@ class IMAPRepository(BaseRepository):
OfflineImapError.ERROR.FOLDER)
finally:
self.imapserver.releaseconnection(imapobj)
class MappedIMAPRepository(IMAPRepository):
def getfoldertype(self):
return MappedIMAPFolder

View File

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

View File

@ -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('/'):

View File

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

View File

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

View File

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