Make importing backends easier

This commit is contained in:
Tim Van Baak 2021-06-28 21:13:14 -07:00
parent 5487181131
commit 0481b78122
14 changed files with 26 additions and 24 deletions

View File

@ -0,0 +1,9 @@
import amanuensis.backend.article as artiq
import amanuensis.backend.character as charq
import amanuensis.backend.index as indq
import amanuensis.backend.lexicon as lexiq
import amanuensis.backend.membership as memq
import amanuensis.backend.post as postq
import amanuensis.backend.user as userq
__all__ = ["artiq", "charq", "indq", "lexiq", "memq", "postq", "userq"]

View File

@ -2,9 +2,7 @@ import logging
from sqlalchemy import update
import amanuensis.backend.lexicon as lexiq
import amanuensis.backend.membership as memq
import amanuensis.backend.user as userq
from amanuensis.backend import lexiq, memq, userq
from amanuensis.db import DbContext, Lexicon
from .helpers import add_argument

View File

@ -1,7 +1,7 @@
import logging
from typing import Optional
import amanuensis.backend.user as userq
from amanuensis.backend import userq
from amanuensis.db import DbContext, User
from .helpers import add_argument

View File

@ -4,8 +4,7 @@ import os
from flask import Flask, g
import amanuensis.backend.lexicon
import amanuensis.backend.user
from amanuensis.backend import lexiq, userq
from amanuensis.config import AmanuensisConfig, CommandLineConfig
from amanuensis.db import DbContext
import amanuensis.server.auth as auth
@ -61,7 +60,7 @@ def get_app(
app.template_filter("date")(date_format)
def include_backend():
return {"db": db, "lexiq": amanuensis.backend.lexicon, "userq": amanuensis.backend.user}
return {"db": db, "lexiq": lexiq, "userq": userq}
app.context_processor(include_backend)

View File

@ -17,7 +17,7 @@ from flask_login import (
LoginManager,
)
import amanuensis.backend.user as userq
from amanuensis.backend import userq
from amanuensis.db import User
from .forms import LoginForm

View File

@ -1,7 +1,6 @@
from flask import Blueprint, render_template, g
import amanuensis.backend.user as userq
import amanuensis.backend.lexicon as lexiq
from amanuensis.backend import userq, lexiq
# from .forms import LexiconCreateForm

View File

@ -1,9 +1,9 @@
import pytest
import time
from amanuensis.db import DbContext
from amanuensis.db.models import Character, Lexicon, User
import amanuensis.backend.article as artiq
from amanuensis.backend import artiq
from amanuensis.db import DbContext, Character, Lexicon, User
from amanuensis.errors import ArgumentError
from tests.conftest import ObjectFactory

View File

@ -1,7 +1,7 @@
import pytest
from amanuensis.backend import charq
from amanuensis.db import *
import amanuensis.backend.character as charq
from amanuensis.errors import ArgumentError

View File

@ -1,8 +1,8 @@
from amanuensis.db.models import IndexType
import pytest
import amanuensis.backend.index as indq
from amanuensis.db import DbContext, Lexicon, User
from amanuensis.backend import indq
from amanuensis.db import DbContext, Lexicon
from amanuensis.errors import ArgumentError

View File

@ -3,7 +3,7 @@ import time
import pytest
import amanuensis.backend.lexicon as lexiq
from amanuensis.backend import lexiq
from amanuensis.db import DbContext, Lexicon, User
from amanuensis.errors import ArgumentError
from tests.conftest import ObjectFactory

View File

@ -2,9 +2,9 @@ import pytest
from sqlalchemy import select
from amanuensis.backend import memq
from amanuensis.db import *
from amanuensis.errors import ArgumentError
import amanuensis.backend.membership as memq
def test_create_membership(db: DbContext, make):

View File

@ -1,7 +1,7 @@
import pytest
from amanuensis.backend import postq
from amanuensis.db import DbContext
import amanuensis.backend.post as postq
from amanuensis.errors import ArgumentError

View File

@ -2,7 +2,7 @@ import os
import pytest
import amanuensis.backend.user as userq
from amanuensis.backend import userq
from amanuensis.db import DbContext, User
from amanuensis.errors import ArgumentError

View File

@ -10,10 +10,7 @@ from bs4 import BeautifulSoup
from flask.testing import FlaskClient
from sqlalchemy.orm.session import close_all_sessions
import amanuensis.backend.character as charq
import amanuensis.backend.lexicon as lexiq
import amanuensis.backend.membership as memq
import amanuensis.backend.user as userq
from amanuensis.backend import charq, lexiq, memq, userq
from amanuensis.config import AmanuensisConfig
from amanuensis.db import DbContext, User, Lexicon, Membership, Character
from amanuensis.server import get_app