♻ 规范命名 优化导入

This commit is contained in:
洛水居室 2022-08-05 19:14:29 +08:00
parent 0b898d4868
commit 9ac387ded2
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
45 changed files with 72 additions and 71 deletions

View File

@ -1,9 +1,9 @@
from app.admin.cache import BotAdminCache from utils.apps.manager import listener_service
from app.admin.repositories import BotAdminRepository
from app.admin.service import BotAdminService
from utils.app.manager import listener_service
from utils.mysql import MySQL from utils.mysql import MySQL
from utils.redisdb import RedisDB from utils.redisdb import RedisDB
from .cache import BotAdminCache
from .repositories import BotAdminRepository
from .services import BotAdminService
@listener_service() @listener_service()

View File

@ -3,10 +3,10 @@ from typing import List
from pymysql import IntegrityError from pymysql import IntegrityError
from telegram import Bot from telegram import Bot
from app.admin.cache import BotAdminCache, GroupAdminCache from cache import BotAdminCache, GroupAdminCache
from app.admin.repositories import BotAdminRepository
from config import config from config import config
from logger import Log from logger import Log
from repositories import BotAdminRepository
class BotAdminService: class BotAdminService:

View File

@ -1,9 +1,9 @@
from utils.app.manager import listener_service from utils.apps.manager import listener_service
from utils.mysql import MySQL from utils.mysql import MySQL
from utils.redisdb import RedisDB from utils.redisdb import RedisDB
from .cache import PublicCookiesCache from .cache import PublicCookiesCache
from .repositories import CookiesRepository from .repositories import CookiesRepository
from .service import CookiesService, PublicCookiesService from .services import CookiesService, PublicCookiesService
@listener_service() @listener_service()

View File

@ -1,7 +1,7 @@
from app.game.cache import GameStrategyCache from utils.apps.manager import listener_service
from app.game.service import GameStrategyService
from utils.app.manager import listener_service
from utils.redisdb import RedisDB from utils.redisdb import RedisDB
from .cache import GameStrategyCache
from .services import GameStrategyService
@listener_service() @listener_service()

View File

@ -1,7 +1,7 @@
from typing import List, Optional from typing import List, Optional
from app.game.cache import GameStrategyCache
from model.apihelper.hyperion import Hyperion from model.apihelper.hyperion import Hyperion
from .cache import GameStrategyCache
class GameStrategyService: class GameStrategyService:

View File

@ -1,6 +1,6 @@
from typing import List from typing import List
from app.quiz.models import Question, Answer from .models import Question, Answer
def CreatQuestionFromSQLData(data: tuple) -> List[Question]: def CreatQuestionFromSQLData(data: tuple) -> List[Question]:

View File

@ -1,8 +1,8 @@
from typing import List from typing import List
import ujson import ujson
from app.quiz.models import Question, Answer from app.quiz.models import Question, Answer
from utils.redisdb import RedisDB from utils.redisdb import RedisDB

View File

@ -1,7 +1,7 @@
from typing import List from typing import List
from app.quiz.models import Question, Answer
from utils.mysql import MySQL from utils.mysql import MySQL
from .models import Question, Answer
class QuizRepository: class QuizRepository:

View File

@ -2,9 +2,9 @@ from typing import List
import ujson import ujson
from app.quiz.cache import QuizCache from .cache import QuizCache
from app.quiz.models import Question from .models import Question
from app.quiz.repositories import QuizRepository from .repositories import QuizRepository
class QuizService: class QuizService:

View File

@ -1,6 +1,6 @@
from app.template.service import TemplateService
from utils.aiobrowser import AioBrowser from utils.aiobrowser import AioBrowser
from utils.app.manager import listener_service from utils.apps.manager import listener_service
from .services import TemplateService
@listener_service() @listener_service()

View File

@ -1,7 +1,7 @@
from app.user.repositories import UserRepository from utils.apps.manager import listener_service
from app.user.services import UserService
from utils.app.manager import listener_service
from utils.mysql import MySQL from utils.mysql import MySQL
from .repositories import UserRepository
from .services import UserService
@listener_service() @listener_service()

