From 6a043f4a7d18e870c0bbc93538cc2dbb036b838d Mon Sep 17 00:00:00 2001 From: stef Date: Sat, 20 Aug 2016 19:37:22 +0200 Subject: [PATCH] more readable imports --- realms/__init__.py | 13 ++++++------- realms/commands.py | 4 ++-- realms/config/__init__.py | 3 ++- realms/lib/model.py | 2 +- realms/modules/auth/__init__.py | 2 +- realms/modules/auth/ldap/__init__.py | 2 +- realms/modules/auth/ldap/models.py | 2 +- realms/modules/auth/local/__init__.py | 2 +- realms/modules/auth/local/commands.py | 6 +++--- realms/modules/auth/local/models.py | 2 +- realms/modules/auth/views.py | 2 +- realms/modules/search/commands.py | 4 ++-- realms/modules/search/hooks.py | 4 ++-- realms/modules/search/models.py | 2 +- realms/modules/wiki/assets.py | 2 +- realms/modules/wiki/models.py | 6 +++--- realms/modules/wiki/tests.py | 4 ++-- setup.py | 2 +- 18 files changed, 32 insertions(+), 32 deletions(-) diff --git a/realms/__init__.py b/realms/__init__.py index 7578885..5a515be 100644 --- a/realms/__init__.py +++ b/realms/__init__.py @@ -1,13 +1,12 @@ from __future__ import absolute_import -import functools import sys - # Set default encoding to UTF-8 reload(sys) # noinspection PyUnresolvedReferences sys.setdefaultencoding('utf-8') +import functools import base64 import time import json @@ -26,11 +25,11 @@ from werkzeug.routing import BaseConverter from werkzeug.exceptions import HTTPException from sqlalchemy.ext.declarative import declarative_base -from .modules.search.models import Search -from .lib.util import to_canonical, remove_ext, mkdir_safe, gravatar_url, to_dict -from .lib.hook import HookModelMeta, HookMixin -from .lib.util import is_su, in_virtualenv -from .version import __version__ +from realms.modules.search.models import Search +from realms.lib.util import to_canonical, remove_ext, mkdir_safe, gravatar_url, to_dict +from realms.lib.hook import HookModelMeta, HookMixin +from realms.lib.util import is_su, in_virtualenv +from realms.version import __version__ class Application(Flask): diff --git a/realms/commands.py b/realms/commands.py index a3aedd4..b6dc8ae 100644 --- a/realms/commands.py +++ b/realms/commands.py @@ -11,8 +11,8 @@ from multiprocessing import cpu_count import click import pip -from . import config, create_app, db, __version__, cli, cache -from .lib.util import random_string, in_virtualenv, green, yellow, red +from realms import config, create_app, db, __version__, cli, cache +from realms.lib.util import random_string, in_virtualenv, green, yellow, red config = config.conf diff --git a/realms/config/__init__.py b/realms/config/__init__.py index 297c946..0ecbe8b 100644 --- a/realms/config/__init__.py +++ b/realms/config/__init__.py @@ -4,9 +4,10 @@ import json import os import sys +# noinspection PyUnresolvedReferences from six.moves.urllib.parse import urlparse -from ..lib.util import in_vagrant +from realms.lib.util import in_vagrant class Config(object): diff --git a/realms/lib/model.py b/realms/lib/model.py index 4543d4b..86d7839 100644 --- a/realms/lib/model.py +++ b/realms/lib/model.py @@ -5,7 +5,7 @@ from datetime import datetime from sqlalchemy import not_, and_ -from .. import db +from realms import db class Model(db.Model): diff --git a/realms/modules/auth/__init__.py b/realms/modules/auth/__init__.py index 2f62801..1908ef5 100644 --- a/realms/modules/auth/__init__.py +++ b/realms/modules/auth/__init__.py @@ -3,7 +3,7 @@ from __future__ import absolute_import from flask import request, flash, redirect from flask_login import login_url -from ... import login_manager +from realms import login_manager modules = set() diff --git a/realms/modules/auth/ldap/__init__.py b/realms/modules/auth/ldap/__init__.py index 18b067b..7ec6f86 100644 --- a/realms/modules/auth/ldap/__init__.py +++ b/realms/modules/auth/ldap/__init__.py @@ -1,5 +1,5 @@ from __future__ import absolute_import -from ..models import Auth +from realms.modules.auth.models import Auth Auth.register('ldap') diff --git a/realms/modules/auth/ldap/models.py b/realms/modules/auth/ldap/models.py index 7aa388f..f9a7931 100644 --- a/realms/modules/auth/ldap/models.py +++ b/realms/modules/auth/ldap/models.py @@ -5,7 +5,7 @@ from flask_login import login_user from flask_ldap_login import LDAPLoginForm from realms import ldap -from ..models import BaseUser +from realms.modules.auth.models import BaseUser users = {} diff --git a/realms/modules/auth/local/__init__.py b/realms/modules/auth/local/__init__.py index 989578d..6dbfd63 100644 --- a/realms/modules/auth/local/__init__.py +++ b/realms/modules/auth/local/__init__.py @@ -1,5 +1,5 @@ from __future__ import absolute_import -from ..models import Auth +from realms.modules.auth.models import Auth Auth.register('local') diff --git a/realms/modules/auth/local/commands.py b/realms/modules/auth/local/commands.py index 7f5d115..65b12fc 100644 --- a/realms/modules/auth/local/commands.py +++ b/realms/modules/auth/local/commands.py @@ -2,10 +2,10 @@ from __future__ import absolute_import import click +from realms import cli_group +from realms.lib.util import random_string +from realms.lib.util import green, red, yellow from .models import User -from ....lib.util import random_string -from ....lib.util import green, red, yellow -from .... import cli_group @cli_group(short_help="Auth Module") diff --git a/realms/modules/auth/local/models.py b/realms/modules/auth/local/models.py index 97d6669..228f196 100644 --- a/realms/modules/auth/local/models.py +++ b/realms/modules/auth/local/models.py @@ -8,7 +8,7 @@ from itsdangerous import URLSafeSerializer, BadSignature from realms import login_manager, db from realms.lib.model import Model -from ..models import BaseUser +from realms.modules.auth.models import BaseUser from .forms import LoginForm diff --git a/realms/modules/auth/views.py b/realms/modules/auth/views.py index 3b75948..f11eee5 100644 --- a/realms/modules/auth/views.py +++ b/realms/modules/auth/views.py @@ -3,7 +3,7 @@ from __future__ import absolute_import from flask import current_app, render_template, request, redirect, Blueprint, flash, url_for, session from flask_login import logout_user -from realms.modules.auth.models import Auth +from .models import Auth blueprint = Blueprint('auth', __name__, template_folder='templates') diff --git a/realms/modules/search/commands.py b/realms/modules/search/commands.py index cfc0936..a30758a 100644 --- a/realms/modules/search/commands.py +++ b/realms/modules/search/commands.py @@ -3,8 +3,8 @@ from __future__ import absolute_import import click from flask import current_app -from ... import search, cli_group -from ..wiki.models import Wiki +from realms import search, cli_group +from realms.modules.wiki.models import Wiki @cli_group(short_help="Search Module") diff --git a/realms/modules/search/hooks.py b/realms/modules/search/hooks.py index 1e0e694..a18b87d 100644 --- a/realms/modules/search/hooks.py +++ b/realms/modules/search/hooks.py @@ -1,7 +1,7 @@ from __future__ import absolute_import -from ..wiki.models import WikiPage -from ... import search +from realms import search +from realms.modules.wiki.models import WikiPage @WikiPage.after('write') diff --git a/realms/modules/search/models.py b/realms/modules/search/models.py index 86819d8..2dac20b 100644 --- a/realms/modules/search/models.py +++ b/realms/modules/search/models.py @@ -5,7 +5,7 @@ import sys from flask import g, current_app -from ...lib.util import filename_to_cname +from realms.lib.util import filename_to_cname def simple(app): diff --git a/realms/modules/wiki/assets.py b/realms/modules/wiki/assets.py index 6a89a8b..9b87083 100644 --- a/realms/modules/wiki/assets.py +++ b/realms/modules/wiki/assets.py @@ -1,6 +1,6 @@ from __future__ import absolute_import -from ... import assets +from realms import assets assets.register('editor.js', 'vendor/store-js/store.js', diff --git a/realms/modules/wiki/models.py b/realms/modules/wiki/models.py index 3201df9..703d240 100644 --- a/realms/modules/wiki/models.py +++ b/realms/modules/wiki/models.py @@ -9,9 +9,9 @@ import yaml from dulwich.object_store import tree_lookup_path from dulwich.repo import Repo, NotGitRepository -from ...lib.util import cname_to_filename, filename_to_cname -from ... import cache -from ...lib.hook import HookMixin +from realms import cache +from realms.lib.hook import HookMixin +from realms.lib.util import cname_to_filename, filename_to_cname class PageNotFound(Exception): diff --git a/realms/modules/wiki/tests.py b/realms/modules/wiki/tests.py index 62e4611..a3e2435 100644 --- a/realms/modules/wiki/tests.py +++ b/realms/modules/wiki/tests.py @@ -5,8 +5,8 @@ import json from nose.tools import * from flask import url_for -from ...lib.util import cname_to_filename, filename_to_cname -from ...lib.test import BaseTest +from realms.lib.util import cname_to_filename, filename_to_cname +from realms.lib.test import BaseTest class WikiBaseTest(BaseTest): diff --git a/setup.py b/setup.py index 3b8ab06..20f4a67 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ -from setuptools import setup, find_packages import os +from setuptools import setup, find_packages if os.environ.get('USER', '') == 'vagrant': del os.link