diff options
author | Lucas Hoffmann <l-m-h@web.de> | 2016-07-14 14:18:48 +0200 |
---|---|---|
committer | Lucas Hoffmann <l-m-h@web.de> | 2016-12-09 11:26:19 +0100 |
commit | fe748a7f47fb61d46dd88c270c2329e6ff19a895 (patch) | |
tree | 66bb5dc3145ef621db21e6505d91591e6b414d0f /alot/commands | |
parent | d89bbe11537abfceb3d0c7b62b9325fceaf51e32 (diff) |
Clean up imports
- use relative imports if possible
- group imports into standard library, third party, and alot modules
- sort imports alphabetically
Diffstat (limited to 'alot/commands')
-rw-r--r-- | alot/commands/__init__.py | 13 | ||||
-rw-r--r-- | alot/commands/bufferlist.py | 2 | ||||
-rw-r--r-- | alot/commands/envelope.py | 35 | ||||
-rw-r--r-- | alot/commands/globals.py | 50 | ||||
-rw-r--r-- | alot/commands/search.py | 12 | ||||
-rw-r--r-- | alot/commands/taglist.py | 4 | ||||
-rw-r--r-- | alot/commands/thread.py | 57 | ||||
-rw-r--r-- | alot/commands/utils.py | 4 |
8 files changed, 89 insertions, 88 deletions
diff --git a/alot/commands/__init__.py b/alot/commands/__init__.py index d19508ab..7fa83a07 100644 --- a/alot/commands/__init__.py +++ b/alot/commands/__init__.py @@ -1,15 +1,14 @@ # Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com> # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file -import os -import re +import argparse import glob import logging -import argparse +import os +import re -from alot.settings import settings -import alot.helper -from alot.helper import split_commandstring +from ..settings import settings +from ..helper import split_commandstring, string_decode class Command(object): @@ -177,7 +176,7 @@ def commandfactory(cmdline, mode='global'): args = split_commandstring(cmdline) except ValueError as e: raise CommandParseError(e.message) - args = map(lambda x: alot.helper.string_decode(x, 'utf-8'), args) + args = map(lambda x: string_decode(x, 'utf-8'), args) logging.debug('ARGS: %s', args) cmdname = args[0] args = args[1:] diff --git a/alot/commands/bufferlist.py b/alot/commands/bufferlist.py index ef58c6fc..e78663ec 100644 --- a/alot/commands/bufferlist.py +++ b/alot/commands/bufferlist.py @@ -1,7 +1,7 @@ # Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com> # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file -from alot.commands import Command, registerCommand +from ..commands import Command, registerCommand from . import globals MODE = 'bufferlist' diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index 712c2c76..64d5edea 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -2,28 +2,29 @@ # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file import argparse -import os -import re +import datetime +import email import glob import logging -import email +import os +import re import tempfile + from twisted.internet.defer import inlineCallbacks -import datetime -from alot.account import SendingMailFailed, StoreMailError -from alot.errors import GPGProblem -from alot import buffers -from alot import commands -from alot import crypto -from alot.commands import Command, registerCommand -from alot.commands import globals -from alot.commands.utils import get_keys -from alot.helper import string_decode -from alot.helper import email_as_string -from alot.settings import settings -from alot.utils.booleanaction import BooleanAction -from alot.db.errors import DatabaseError +from . import Command, registerCommand +from . import globals +from .utils import get_keys +from .. import buffers +from .. import commands +from .. import crypto +from ..account import SendingMailFailed, StoreMailError +from ..db.errors import DatabaseError +from ..errors import GPGProblem +from ..helper import email_as_string +from ..helper import string_decode +from ..settings import settings +from ..utils.booleanaction import BooleanAction MODE = 'envelope' diff --git a/alot/commands/globals.py b/alot/commands/globals.py index 6e4ac673..49906513 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -1,36 +1,38 @@ # Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com> # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file +import argparse +import code +import email +import glob +import logging import os import re -import code -from twisted.internet import threads import subprocess -import email +from StringIO import StringIO + import urwid from twisted.internet.defer import inlineCallbacks -import logging -import argparse -import glob -from StringIO import StringIO +from twisted.internet import threads -from alot.commands import Command, registerCommand -from alot.completion import CommandLineCompleter -from alot.commands import CommandCanceled -from alot.commands.utils import get_keys -from alot import buffers -from alot.widgets.utils import DialogBox -from alot import helper -from alot.db.errors import DatabaseLockedError -from alot.completion import ContactsCompleter -from alot.completion import AccountCompleter -from alot.completion import TagsCompleter -from alot.db.envelope import Envelope -from alot import commands -from alot.settings import settings -from alot.helper import split_commandstring -from alot.helper import mailto_to_envelope -from alot.utils.booleanaction import BooleanAction +from . import Command, registerCommand +from . import CommandCanceled +from .utils import get_keys +from .. import commands + +from .. import buffers +from .. import helper +from ..helper import split_commandstring +from ..helper import mailto_to_envelope +from ..completion import CommandLineCompleter +from ..completion import ContactsCompleter +from ..completion import AccountCompleter +from ..completion import TagsCompleter +from ..widgets.utils import DialogBox +from ..db.errors import DatabaseLockedError +from ..db.envelope import Envelope +from ..settings import settings +from ..utils.booleanaction import BooleanAction MODE = 'global' diff --git a/alot/commands/search.py b/alot/commands/search.py index 7a2184ae..b79ce831 100644 --- a/alot/commands/search.py +++ b/alot/commands/search.py @@ -4,13 +4,13 @@ import argparse import logging -from alot.commands import Command, registerCommand -from alot.commands.globals import PromptCommand -from alot.commands.globals import MoveCommand +from . import Command, registerCommand +from .globals import PromptCommand +from .globals import MoveCommand +from .. import commands -from alot.db.errors import DatabaseROError -from alot import commands -from alot import buffers +from .. import buffers +from ..db.errors import DatabaseROError MODE = 'search' diff --git a/alot/commands/taglist.py b/alot/commands/taglist.py index 6e588435..1fa01369 100644 --- a/alot/commands/taglist.py +++ b/alot/commands/taglist.py @@ -1,8 +1,8 @@ # Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com> # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file -from alot.commands import Command, registerCommand -from alot.commands.globals import SearchCommand +from . import Command, registerCommand +from .globals import SearchCommand MODE = 'taglist' diff --git a/alot/commands/thread.py b/alot/commands/thread.py index f5c6141d..306f2619 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -1,41 +1,40 @@ # Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com> # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file +import argparse +import logging +import mailcap import os import re -import logging -import tempfile -import argparse -from twisted.internet.defer import inlineCallbacks import subprocess +import tempfile from email.Utils import getaddresses, parseaddr from email.message import Message -import mailcap + +from twisted.internet.defer import inlineCallbacks from cStringIO import StringIO -from alot.commands import Command, registerCommand -from alot.commands.globals import ExternalCommand -from alot.commands.globals import FlushCommand -from alot.commands.globals import ComposeCommand -from alot.commands.globals import MoveCommand -from alot.commands.globals import CommandCanceled -from alot.commands.envelope import SendCommand -from alot import completion -from alot.db.utils import decode_header -from alot.db.utils import encode_header -from alot.db.utils import extract_headers -from alot.db.utils import extract_body -from alot.db.envelope import Envelope -from alot.db.attachment import Attachment -from alot.db.errors import DatabaseROError -from alot.settings import settings -from alot.helper import parse_mailcap_nametemplate -from alot.helper import split_commandstring -from alot.helper import email_as_string -from alot.utils.booleanaction import BooleanAction -from alot.completion import ContactsCompleter - -from alot.widgets.globals import AttachmentWidget +from . import Command, registerCommand +from .globals import ExternalCommand +from .globals import FlushCommand +from .globals import ComposeCommand +from .globals import MoveCommand +from .globals import CommandCanceled +from .envelope import SendCommand +from ..completion import ContactsCompleter, PathCompleter +from ..db.utils import decode_header +from ..db.utils import encode_header +from ..db.utils import extract_headers +from ..db.utils import extract_body +from ..db.envelope import Envelope +from ..db.attachment import Attachment +from ..db.errors import DatabaseROError +from ..settings import settings +from ..helper import parse_mailcap_nametemplate +from ..helper import split_commandstring +from ..helper import email_as_string +from ..utils.booleanaction import BooleanAction +from ..widgets.globals import AttachmentWidget MODE = 'thread' @@ -862,7 +861,7 @@ class SaveAttachmentCommand(Command): @inlineCallbacks def apply(self, ui): - pcomplete = completion.PathCompleter() + pcomplete = PathCompleter() savedir = settings.get('attachment_prefix', '~') if self.all: msg = ui.current_buffer.get_selected_message() diff --git a/alot/commands/utils.py b/alot/commands/utils.py index 48d7aac9..153c5028 100644 --- a/alot/commands/utils.py +++ b/alot/commands/utils.py @@ -3,8 +3,8 @@ # For further details see the COPYING file from twisted.internet.defer import inlineCallbacks, returnValue -from alot.errors import GPGProblem, GPGCode -from alot import crypto +from ..errors import GPGProblem, GPGCode +from .. import crypto @inlineCallbacks |