View File

@ -1,7 +1,7 @@
from app.wiki.cache import WikiCache from utils.apps.manager import listener_service
from app.wiki.service import WikiService
from utils.app.manager import listener_service
from utils.redisdb import RedisDB from utils.redisdb import RedisDB
from .cache import WikiCache
from .services import WikiService
@listener_service() @listener_service()

View File

@ -2,10 +2,10 @@ import asyncio
import ujson import ujson
from app.wiki.cache import WikiCache
from logger import Log from logger import Log
from model.wiki.characters import Characters from model.wiki.characters import Characters
from model.wiki.weapons import Weapons from model.wiki.weapons import Weapons
from .cache import WikiCache
class WikiService: class WikiService:

View File

@ -3,13 +3,13 @@ from telegram import Update
from telegram.constants import ChatAction from telegram.constants import ChatAction
from telegram.ext import CommandHandler, MessageHandler, filters, CallbackContext from telegram.ext import CommandHandler, MessageHandler, filters, CallbackContext
from app.cookies.service import CookiesService from apps.cookies.services import CookiesService
from app.template.service import TemplateService from apps.template.services import TemplateService
from app.user import UserService from apps.user import UserService
from app.user.repositories import UserNotFoundError from apps.user.repositories import UserNotFoundError
from logger import Log from logger import Log
from plugins.base import BasePlugins from plugins.base import BasePlugins
from utils.app.inject import inject from utils.apps.inject import inject
from utils.decorators.error import error_callable from utils.decorators.error import error_callable
from utils.decorators.restricts import restricts from utils.decorators.restricts import restricts
from utils.helpers import get_genshin_client, url_to_file from utils.helpers import get_genshin_client, url_to_file

View File

@ -2,9 +2,9 @@ from telegram import Update
from telegram.error import BadRequest, Forbidden from telegram.error import BadRequest, Forbidden
from telegram.ext import CallbackContext, CommandHandler from telegram.ext import CallbackContext, CommandHandler
from app.admin import BotAdminService from apps.admin import BotAdminService
from logger import Log from logger import Log
from utils.app.inject import inject from utils.apps.inject import inject
from utils.decorators.admins import bot_admins_rights_check from utils.decorators.admins import bot_admins_rights_check
from utils.plugins.manager import listener_plugins_class from utils.plugins.manager import listener_plugins_class

View File

@ -5,9 +5,9 @@ from telegram import Update, ReplyKeyboardRemove
from telegram.error import BadRequest from telegram.error import BadRequest
from telegram.ext import CallbackContext, ConversationHandler, filters from telegram.ext import CallbackContext, ConversationHandler, filters
from app.admin import BotAdminService from apps.admin import BotAdminService
from logger import Log from logger import Log
from utils.app.inject import inject from utils.apps.inject import inject
async def clean_message(context: CallbackContext, chat_id: int, message_id: int) -> bool: async def clean_message(context: CallbackContext, chat_id: int, message_id: int) -> bool:

View File

@ -7,13 +7,13 @@ from telegram.constants import ChatAction
from telegram.ext import CommandHandler, MessageHandler, ConversationHandler, filters, \ from telegram.ext import CommandHandler, MessageHandler, ConversationHandler, filters, \
CallbackContext CallbackContext
from app.cookies.service import CookiesService from apps.cookies.services import CookiesService
from app.template import TemplateService from apps.template.services import TemplateService
from app.user import UserService from apps.user.repositories import UserNotFoundError
from app.user.repositories import UserNotFoundError from apps.user.services import UserService
from logger import Log from logger import Log
from plugins.base import BasePlugins from plugins.base import BasePlugins
from utils.app.inject import inject from utils.apps.inject import inject
from utils.decorators.error import error_callable from utils.decorators.error import error_callable
from utils.decorators.restricts import restricts from utils.decorators.restricts import restricts
from utils.helpers import get_genshin_client from utils.helpers import get_genshin_client

