From a44718130d18c30615762ca0dcccdb30e7ff45c6 Mon Sep 17 00:00:00 2001 From: Nicolas Sebrecht Date: Sun, 11 Jan 2015 13:54:53 +0100 Subject: [PATCH] minor: add comments Signed-off-by: Nicolas Sebrecht --- offlineimap/accounts.py | 6 ++++++ offlineimap/folder/IMAP.py | 2 ++ offlineimap/init.py | 2 ++ offlineimap/repository/IMAP.py | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/offlineimap/accounts.py b/offlineimap/accounts.py index 91314f9..95b3e9f 100644 --- a/offlineimap/accounts.py +++ b/offlineimap/accounts.py @@ -33,15 +33,21 @@ except: # FIXME: spaghetti code alert! def getaccountlist(customconfig): + # Account names in a list. return customconfig.getsectionlist('Account') # FIXME: spaghetti code alert! def AccountListGenerator(customconfig): + """Returns a list of instanciated Account class, one per account name.""" + return [Account(customconfig, accountname) for accountname in getaccountlist(customconfig)] # FIXME: spaghetti code alert! def AccountHashGenerator(customconfig): + """Returns a dict of instanciated Account class with the account name as + key.""" + retval = {} for item in AccountListGenerator(customconfig): retval[item.getname()] = item diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py index e67cb06..00afce0 100644 --- a/offlineimap/folder/IMAP.py +++ b/offlineimap/folder/IMAP.py @@ -40,6 +40,8 @@ CRLF = '\r\n' class IMAPFolder(BaseFolder): def __init__(self, imapserver, name, repository): + # FIXME: decide if unquoted name is from the responsability of the + # caller or not, but not both. name = imaputil.dequote(name) self.sep = imapserver.delim super(IMAPFolder, self).__init__(name, repository) diff --git a/offlineimap/init.py b/offlineimap/init.py index 878f5cf..f53c9a5 100644 --- a/offlineimap/init.py +++ b/offlineimap/init.py @@ -321,6 +321,8 @@ class OfflineImap: pass try: + # Honor CLI --account option, only. + # Accounts to sync are put into syncaccounts variable. activeaccounts = self.config.get("general", "accounts") if options.accounts: activeaccounts = options.accounts diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py index 0334237..5b70966 100644 --- a/offlineimap/repository/IMAP.py +++ b/offlineimap/repository/IMAP.py @@ -301,6 +301,8 @@ class IMAPRepository(BaseRepository): return None def getfolder(self, foldername): + """Return instance of OfflineIMAP representative folder.""" + return self.getfoldertype()(self.imapserver, foldername, self) def getfoldertype(self): @@ -314,6 +316,8 @@ class IMAPRepository(BaseRepository): self.folders = None def getfolders(self): + """Return a list of instances of OfflineIMAP representative folder.""" + if self.folders != None: return self.folders retval = []