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
# 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.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__)
#

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,9 +1,9 @@
from amanuensis.lexicon.admin import (
from .admin import (
valid_name,
create_lexicon,
load_all_lexicons)
from amanuensis.lexicon.gameloop import attempt_publish
from amanuensis.lexicon.setup import (
from .gameloop import attempt_publish
from .setup import (
player_can_join_lexicon,
add_player_to_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 [
init_logging

View File

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

View File

@ -2,8 +2,9 @@ from typing import Optional
from amanuensis.config import is_guid, RootConfigDirectoryContext
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():

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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