From 666aab1a3fcd5f33659f67540d23b96fa8fa2f98 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 10 Feb 2021 14:10:42 +0100 Subject: Cosmetics, clean up imports --- alot/account.py | 3 ++- alot/addressbook/__init__.py | 4 ++-- alot/addressbook/abook.py | 6 ++++-- alot/buffers/bufferlist.py | 8 ++++---- alot/buffers/envelope.py | 12 +++++++----- alot/buffers/namedqueries.py | 5 +++-- alot/buffers/search.py | 6 +++--- alot/buffers/taglist.py | 7 ++++--- alot/buffers/thread.py | 10 +++++----- alot/commands/__init__.py | 6 +++--- alot/commands/bufferlist.py | 3 ++- alot/commands/common.py | 8 +++----- alot/commands/envelope.py | 27 +++++++++++++------------- alot/commands/globals.py | 43 +++++++++++++++++++++--------------------- alot/commands/namedqueries.py | 5 +++-- alot/commands/search.py | 15 ++++++++------- alot/commands/taglist.py | 5 +++-- alot/commands/thread.py | 44 ++++++++++++++++++++++--------------------- alot/commands/utils.py | 11 ++++++----- alot/settings/const.py | 1 + alot/settings/manager.py | 25 ++++++++++++------------ alot/settings/theme.py | 6 ++++-- alot/settings/utils.py | 9 +++++---- alot/widgets/search.py | 9 +++++---- 24 files changed, 148 insertions(+), 130 deletions(-) diff --git a/alot/account.py b/alot/account.py index 87c71390..bf05bbfc 100644 --- a/alot/account.py +++ b/alot/account.py @@ -3,9 +3,10 @@ # Copyright © 2017 Dylan Baker # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file + import abc import asyncio -from email import policy +from email import policy import glob import logging import mailbox diff --git a/alot/addressbook/__init__.py b/alot/addressbook/__init__.py index 4e733efd..834142d6 100644 --- a/alot/addressbook/__init__.py +++ b/alot/addressbook/__init__.py @@ -1,9 +1,9 @@ # Copyright (C) 2011-2015 Patrick Totzke # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file -import re -import abc +import abc +import re class AddressbookError(Exception): pass diff --git a/alot/addressbook/abook.py b/alot/addressbook/abook.py index 705a646d..02bd62af 100644 --- a/alot/addressbook/abook.py +++ b/alot/addressbook/abook.py @@ -1,9 +1,11 @@ # Copyright (C) 2011-2015 Patrick Totzke # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file + import os -from . import AddressBook -from ..settings.utils import read_config + +from . import AddressBook +from ..settings.utils import read_config class AbookAddressBook(AddressBook): diff --git a/alot/buffers/bufferlist.py b/alot/buffers/bufferlist.py index 185b4660..b1dfaded 100644 --- a/alot/buffers/bufferlist.py +++ b/alot/buffers/bufferlist.py @@ -1,12 +1,12 @@ # Copyright (C) 2011-2018 Patrick Totzke # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file -import urwid -from .buffer import Buffer -from ..widgets.bufferlist import BufferlineWidget -from ..settings.const import settings +import urwid +from .buffer import Buffer +from ..settings.const import settings +from ..widgets.bufferlist import BufferlineWidget class BufferlistBuffer(Buffer): """lists all active buffers""" diff --git a/alot/buffers/envelope.py b/alot/buffers/envelope.py index ae13d74f..0bc7696f 100644 --- a/alot/buffers/envelope.py +++ b/alot/buffers/envelope.py @@ -1,13 +1,15 @@ # Copyright (C) 2011-2018 Patrick Totzke # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file -import urwid + import os -from .buffer import Buffer -from ..settings.const import settings -from ..widgets.globals import AttachmentWidget -from ..helper import shorten_author_string +import urwid + +from .buffer import Buffer +from ..helper import shorten_author_string +from ..settings.const import settings +from ..widgets.globals import AttachmentWidget def string_sanitize(string, tab_width=8): r""" diff --git a/alot/buffers/namedqueries.py b/alot/buffers/namedqueries.py index 6a76e107..1695ff52 100644 --- a/alot/buffers/namedqueries.py +++ b/alot/buffers/namedqueries.py @@ -1,10 +1,11 @@ # Copyright (C) 2011-2018 Patrick Totzke # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file + import urwid -from .buffer import Buffer -from ..settings.const import settings +from .buffer import Buffer +from ..settings.const import settings from ..widgets.namedqueries import QuerylineWidget diff --git a/alot/buffers/search.py b/alot/buffers/search.py index a17e6db3..3adce6ed 100644 --- a/alot/buffers/search.py +++ b/alot/buffers/search.py @@ -7,11 +7,11 @@ from functools import partial import urwid -from .buffer import Buffer +from .buffer import Buffer from ..db.errors import QueryError from ..db.sort import NAME as SORT_NAME -from ..settings.const import settings -from ..widgets.search import ThreadlineWidget +from ..settings.const import settings +from ..widgets.search import ThreadlineWidget class IterWalker(urwid.ListWalker): """ diff --git a/alot/buffers/taglist.py b/alot/buffers/taglist.py index e8c8df33..fceedd18 100644 --- a/alot/buffers/taglist.py +++ b/alot/buffers/taglist.py @@ -1,11 +1,12 @@ # Copyright (C) 2011-2018 Patrick Totzke # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file + import urwid -from .buffer import Buffer -from ..settings.const import settings -from ..widgets.globals import TagWidget +from .buffer import Buffer +from ..settings.const import settings +from ..widgets.globals import TagWidget class TagListBuffer(Buffer): diff --git a/alot/buffers/thread.py b/alot/buffers/thread.py index 30d313af..d342db86 100644 --- a/alot/buffers/thread.py +++ b/alot/buffers/thread.py @@ -6,13 +6,13 @@ import asyncio import enum import logging + import urwid -from .buffer import Buffer -from ..settings.const import settings -from ..widgets.thread import MessageWidget, ThreadNode -from .. import commands -from ..db.errors import NonexistantObjectError +from .buffer import Buffer +from ..settings.const import settings +from ..widgets.thread import MessageWidget, ThreadNode +from ..db.errors import NonexistantObjectError class _ThreadBufFocus(enum.Enum): TREE = enum.auto() diff --git a/alot/commands/__init__.py b/alot/commands/__init__.py index 61ff7f21..e30769bb 100644 --- a/alot/commands/__init__.py +++ b/alot/commands/__init__.py @@ -1,15 +1,15 @@ # Copyright (C) 2011-2012 Patrick Totzke # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file + import argparse import glob import logging import os import re -from ..settings.const import settings -from ..helper import split_commandstring - +from ..settings.const import settings +from ..helper import split_commandstring class Command: diff --git a/alot/commands/bufferlist.py b/alot/commands/bufferlist.py index d58fab91..3850e4e3 100644 --- a/alot/commands/bufferlist.py +++ b/alot/commands/bufferlist.py @@ -2,8 +2,9 @@ # Copyright © 2018 Dylan Baker # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file + +from . import globals from ..commands import Command, registerCommand -from . import globals MODE = 'bufferlist' diff --git a/alot/commands/common.py b/alot/commands/common.py index 4914933c..6ccc04a4 100644 --- a/alot/commands/common.py +++ b/alot/commands/common.py @@ -3,11 +3,9 @@ # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file -from . import Command - -from .globals import PromptCommand - -from ..settings.const import settings +from . import Command +from .globals import PromptCommand +from ..settings.const import settings class RetagPromptCommand(Command): diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index 4b5a1fcc..52232a3c 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -2,6 +2,7 @@ # Copyright © 2018 Dylan Baker # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file + import argparse import datetime import email @@ -13,19 +14,19 @@ import tempfile import textwrap import traceback -from . import Command, registerCommand -from . import globals -from . import utils -from .. import buffers -from .. import commands -from .. import crypto -from ..account import SendingMailFailed, StoreMailError -from ..db.errors import DatabaseError -from ..errors import GPGProblem -from ..settings.const import settings -from ..settings.errors import NoMatchingAccount -from ..utils import argparse as cargparse -from ..utils.collections import OrderedSet +from . import Command, registerCommand +from . import globals +from . import utils +from .. import buffers +from .. import commands +from .. import crypto +from ..account import SendingMailFailed, StoreMailError +from ..db.errors import DatabaseError +from ..errors import GPGProblem +from ..settings.const import settings +from ..settings.errors import NoMatchingAccount +from ..utils import argparse as cargparse +from ..utils.collections import OrderedSet MODE = 'envelope' diff --git a/alot/commands/globals.py b/alot/commands/globals.py index 5304b32d..76ecc1f4 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -2,38 +2,39 @@ # Copyright © 2018 Dylan Baker # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file + import argparse +import asyncio import code import email import email.utils import glob +from io import BytesIO import logging import os -import subprocess -from io import BytesIO -import asyncio import shlex +import subprocess import urwid -from . import Command, registerCommand -from . import CommandCanceled -from .utils import update_keys -from .. import commands - -from .. import buffers -from .. import helper -from ..helper import split_commandstring -from ..completion.commandline import CommandLineCompleter -from ..completion.contacts import ContactsCompleter -from ..completion.accounts import AccountCompleter -from ..completion.tags import TagsCompleter -from ..db.sort import NAME as SORT_NAME -from ..widgets.utils import DialogBox -from ..mail.envelope import Envelope -from ..settings.const import settings -from ..settings.errors import ConfigError, NoMatchingAccount -from ..utils import argparse as cargparse +from . import Command, registerCommand +from . import CommandCanceled +from .utils import update_keys +from .. import commands + +from .. import buffers +from .. import helper +from ..completion.accounts import AccountCompleter +from ..completion.commandline import CommandLineCompleter +from ..completion.contacts import ContactsCompleter +from ..completion.tags import TagsCompleter +from ..db.sort import NAME as SORT_NAME +from ..helper import split_commandstring +from ..mail.envelope import Envelope +from ..settings.const import settings +from ..settings.errors import ConfigError, NoMatchingAccount +from ..utils import argparse as cargparse +from ..widgets.utils import DialogBox MODE = 'global' diff --git a/alot/commands/namedqueries.py b/alot/commands/namedqueries.py index e2bc301b..59a644ee 100644 --- a/alot/commands/namedqueries.py +++ b/alot/commands/namedqueries.py @@ -1,10 +1,11 @@ # Copyright (C) 2011-2018 Patrick Totzke # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file + import argparse -from . import Command, registerCommand -from .globals import SearchCommand +from . import Command, registerCommand +from .globals import SearchCommand MODE = 'namedqueries' diff --git a/alot/commands/search.py b/alot/commands/search.py index 79aaee56..9cf0713c 100644 --- a/alot/commands/search.py +++ b/alot/commands/search.py @@ -2,17 +2,18 @@ # Copyright © 2018 Dylan Baker # 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 -from . import Command, registerCommand -from .globals import PromptCommand -from .globals import MoveCommand -from .common import RetagPromptCommand -from .. import commands +from . import Command, registerCommand +from .globals import PromptCommand +from .globals import MoveCommand +from .common import RetagPromptCommand -from .. import buffers -from ..db.errors import DatabaseROError +from .. import buffers +from .. import commands +from ..db.errors import DatabaseROError from ..db.sort import NAME as SORT_NAME diff --git a/alot/commands/taglist.py b/alot/commands/taglist.py index f5e8af73..1df74d90 100644 --- a/alot/commands/taglist.py +++ b/alot/commands/taglist.py @@ -2,8 +2,9 @@ # Copyright © 2018 Dylan Baker # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file -from . import Command, registerCommand -from .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 0ff38b55..79e63167 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -2,39 +2,41 @@ # Copyright © 2018 Dylan Baker # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file + import argparse import asyncio +import email +import email.policy +from email.utils import getaddresses, parseaddr +from email.message import Message import logging import mailcap import os import subprocess import tempfile -import email -import email.policy -from email.utils import getaddresses, parseaddr -from email.message import Message import urwid -from urwid.util import detected_encoding +from urwid.util import detected_encoding from io import BytesIO -from . import Command, registerCommand -from .globals import ComposeCommand -from .globals import MoveCommand -from .globals import CommandCanceled -from .common import RetagPromptCommand -from .envelope import SendCommand -from ..completion.contacts import ContactsCompleter -from ..completion.path import PathCompleter -from ..mail.attachment import Attachment -from ..mail.envelope import Envelope -from ..db.errors import DatabaseROError -from ..settings.const import settings -from ..helper import formataddr -from ..helper import split_commandstring -from ..utils import argparse as cargparse -from ..utils.mailcap import MailcapHandler +from . import Command, registerCommand +from .common import RetagPromptCommand +from .envelope import SendCommand +from .globals import ComposeCommand +from .globals import MoveCommand +from .globals import CommandCanceled + +from ..completion.contacts import ContactsCompleter +from ..completion.path import PathCompleter +from ..db.errors import DatabaseROError +from ..helper import formataddr +from ..helper import split_commandstring +from ..mail.attachment import Attachment +from ..mail.envelope import Envelope +from ..settings.const import settings +from ..utils import argparse as cargparse +from ..utils.mailcap import MailcapHandler MODE = 'thread' diff --git a/alot/commands/utils.py b/alot/commands/utils.py index 57c52d35..8f76d756 100644 --- a/alot/commands/utils.py +++ b/alot/commands/utils.py @@ -1,13 +1,14 @@ # Copyright (C) 2015 Patrick Totzke # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file -import re + import logging +import re -from ..errors import GPGProblem, GPGCode -from ..settings.const import settings -from ..settings.errors import NoMatchingAccount -from .. import crypto +from .. import crypto +from ..errors import GPGProblem, GPGCode +from ..settings.const import settings +from ..settings.errors import NoMatchingAccount async def update_keys(ui, envelope, block_error=False, signed_only=False): diff --git a/alot/settings/const.py b/alot/settings/const.py index b1449c29..d7355dfe 100644 --- a/alot/settings/const.py +++ b/alot/settings/const.py @@ -1,6 +1,7 @@ # Copyright (C) 2011-2012 Patrick Totzke # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file + from .manager import SettingsManager settings = SettingsManager() diff --git a/alot/settings/manager.py b/alot/settings/manager.py index badda2af..1be5a0cc 100644 --- a/alot/settings/manager.py +++ b/alot/settings/manager.py @@ -2,28 +2,27 @@ # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file -from datetime import datetime, timedelta - +from datetime import datetime, timedelta +import email import importlib.util import itertools import logging import mailcap import os import re -import email -from configobj import ConfigObj, Section -from ..account import SendmailAccount -from ..addressbook.abook import AbookAddressBook -from ..addressbook.external import ExternalAddressbook -from ..helper import get_xdg_env -from ..utils import configobj as checks +from configobj import ConfigObj, Section -from .errors import ConfigError, NoMatchingAccount -from .utils import read_config -from .utils import resolve_att -from .theme import Theme +from .errors import ConfigError, NoMatchingAccount +from .utils import read_config +from .utils import resolve_att +from .theme import Theme +from ..account import SendmailAccount +from ..addressbook.abook import AbookAddressBook +from ..addressbook.external import ExternalAddressbook +from ..helper import get_xdg_env +from ..utils import configobj as checks DEFAULTSPATH = os.path.join(os.path.dirname(__file__), '..', 'defaults') DATA_DIRS = get_xdg_env('XDG_DATA_DIRS', diff --git a/alot/settings/theme.py b/alot/settings/theme.py index df34cba9..0eda72f2 100644 --- a/alot/settings/theme.py +++ b/alot/settings/theme.py @@ -1,11 +1,13 @@ # Copyright (C) 2011-2012 Patrick Totzke # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file + import os -from ..utils import configobj as checks -from .utils import read_config from .errors import ConfigError +from .utils import read_config + +from ..utils import configobj as checks DEFAULTSPATH = os.path.join(os.path.dirname(__file__), '..', 'defaults') DUMMYDEFAULT = ('default',) * 6 diff --git a/alot/settings/utils.py b/alot/settings/utils.py index 65942aff..e830fafc 100644 --- a/alot/settings/utils.py +++ b/alot/settings/utils.py @@ -1,12 +1,13 @@ # Copyright (C) 2011-2012 Patrick Totzke # This file is released under the GNU GPL, version 3 or a later revision. # For further details see the COPYING file + import logging -from configobj import (ConfigObj, ConfigObjError, flatten_errors, - get_extra_values) -from validate import Validator -from urwid import AttrSpec +from configobj import (ConfigObj, ConfigObjError, flatten_errors, + get_extra_values) +from urwid import AttrSpec +from validate import Validator from .errors import ConfigError diff --git a/alot/widgets/search.py b/alot/widgets/search.py index a921146a..12cf84e8 100644 --- a/alot/widgets/search.py +++ b/alot/widgets/search.py @@ -4,13 +4,14 @@ """ Widgets specific to search mode """ + import urwid -from ..settings.const import settings -from ..helper import shorten_author_string -from .utils import AttrFlipWidget -from .globals import TagWidget +from .utils import AttrFlipWidget +from .globals import TagWidget +from ..helper import shorten_author_string +from ..settings.const import settings class ThreadlineWidget(urwid.WidgetPlaceholder): """ -- cgit v1.2.3