View File

@ -5,12 +5,12 @@ from telegram import Update
from telegram.constants import ChatAction from telegram.constants import ChatAction
from telegram.ext import filters, CommandHandler, MessageHandler, CallbackContext from telegram.ext import filters, CommandHandler, MessageHandler, CallbackContext
from app.template import TemplateService from apps.template import TemplateService
from logger import Log from logger import Log
from model.apihelper.gacha import GachaInfo from model.apihelper.gacha import GachaInfo
from plugins.base import BasePlugins from plugins.base import BasePlugins
from plugins.gacha.wish import WishCountInfo, get_one from plugins.gacha.wish import WishCountInfo, get_one
from utils.app.inject import inject from utils.apps.inject import inject
from utils.bot import get_all_args from utils.bot import get_all_args
from utils.decorators.error import error_callable from utils.decorators.error import error_callable
from utils.decorators.restricts import restricts from utils.decorators.restricts import restricts

View File

@ -3,10 +3,10 @@ from telegram.constants import ChatAction
from telegram.error import BadRequest from telegram.error import BadRequest
from telegram.ext import CommandHandler, CallbackContext from telegram.ext import CommandHandler, CallbackContext
from app.template.service import TemplateService from apps.template.services import TemplateService
from config import config from config import config
from logger import Log from logger import Log
from utils.app.inject import inject from utils.apps.inject import inject
from utils.decorators.error import error_callable from utils.decorators.error import error_callable
from utils.decorators.restricts import restricts from utils.decorators.restricts import restricts
from utils.plugins.manager import listener_plugins_class from utils.plugins.manager import listener_plugins_class

View File

@ -8,13 +8,13 @@ from telegram import Update
from telegram.constants import ChatAction from telegram.constants import ChatAction
from telegram.ext import CallbackContext, CommandHandler, MessageHandler, ConversationHandler, filters from telegram.ext import CallbackContext, CommandHandler, MessageHandler, ConversationHandler, filters
from app.cookies import CookiesService from apps.cookies.services import CookiesService
from app.template import TemplateService from apps.template.services import TemplateService
from app.user import UserService from apps.user.repositories import UserNotFoundError
from app.user.repositories import UserNotFoundError from apps.user.services import UserService
from logger import Log from logger import Log
from plugins.base import BasePlugins from plugins.base import BasePlugins
from utils.app.inject import inject from utils.apps.inject import inject
from utils.bot import get_all_args from utils.bot import get_all_args
from utils.decorators.error import error_callable from utils.decorators.error import error_callable
from utils.decorators.restricts import restricts from utils.decorators.restricts import restricts

View File

@ -5,12 +5,12 @@ from genshin import Game, GenshinException, AlreadyClaimed, Client
from telegram import Update from telegram import Update
from telegram.ext import CommandHandler, MessageHandler, ConversationHandler, filters, CallbackContext from telegram.ext import CommandHandler, MessageHandler, ConversationHandler, filters, CallbackContext
from app.cookies.service import CookiesService from apps.cookies.services import CookiesService
from app.user import UserService from apps.user.repositories import UserNotFoundError
from app.user.repositories import UserNotFoundError from apps.user.services import UserService
from logger import Log from logger import Log
from plugins.base import BasePlugins from plugins.base import BasePlugins
from utils.app.inject import inject from utils.apps.inject import inject
from utils.decorators.error import error_callable from utils.decorators.error import error_callable
from utils.decorators.restricts import restricts from utils.decorators.restricts import restricts
from utils.helpers import get_genshin_client from utils.helpers import get_genshin_client

View File

@ -2,10 +2,10 @@ from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
from telegram.constants import ChatAction, ParseMode from telegram.constants import ChatAction, ParseMode
from telegram.ext import filters, ConversationHandler, CommandHandler, MessageHandler, CallbackContext from telegram.ext import filters, ConversationHandler, CommandHandler, MessageHandler, CallbackContext
from app.game import GameStrategyService from apps.game.services import GameStrategyService
from logger import Log from logger import Log
from plugins.base import BasePlugins from plugins.base import BasePlugins
from utils.app.inject import inject from utils.apps.inject import inject
from utils.bot import get_all_args from utils.bot import get_all_args
from utils.decorators.error import error_callable from utils.decorators.error import error_callable
from utils.decorators.restricts import restricts from utils.decorators.restricts import restricts

