Rearrange module-local imports

This commit is contained in:
Tim Van Baak 2020-04-25 10:16:05 -07:00
parent 768006ffbe
commit c47f9a7e5a
18 changed files with 42 additions and 36 deletions

View File

@ -2,12 +2,13 @@
import logging import logging
# Module imports # Module imports
from amanuensis.cli.helpers import (
add_argument, no_argument, requires_lexicon, requires_user, alias,
config_get, config_set, CONFIG_GET_ROOT_VALUE)
from amanuensis.config import RootConfigDirectoryContext from amanuensis.config import RootConfigDirectoryContext
from amanuensis.models import LexiconModel, UserModel from amanuensis.models import LexiconModel, UserModel
from .helpers import (
add_argument, no_argument, requires_lexicon, requires_user, alias,
config_get, config_set, CONFIG_GET_ROOT_VALUE)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
# #

View File

@ -2,7 +2,8 @@ import logging
import os import os
from amanuensis.config import RootConfigDirectoryContext from amanuensis.config import RootConfigDirectoryContext
from amanuensis.cli.helpers import (
from .helpers import (
add_argument, add_argument,
no_argument, no_argument,
alias, alias,

View File

@ -4,7 +4,9 @@ import logging
# import shutil # import shutil
# Module imports # Module imports
from amanuensis.cli.helpers import ( from amanuensis.models import UserModel
from .helpers import (
add_argument, add_argument,
no_argument, no_argument,
requires_user, requires_user,
@ -12,7 +14,6 @@ from amanuensis.cli.helpers import (
config_get, config_get,
config_set, config_set,
CONFIG_GET_ROOT_VALUE) CONFIG_GET_ROOT_VALUE)
from amanuensis.models import UserModel
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -1,6 +1,6 @@
# Module imports # Module imports
from amanuensis.config.dict import AttrOrderedDict, ReadOnlyOrderedDict from .dict import AttrOrderedDict, ReadOnlyOrderedDict
from amanuensis.config.directory import ( from .directory import (
RootConfigDirectoryContext, RootConfigDirectoryContext,
UserConfigDirectoryContext, UserConfigDirectoryContext,
LexiconConfigDirectoryContext, LexiconConfigDirectoryContext,

View File

@ -6,7 +6,7 @@ import fcntl
import json import json
# Application imports # Application imports
from amanuensis.config.dict import AttrOrderedDict, ReadOnlyOrderedDict from .dict import AttrOrderedDict, ReadOnlyOrderedDict
class open_lock(): class open_lock():

View File

@ -6,9 +6,10 @@ import os
import re import re
from typing import Iterable from typing import Iterable
from amanuensis.config.context import json_ro, json_rw
from amanuensis.errors import MissingConfigError, ConfigAlreadyExistsError from amanuensis.errors import MissingConfigError, ConfigAlreadyExistsError
from .context import json_ro, json_rw
def is_guid(s: str) -> bool: def is_guid(s: str) -> bool:
return bool(re.match(r'[0-9a-z]{32}', s.lower())) return bool(re.match(r'[0-9a-z]{32}', s.lower()))

View File

@ -6,10 +6,10 @@ import os
import shutil import shutil
# Module imports # Module imports
# from amanuensis.errors import MissingConfigError, MalformedConfigError
from amanuensis.config.context import json_ro, json_rw
from amanuensis.resources import get_stream from amanuensis.resources import get_stream
from .context import json_ro, json_rw
def create_config_dir(config_dir, refresh=False): def create_config_dir(config_dir, refresh=False):
""" """

View File

@ -1,9 +1,9 @@
from amanuensis.lexicon.admin import ( from .admin import (
valid_name, valid_name,
create_lexicon, create_lexicon,
load_all_lexicons) load_all_lexicons)
from amanuensis.lexicon.gameloop import attempt_publish from .gameloop import attempt_publish
from amanuensis.lexicon.setup import ( from .setup import (
player_can_join_lexicon, player_can_join_lexicon,
add_player_to_lexicon, add_player_to_lexicon,
create_character_in_lexicon) create_character_in_lexicon)

View File

@ -1,4 +1,4 @@
from amanuensis.log.setup import init_logging from .setup import init_logging
__all__ = [member.__name__ for member in [ __all__ = [member.__name__ for member in [
init_logging init_logging

View File

@ -1,6 +1,6 @@
from amanuensis.models.factory import ModelFactory from .factory import ModelFactory
from amanuensis.models.lexicon import LexiconModel from .lexicon import LexiconModel
from amanuensis.models.user import UserModelBase, UserModel, AnonymousUserModel from .user import UserModelBase, UserModel, AnonymousUserModel
__all__ = [member.__name__ for member in [ __all__ = [member.__name__ for member in [
ModelFactory, ModelFactory,

View File

@ -2,8 +2,9 @@ from typing import Optional
from amanuensis.config import is_guid, RootConfigDirectoryContext from amanuensis.config import is_guid, RootConfigDirectoryContext
from amanuensis.errors import ArgumentError from amanuensis.errors import ArgumentError
from amanuensis.models.user import UserModel
from amanuensis.models.lexicon import LexiconModel from .user import UserModel
from .lexicon import LexiconModel
class ModelFactory(): class ModelFactory():

View File

@ -2,10 +2,10 @@
Module encapsulating all markdown parsing functionality. Module encapsulating all markdown parsing functionality.
""" """
from amanuensis.parser.analyze import FeatureCounter, GetCitations from .analyze import FeatureCounter, GetCitations
from amanuensis.parser.helpers import titlesort, filesafe_title from .helpers import titlesort, filesafe_title
from amanuensis.parser.parsing import parse_raw_markdown from .parsing import parse_raw_markdown
from amanuensis.parser.render import PreviewHtmlRenderer, HtmlRenderer from .render import PreviewHtmlRenderer, HtmlRenderer
__all__ = [ __all__ = [
FeatureCounter.__name__, FeatureCounter.__name__,

View File

@ -5,7 +5,7 @@ for verification against constraints.
import re import re
from amanuensis.parser.core import RenderableVisitor from .core import RenderableVisitor
class GetCitations(RenderableVisitor): class GetCitations(RenderableVisitor):

View File

@ -6,7 +6,7 @@ Lexipython markdown.
import re import re
from typing import Sequence from typing import Sequence
from amanuensis.parser.core import ( from .core import (
TextSpan, TextSpan,
LineBreak, LineBreak,
ParsedArticle, ParsedArticle,

View File

@ -5,7 +5,7 @@ readable formats.
from typing import Iterable from typing import Iterable
from amanuensis.parser.helpers import filesafe_title from .helpers import filesafe_title
class HtmlRenderer(): class HtmlRenderer():

View File

@ -2,11 +2,11 @@ from flask import Flask
from amanuensis.config import RootConfigDirectoryContext from amanuensis.config import RootConfigDirectoryContext
from amanuensis.models import ModelFactory from amanuensis.models import ModelFactory
from amanuensis.server.auth import get_login_manager, bp_auth from .auth import get_login_manager, bp_auth
from amanuensis.server.helpers import register_custom_filters from .helpers import register_custom_filters
from amanuensis.server.home import bp_home from .home import bp_home
from amanuensis.server.lexicon import bp_lexicon from .lexicon import bp_lexicon
from amanuensis.server.session import bp_session from .session import bp_session
def get_app(root: RootConfigDirectoryContext) -> Flask: def get_app(root: RootConfigDirectoryContext) -> Flask:

View File

@ -15,9 +15,10 @@ from flask_login import (
LoginManager) LoginManager)
from amanuensis.config import RootConfigDirectoryContext from amanuensis.config import RootConfigDirectoryContext
from amanuensis.server.auth.forms import LoginForm
from amanuensis.models import ModelFactory, AnonymousUserModel from amanuensis.models import ModelFactory, AnonymousUserModel
from .forms import LoginForm
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View File

@ -1,5 +1,5 @@
from amanuensis.user.manage import load_all_users from .manage import load_all_users
from amanuensis.user.signup import ( from .signup import (
create_user, create_user,
valid_username, valid_username,
valid_email) valid_email)