From ab86e7991886c3d3253af59349403c5973fe476c Mon Sep 17 00:00:00 2001 From: mathieui Date: Thu, 30 Jun 2016 22:56:24 +0200 Subject: Use absolute imports instead of relative ones All this crap is very brittle due to circular deps and python handling them badly. This appears to be fixing some stuff, at the very least. This is sed, so cleanup of imports (which can now be grouped together) is not done yet. --- poezio/core/commands.py | 24 +++++++++---------- poezio/core/completions.py | 12 +++++----- poezio/core/core.py | 46 ++++++++++++++++++------------------ poezio/core/handlers.py | 28 +++++++++++----------- poezio/tabs/basetabs.py | 24 +++++++++---------- poezio/tabs/bookmarkstab.py | 8 +++---- poezio/tabs/conversationtab.py | 20 ++++++++-------- poezio/tabs/data_forms.py | 4 ++-- poezio/tabs/listtab.py | 6 ++--- poezio/tabs/muctab.py | 26 ++++++++++---------- poezio/tabs/privatetab.py | 18 +++++++------- poezio/tabs/rostertab.py | 18 +++++++------- poezio/tabs/xmltab.py | 10 ++++---- poezio/theming.py | 2 +- poezio/windows/base_wins.py | 2 +- poezio/windows/bookmark_forms.py | 4 ++-- poezio/windows/data_forms.py | 2 +- poezio/windows/info_bar.py | 4 ++-- poezio/windows/info_wins.py | 6 ++--- poezio/windows/input_placeholders.py | 2 +- poezio/windows/inputs.py | 10 ++++---- poezio/windows/list.py | 2 +- poezio/windows/misc.py | 2 +- poezio/windows/muc.py | 6 ++--- poezio/windows/roster_win.py | 10 ++++---- poezio/windows/text_win.py | 6 ++--- 26 files changed, 151 insertions(+), 151 deletions(-) diff --git a/poezio/core/commands.py b/poezio/core/commands.py index 789528d5..7692d115 100644 --- a/poezio/core/commands.py +++ b/poezio/core/commands.py @@ -14,18 +14,18 @@ from slixmpp.xmlstream.stanzabase import StanzaBase from slixmpp.xmlstream.handler import Callback from slixmpp.xmlstream.matcher import StanzaPath -from .. import common -from .. import fixes -from .. import pep -from .. import tabs -from .. bookmarks import Bookmark -from .. common import safeJID -from .. config import config, DEFAULT_CONFIG, options as config_opts -from .. import multiuserchat as muc -from .. plugin import PluginConfig -from .. roster import roster -from .. theming import dump_tuple, get_theme -from .. decorators import command_args_parser +from poezio import common +from poezio import fixes +from poezio import pep +from poezio import tabs +from poezio.bookmarks import Bookmark +from poezio.common import safeJID +from poezio.config import config, DEFAULT_CONFIG, options as config_opts +from poezio import multiuserchat as muc +from poezio.plugin import PluginConfig +from poezio.roster import roster +from poezio.theming import dump_tuple, get_theme +from poezio.decorators import command_args_parser from . structs import Command, POSSIBLE_SHOW diff --git a/poezio/core/completions.py b/poezio/core/completions.py index 66f532d5..a1ac1801 100644 --- a/poezio/core/completions.py +++ b/poezio/core/completions.py @@ -8,12 +8,12 @@ log = logging.getLogger(__name__) import os from functools import reduce -from .. import common -from .. import pep -from .. import tabs -from .. common import safeJID -from .. config import config -from .. roster import roster +from poezio import common +from poezio import pep +from poezio import tabs +from poezio.common import safeJID +from poezio.config import config +from poezio.roster import roster from . structs import POSSIBLE_SHOW diff --git a/poezio/core/core.py b/poezio/core/core.py index b0bb33b2..589bd2c7 100644 --- a/poezio/core/core.py +++ b/poezio/core/core.py @@ -19,29 +19,29 @@ import time from slixmpp.xmlstream.handler import Callback -from .. import connection -from .. import decorators -from .. import events -from .. import multiuserchat as muc -from .. import tabs -from .. import theming -from .. import timed_events -from .. import windows - -from .. bookmarks import BookmarkList -from .. common import safeJID -from .. config import config, firstrun -from .. contact import Contact, Resource -from .. daemon import Executor -from .. fifo import Fifo -from .. logger import logger -from .. plugin_manager import PluginManager -from .. roster import roster -from .. singleton import Singleton -from .. size_manager import SizeManager -from .. text_buffer import TextBuffer -from .. theming import get_theme -from .. import keyboard +from poezio import connection +from poezio import decorators +from poezio import events +from poezio import multiuserchat as muc +from poezio import tabs +from poezio import theming +from poezio import timed_events +from poezio import windows + +from poezio.bookmarks import BookmarkList +from poezio.common import safeJID +from poezio.config import config, firstrun +from poezio.contact import Contact, Resource +from poezio.daemon import Executor +from poezio.fifo import Fifo +from poezio.logger import logger +from poezio.plugin_manager import PluginManager +from poezio.roster import roster +from poezio.singleton import Singleton +from poezio.size_manager import SizeManager +from poezio.text_buffer import TextBuffer +from poezio.theming import get_theme +from poezio import keyboard from . completions import CompletionCore from . commands import CommandCore diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py index 44736e1e..373b7b8c 100644 --- a/poezio/core/handlers.py +++ b/poezio/core/handlers.py @@ -19,20 +19,20 @@ from slixmpp import InvalidJID from slixmpp.xmlstream.stanzabase import StanzaBase, ElementBase from xml.etree import ElementTree as ET -from .. import common -from .. import fixes -from .. import pep -from .. import tabs -from .. import windows -from .. import xhtml -from .. import multiuserchat as muc -from .. common import safeJID -from .. config import config, CACHE_DIR -from .. contact import Resource -from .. logger import logger -from .. roster import roster -from .. text_buffer import CorrectionError, AckError -from .. theming import dump_tuple, get_theme +from poezio import common +from poezio import fixes +from poezio import pep +from poezio import tabs +from poezio import windows +from poezio import xhtml +from poezio import multiuserchat as muc +from poezio.common import safeJID +from poezio.config import config, CACHE_DIR +from poezio.contact import Resource +from poezio.logger import logger +from poezio.roster import roster +from poezio.text_buffer import CorrectionError, AckError +from poezio.theming import dump_tuple, get_theme from . commands import dumb_callback diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py index e287bc6d..9f1e09e7 100644 --- a/poezio/tabs/basetabs.py +++ b/poezio/tabs/basetabs.py @@ -22,18 +22,18 @@ import weakref from datetime import datetime, timedelta from xml.etree import cElementTree as ET -from .. import core -from .. import timed_events -from .. import windows -from .. import xhtml -from .. common import safeJID -from .. config import config -from .. decorators import refresh_wrapper -from .. logger import logger -from .. singleton import Singleton -from .. text_buffer import TextBuffer -from .. theming import get_theme, dump_tuple -from .. decorators import command_args_parser +from poezio import core +from poezio import timed_events +from poezio import windows +from poezio import xhtml +from poezio.common import safeJID +from poezio.config import config +from poezio.decorators import refresh_wrapper +from poezio.logger import logger +from poezio.singleton import Singleton +from poezio.text_buffer import TextBuffer +from poezio.theming import get_theme, dump_tuple +from poezio.decorators import command_args_parser # getters for tab colors (lambdas, so that they are dynamic) STATE_COLORS = { diff --git a/poezio/tabs/bookmarkstab.py b/poezio/tabs/bookmarkstab.py index 181a3794..2eb138b3 100644 --- a/poezio/tabs/bookmarkstab.py +++ b/poezio/tabs/bookmarkstab.py @@ -5,10 +5,10 @@ Defines the data-forms Tab import logging log = logging.getLogger(__name__) -from .. import windows -from .. bookmarks import Bookmark, BookmarkList, stanza_storage -from .. tabs import Tab -from .. common import safeJID +from poezio import windows +from poezio.bookmarks import Bookmark, BookmarkList, stanza_storage +from poezio.tabs import Tab +from poezio.common import safeJID class BookmarksTab(Tab): diff --git a/poezio/tabs/conversationtab.py b/poezio/tabs/conversationtab.py index 8bd50e6b..95c69827 100644 --- a/poezio/tabs/conversationtab.py +++ b/poezio/tabs/conversationtab.py @@ -18,16 +18,16 @@ import curses from . basetabs import OneToOneTab, Tab -from .. import common -from .. import fixes -from .. import windows -from .. import xhtml -from .. common import safeJID -from .. config import config -from .. decorators import refresh_wrapper -from .. roster import roster -from .. theming import get_theme, dump_tuple -from .. decorators import command_args_parser +from poezio import common +from poezio import fixes +from poezio import windows +from poezio import xhtml +from poezio.common import safeJID +from poezio.config import config +from poezio.decorators import refresh_wrapper +from poezio.roster import roster +from poezio.theming import get_theme, dump_tuple +from poezio.decorators import command_args_parser class ConversationTab(OneToOneTab): """ diff --git a/poezio/tabs/data_forms.py b/poezio/tabs/data_forms.py index 59994890..82c0f128 100644 --- a/poezio/tabs/data_forms.py +++ b/poezio/tabs/data_forms.py @@ -5,8 +5,8 @@ Defines the data-forms Tab import logging log = logging.getLogger(__name__) -from .. import windows -from .. tabs import Tab +from poezio import windows +from poezio.tabs import Tab class DataFormsTab(Tab): """ diff --git a/poezio/tabs/listtab.py b/poezio/tabs/listtab.py index 364b3d44..8461f440 100644 --- a/poezio/tabs/listtab.py +++ b/poezio/tabs/listtab.py @@ -10,9 +10,9 @@ log = logging.getLogger(__name__) import curses import collections -from .. import windows -from .. common import safeJID -from .. decorators import refresh_wrapper +from poezio import windows +from poezio.common import safeJID +from poezio.decorators import refresh_wrapper from . import Tab diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py index 8d6780ad..f56f4f62 100644 --- a/poezio/tabs/muctab.py +++ b/poezio/tabs/muctab.py @@ -19,19 +19,19 @@ from datetime import datetime from . import ChatTab, Tab -from .. import common -from .. import fixes -from .. import multiuserchat as muc -from .. import timed_events -from .. import windows -from .. import xhtml -from .. common import safeJID -from .. config import config -from .. decorators import refresh_wrapper, command_args_parser -from .. logger import logger -from .. roster import roster -from .. theming import get_theme, dump_tuple -from .. user import User +from poezio import common +from poezio import fixes +from poezio import multiuserchat as muc +from poezio import timed_events +from poezio import windows +from poezio import xhtml +from poezio.common import safeJID +from poezio.config import config +from poezio.decorators import refresh_wrapper, command_args_parser +from poezio.logger import logger +from poezio.roster import roster +from poezio.theming import get_theme, dump_tuple +from poezio.user import User SHOW_NAME = { diff --git a/poezio/tabs/privatetab.py b/poezio/tabs/privatetab.py index 5013e30d..ec443888 100644 --- a/poezio/tabs/privatetab.py +++ b/poezio/tabs/privatetab.py @@ -17,15 +17,15 @@ import curses from . import OneToOneTab, MucTab, Tab -from .. import fixes -from .. import windows -from .. import xhtml -from .. common import safeJID -from .. config import config -from .. decorators import refresh_wrapper -from .. logger import logger -from .. theming import get_theme, dump_tuple -from .. decorators import command_args_parser +from poezio import fixes +from poezio import windows +from poezio import xhtml +from poezio.common import safeJID +from poezio.config import config +from poezio.decorators import refresh_wrapper +from poezio.logger import logger +from poezio.theming import get_theme, dump_tuple +from poezio.decorators import command_args_parser class PrivateTab(OneToOneTab): """ diff --git a/poezio/tabs/rostertab.py b/poezio/tabs/rostertab.py index 6fa737a2..f4681c5b 100644 --- a/poezio/tabs/rostertab.py +++ b/poezio/tabs/rostertab.py @@ -18,15 +18,15 @@ from functools import partial from . import Tab -from .. import common -from .. import windows -from .. common import safeJID -from .. config import config -from .. contact import Contact, Resource -from .. decorators import refresh_wrapper -from .. roster import RosterGroup, roster -from .. theming import get_theme, dump_tuple -from .. decorators import command_args_parser +from poezio import common +from poezio import windows +from poezio.common import safeJID +from poezio.config import config +from poezio.contact import Contact, Resource +from poezio.decorators import refresh_wrapper +from poezio.roster import RosterGroup, roster +from poezio.theming import get_theme, dump_tuple +from poezio.decorators import command_args_parser class RosterInfoTab(Tab): """ diff --git a/poezio/tabs/xmltab.py b/poezio/tabs/xmltab.py index 29e2f2a7..8a866d2a 100644 --- a/poezio/tabs/xmltab.py +++ b/poezio/tabs/xmltab.py @@ -17,11 +17,11 @@ from xml.etree import ElementTree as ET from . import Tab -from .. import text_buffer -from .. import windows -from .. xhtml import clean_text -from .. decorators import command_args_parser, refresh_wrapper -from .. common import safeJID +from poezio import text_buffer +from poezio import windows +from poezio.xhtml import clean_text +from poezio.decorators import command_args_parser, refresh_wrapper +from poezio.common import safeJID class MatchJID(object): diff --git a/poezio/theming.py b/poezio/theming.py index 6d7eb477..5b2546d7 100755 --- a/poezio/theming.py +++ b/poezio/theming.py @@ -66,7 +66,7 @@ It is used for example to define color gradient, etc. import logging log = logging.getLogger(__name__) -from . config import config +from poezio.config import config import curses import os diff --git a/poezio/windows/base_wins.py b/poezio/windows/base_wins.py index f1f9b84b..a5629ed5 100644 --- a/poezio/windows/base_wins.py +++ b/poezio/windows/base_wins.py @@ -13,7 +13,7 @@ log = logging.getLogger(__name__) import curses import string -from .. theming import to_curses_attr, read_tuple +from poezio.theming import to_curses_attr, read_tuple FORMAT_CHAR = '\x19' # These are non-printable chars, so they should never appear in the input, diff --git a/poezio/windows/bookmark_forms.py b/poezio/windows/bookmark_forms.py index f7d72f78..bef4b247 100644 --- a/poezio/windows/bookmark_forms.py +++ b/poezio/windows/bookmark_forms.py @@ -6,8 +6,8 @@ import curses from . import Win from . inputs import Input from . data_forms import FieldInput -from .. theming import to_curses_attr, get_theme -from .. common import safeJID +from poezio.theming import to_curses_attr, get_theme +from poezio.common import safeJID class BookmarkJIDInput(FieldInput, Input): def __init__(self, field): diff --git a/poezio/windows/data_forms.py b/poezio/windows/data_forms.py index c02296e5..5b70cedc 100644 --- a/poezio/windows/data_forms.py +++ b/poezio/windows/data_forms.py @@ -9,7 +9,7 @@ others when needed. from . import Win from . inputs import Input -from .. theming import to_curses_attr, get_theme +from poezio.theming import to_curses_attr, get_theme class FieldInput(object): """ diff --git a/poezio/windows/info_bar.py b/poezio/windows/info_bar.py index be9f1f0c..dbaabdc0 100644 --- a/poezio/windows/info_bar.py +++ b/poezio/windows/info_bar.py @@ -11,9 +11,9 @@ log = logging.getLogger(__name__) import curses -from .. config import config +from poezio.config import config from . import Win -from .. theming import get_theme, to_curses_attr +from poezio.theming import get_theme, to_curses_attr class GlobalInfoBar(Win): def __init__(self, core): diff --git a/poezio/windows/info_wins.py b/poezio/windows/info_wins.py index 327f9b2b..6a8c9d64 100644 --- a/poezio/windows/info_wins.py +++ b/poezio/windows/info_wins.py @@ -6,12 +6,12 @@ info buffer in normal tabs import logging log = logging.getLogger(__name__) -from .. common import safeJID -from .. config import config +from poezio.common import safeJID +from poezio.config import config from . import Win from . funcs import truncate_nick -from .. theming import get_theme, to_curses_attr +from poezio.theming import get_theme, to_curses_attr class InfoWin(Win): """ diff --git a/poezio/windows/input_placeholders.py b/poezio/windows/input_placeholders.py index 92be4ffa..698cee09 100644 --- a/poezio/windows/input_placeholders.py +++ b/poezio/windows/input_placeholders.py @@ -8,7 +8,7 @@ log = logging.getLogger(__name__) from . import Win -from .. theming import get_theme, to_curses_attr +from poezio.theming import get_theme, to_curses_attr class HelpText(Win): diff --git a/poezio/windows/inputs.py b/poezio/windows/inputs.py index c204b503..da7b53d9 100644 --- a/poezio/windows/inputs.py +++ b/poezio/windows/inputs.py @@ -8,14 +8,14 @@ log = logging.getLogger(__name__) import curses import string -from .. import keyboard -from .. import common -from .. import poopt +from poezio import keyboard +from poezio import common +from poezio import poopt from . import Win from . base_wins import format_chars from . funcs import find_first_format_char -from .. config import config -from .. theming import to_curses_attr +from poezio.config import config +from poezio.theming import to_curses_attr class Input(Win): diff --git a/poezio/windows/list.py b/poezio/windows/list.py index d4458b5b..8e879c85 100644 --- a/poezio/windows/list.py +++ b/poezio/windows/list.py @@ -8,7 +8,7 @@ log = logging.getLogger(__name__) import curses from . import Win -from .. theming import to_curses_attr, get_theme +from poezio.theming import to_curses_attr, get_theme class ListWin(Win): diff --git a/poezio/windows/misc.py b/poezio/windows/misc.py index bc77fefd..230c06ad 100644 --- a/poezio/windows/misc.py +++ b/poezio/windows/misc.py @@ -8,7 +8,7 @@ log = logging.getLogger(__name__) import curses from . import Win -from .. theming import get_theme, to_curses_attr +from poezio.theming import get_theme, to_curses_attr class VerticalSeparator(Win): """ diff --git a/poezio/windows/muc.py b/poezio/windows/muc.py index 4a0eb626..594c2157 100644 --- a/poezio/windows/muc.py +++ b/poezio/windows/muc.py @@ -9,9 +9,9 @@ import curses from . import Win -from .. import poopt -from .. config import config -from .. theming import to_curses_attr, get_theme +from poezio import poopt +from poezio.config import config +from poezio.theming import to_curses_attr, get_theme def userlist_to_cache(userlist): result = [] diff --git a/poezio/windows/roster_win.py b/poezio/windows/roster_win.py index e1c92073..a8d29228 100644 --- a/poezio/windows/roster_win.py +++ b/poezio/windows/roster_win.py @@ -9,11 +9,11 @@ from datetime import datetime from . import Win -from .. import common -from .. config import config -from .. contact import Contact, Resource -from .. roster import RosterGroup -from .. theming import get_theme, to_curses_attr +from poezio import common +from poezio.config import config +from poezio.contact import Contact, Resource +from poezio.roster import RosterGroup +from poezio.theming import get_theme, to_curses_attr class RosterWin(Win): diff --git a/poezio/windows/text_win.py b/poezio/windows/text_win.py index 1aad172c..b7186541 100644 --- a/poezio/windows/text_win.py +++ b/poezio/windows/text_win.py @@ -13,9 +13,9 @@ from . import Win from . base_wins import FORMAT_CHAR from . funcs import truncate_nick, parse_attrs -from .. import poopt -from .. config import config -from .. theming import to_curses_attr, get_theme, dump_tuple +from poezio import poopt +from poezio.config import config +from poezio.theming import to_curses_attr, get_theme, dump_tuple # msg is a reference to the corresponding Message object. text_start and -- cgit v1.2.3