[RFC] cleanup import statements and conform to PEP-8

Nicolas Sebrecht nicolas.s-dev at laposte.net
Mon Mar 14 19:30:34 GMT 2011


I don't really like that kind of commit doing large cleanups over files.  Now, I
also feel OfflineIMAP needing cleanups. Here is one on import statements.

The version I'm running includes this cleanup and it look fine but I'd like your
opinion before merging.

-- >8 --
Subject: cleanup import statements and conform to PEP-8

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev at laposte.net>
---

 offlineimap/accounts.py               |    6 +++---
 offlineimap/folder/Base.py            |    1 -
 offlineimap/folder/LocalStatus.py     |    3 ++-
 offlineimap/folder/Maildir.py         |    6 ++++--
 offlineimap/folder/UIDMaps.py         |    4 +---
 offlineimap/imaplibutil.py            |    5 ++++-
 offlineimap/imapserver.py             |    4 +++-
 offlineimap/imaputil.py               |    4 +++-
 offlineimap/repository/Gmail.py       |    3 +--
 offlineimap/repository/LocalStatus.py |    3 ++-
 offlineimap/repository/Maildir.py     |    3 +--
 offlineimap/syncmaster.py             |    2 +-
 offlineimap/threadutil.py             |    4 +++-
 offlineimap/ui/Noninteractive.py      |    3 ++-
 offlineimap/ui/TTY.py                 |    2 +-
 15 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/offlineimap/accounts.py b/offlineimap/accounts.py
index 7ffdfc1..e806151 100644
--- a/offlineimap/accounts.py
+++ b/offlineimap/accounts.py
@@ -18,11 +18,11 @@
 from offlineimap import threadutil, mbnames, CustomConfig
 from offlineimap.repository import Repository
 from offlineimap.ui import getglobalui
-from offlineimap.threadutil import InstanceLimitedThread, ExitNotifyThread
+from offlineimap.threadutil import InstanceLimitedThread
 from subprocess import Popen, PIPE
-from threading import Event, Lock
+from threading import Lock
 import os
-from Queue import Queue, Empty
+from Queue import Queue
 import sys
 import traceback
 
diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py
index 4bc5aab..320f5b2 100644
--- a/offlineimap/folder/Base.py
+++ b/offlineimap/folder/Base.py
@@ -20,7 +20,6 @@ from offlineimap import threadutil
 from offlineimap.ui import getglobalui
 import os.path
 import re
-import sys
 import traceback
 
 class BaseFolder:
diff --git a/offlineimap/folder/LocalStatus.py b/offlineimap/folder/LocalStatus.py
index 50a0f55..623829a 100644
--- a/offlineimap/folder/LocalStatus.py
+++ b/offlineimap/folder/LocalStatus.py
@@ -17,7 +17,8 @@
 #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
 from Base import BaseFolder
-import os, threading
+import os
+import threading
 
 magicline = "OFFLINEIMAP LocalStatus CACHE DATA - DO NOT MODIFY - FORMAT 1"
 
diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py
index a01d071..083325a 100644
--- a/offlineimap/folder/Maildir.py
+++ b/offlineimap/folder/Maildir.py
@@ -16,9 +16,11 @@
 #    along with this program; if not, write to the Free Software
 #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
-import os.path, os, re, time, socket
+import socket
+import time
+import re
+import os
 from Base import BaseFolder
-from offlineimap import imaputil
 from threading import Lock
 
 try:
diff --git a/offlineimap/folder/UIDMaps.py b/offlineimap/folder/UIDMaps.py
index e7394b5..db4ab11 100644
--- a/offlineimap/folder/UIDMaps.py
+++ b/offlineimap/folder/UIDMaps.py
@@ -17,10 +17,8 @@
 #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
 from threading import *
-from offlineimap import threadutil
-from offlineimap.threadutil import InstanceLimitedThread
 from IMAP import IMAPFolder
-import os.path, re
+import os.path
 
 class MappingFolderMixIn:
     def _initmapping(self):
diff --git a/offlineimap/imaplibutil.py b/offlineimap/imaplibutil.py
index 3bd33ea..4273d62 100644
--- a/offlineimap/imaplibutil.py
+++ b/offlineimap/imaplibutil.py
@@ -15,7 +15,10 @@
 #    along with this program; if not, write to the Free Software
 #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
-import re, socket, time, subprocess
+import re
+import socket
+import time
+import subprocess
 from offlineimap.ui import getglobalui
 import threading
 from offlineimap.imaplib2 import *
diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py
index c2e2d50..471be68 100644
--- a/offlineimap/imapserver.py
+++ b/offlineimap/imapserver.py
@@ -20,7 +20,9 @@ from offlineimap import imaplib2 as imaplib
 from offlineimap import imaplibutil, imaputil, threadutil
 from offlineimap.ui import getglobalui
 from threading import *
-import thread, hmac, os, time, socket
+import thread
+import time
+import hmac
 import base64
 
 from StringIO import StringIO
diff --git a/offlineimap/imaputil.py b/offlineimap/imaputil.py
index c59f1f5..101f9a6 100644
--- a/offlineimap/imaputil.py
+++ b/offlineimap/imaputil.py
@@ -16,7 +16,9 @@
 #    along with this program; if not, write to the Free Software
 #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
-import re, string, types
+import re
+import string
+import types
 from offlineimap.ui import getglobalui
 quotere = re.compile('^("(?:[^"]|\\\\")*")')
 
diff --git a/offlineimap/repository/Gmail.py b/offlineimap/repository/Gmail.py
index a586460..97637b8 100644
--- a/offlineimap/repository/Gmail.py
+++ b/offlineimap/repository/Gmail.py
@@ -16,8 +16,7 @@
 #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
 from offlineimap.repository.IMAP import IMAPRepository
-from offlineimap import folder, imaputil
-from offlineimap.imapserver import IMAPServer
+from offlineimap import folder
 
 class GmailRepository(IMAPRepository):
     """Gmail IMAP repository.
diff --git a/offlineimap/repository/LocalStatus.py b/offlineimap/repository/LocalStatus.py
index 92e392d..a4e036b 100644
--- a/offlineimap/repository/LocalStatus.py
+++ b/offlineimap/repository/LocalStatus.py
@@ -19,7 +19,8 @@
 from Base import BaseRepository
 from offlineimap import folder
 import offlineimap.folder.LocalStatus
-import os, re
+import os
+import re
 
 class LocalStatusRepository(BaseRepository):
     def __init__(self, reposname, account):
diff --git a/offlineimap/repository/Maildir.py b/offlineimap/repository/Maildir.py
index 648440a..0af4d1f 100644
--- a/offlineimap/repository/Maildir.py
+++ b/offlineimap/repository/Maildir.py
@@ -17,9 +17,8 @@
 #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
 from Base import BaseRepository
-from offlineimap import folder, imaputil
+from offlineimap import folder
 from offlineimap.ui import getglobalui
-from mailbox import Maildir
 import os
 from stat import *
 
diff --git a/offlineimap/syncmaster.py b/offlineimap/syncmaster.py
index 5a0a2fb..d21cfac 100644
--- a/offlineimap/syncmaster.py
+++ b/offlineimap/syncmaster.py
@@ -16,7 +16,7 @@
 #    along with this program; if not, write to the Free Software
 #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
-from offlineimap.threadutil import threadlist, InstanceLimitedThread, ExitNotifyThread
+from offlineimap.threadutil import threadlist, InstanceLimitedThread
 from offlineimap.accounts import SyncableAccount, SigListener
 from threading import currentThread
 
diff --git a/offlineimap/threadutil.py b/offlineimap/threadutil.py
index f3451b8..8644322 100644
--- a/offlineimap/threadutil.py
+++ b/offlineimap/threadutil.py
@@ -18,7 +18,9 @@
 
 from threading import *
 from Queue import Queue, Empty
-import sys, traceback, thread, time
+import traceback
+import thread
+import sys
 from offlineimap.ui import getglobalui
 
 profiledir = None
diff --git a/offlineimap/ui/Noninteractive.py b/offlineimap/ui/Noninteractive.py
index 9cd5eca..33248dd 100644
--- a/offlineimap/ui/Noninteractive.py
+++ b/offlineimap/ui/Noninteractive.py
@@ -16,7 +16,8 @@
 #    along with this program; if not, write to the Free Software
 #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
-import sys, time
+import sys
+import time
 from UIBase import UIBase
 
 class Basic(UIBase):
diff --git a/offlineimap/ui/TTY.py b/offlineimap/ui/TTY.py
index d88de1b..61019c1 100644
--- a/offlineimap/ui/TTY.py
+++ b/offlineimap/ui/TTY.py
@@ -18,7 +18,7 @@
 
 from UIBase import UIBase
 from getpass import getpass
-import select, sys
+import sys
 from threading import *
 
 class TTYUI(UIBase):
-- 
1.7.4.1.408.gb6b16





More information about the OfflineIMAP-project mailing list