View File

@ -6,13 +6,13 @@ from telegram import Update
from telegram.constants import ChatAction from telegram.constants import ChatAction
from telegram.ext import CallbackContext, CommandHandler, MessageHandler, ConversationHandler, filters from telegram.ext import CallbackContext, CommandHandler, MessageHandler, ConversationHandler, filters
from app.cookies.service import CookiesService from apps.cookies.services import CookiesService
from app.template import TemplateService from apps.template.services import TemplateService
from app.user import UserService from apps.user.repositories import UserNotFoundError
from app.user.repositories import UserNotFoundError from apps.user.services import UserService
from logger import Log from logger import Log
from plugins.base import BasePlugins from plugins.base import BasePlugins
from utils.app.inject import inject from utils.apps.inject import inject
from utils.decorators.error import error_callable from utils.decorators.error import error_callable
from utils.decorators.restricts import restricts from utils.decorators.restricts import restricts
from utils.helpers import url_to_file, get_genshin_client from utils.helpers import url_to_file, get_genshin_client

View File

@ -2,12 +2,12 @@ from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
from telegram.constants import ChatAction from telegram.constants import ChatAction
from telegram.ext import filters, CommandHandler, MessageHandler, CallbackContext from telegram.ext import filters, CommandHandler, MessageHandler, CallbackContext
from app.template import TemplateService from apps.template.services import TemplateService
from app.wiki.service import WikiService from apps.wiki.services import WikiService
from logger import Log from logger import Log
from metadata.shortname import weaponToName from metadata.shortname import weaponToName
from plugins.base import BasePlugins from plugins.base import BasePlugins
from utils.app.inject import inject from utils.apps.inject import inject
from utils.bot import get_all_args from utils.bot import get_all_args
from utils.decorators.error import error_callable from utils.decorators.error import error_callable
from utils.decorators.restricts import restricts from utils.decorators.restricts import restricts

View File

@ -1,9 +1,9 @@
from telegram import Update from telegram import Update
from telegram.ext import CommandHandler, CallbackContext from telegram.ext import CommandHandler, CallbackContext
from app.wiki.service import WikiService from apps.wiki.services import WikiService
from plugins.base import BasePlugins from plugins.base import BasePlugins
from utils.app.inject import inject from utils.apps.inject import inject
from utils.decorators.admins import bot_admins_rights_check from utils.decorators.admins import bot_admins_rights_check
from utils.decorators.error import error_callable from utils.decorators.error import error_callable
from utils.plugins.manager import listener_plugins_class from utils.plugins.manager import listener_plugins_class

View File

@ -1,9 +1,10 @@
import inspect import inspect
from functools import wraps from functools import wraps
from utils.app.manager import ServiceDict
from logger import Log from logger import Log
from model.types import Func from model.types import Func
from utils.app.manager import ServiceDict
def get_injections(func: Func): def get_injections(func: Func):

View File

@ -1,8 +1,8 @@
from functools import wraps from functools import wraps
from typing import Callable from typing import Callable
from app.admin import BotAdminService from apps.admin.services import BotAdminService
from utils.app.inject import inject from utils.apps.inject import inject
def bot_admins_rights_check(func: Callable) -> Callable: def bot_admins_rights_check(func: Callable) -> Callable:

View File

@ -8,8 +8,8 @@ import httpx
from genshin import Client, types from genshin import Client, types
from httpx import UnsupportedProtocol from httpx import UnsupportedProtocol
from app.cookies.service import CookiesService from apps.cookies.services import CookiesService
from app.user import UserService from apps.user.services import UserService
from logger import Log from logger import Log
from model.base import RegionEnum from model.base import RegionEnum