mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-08 23:06:03 +00:00
refactor: 修改引入风格
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import threading
|
||||
from pkg.utils import ThreadCtl
|
||||
from . import threadctl
|
||||
|
||||
|
||||
context = {
|
||||
@@ -87,8 +87,8 @@ def set_thread_ctl(inst):
|
||||
context_lock.release()
|
||||
|
||||
|
||||
def get_thread_ctl() -> ThreadCtl:
|
||||
def get_thread_ctl() -> threadctl.ThreadCtl:
|
||||
context_lock.acquire()
|
||||
t: ThreadCtl = context['pool_ctl']
|
||||
t: threadctl.ThreadCtl = context['pool_ctl']
|
||||
context_lock.release()
|
||||
return t
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from pip._internal import main as pipmain
|
||||
|
||||
import pkg.utils.log as log
|
||||
from . import log
|
||||
|
||||
|
||||
def install(package):
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import logging
|
||||
import threading
|
||||
|
||||
import importlib
|
||||
import pkgutil
|
||||
import pkg.utils.context as context
|
||||
import pkg.plugin.host
|
||||
|
||||
from . import context
|
||||
from ..plugin import host as plugin_host
|
||||
|
||||
|
||||
def walk(module, prefix='', path_prefix=''):
|
||||
@@ -15,7 +14,7 @@ def walk(module, prefix='', path_prefix=''):
|
||||
walk(__import__(module.__name__ + '.' + item.name, fromlist=['']), prefix + item.name + '.', path_prefix + item.name + '/')
|
||||
else:
|
||||
logging.info('reload module: {}, path: {}'.format(prefix + item.name, path_prefix + item.name + '.py'))
|
||||
pkg.plugin.host.__current_module_path__ = "plugins/" + path_prefix + item.name + '.py'
|
||||
plugin_host.__current_module_path__ = "plugins/" + path_prefix + item.name + '.py'
|
||||
importlib.reload(__import__(module.__name__ + '.' + item.name, fromlist=['']))
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import logging
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
import re
|
||||
import os
|
||||
import config
|
||||
import traceback
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
text_render_font: ImageFont = None
|
||||
|
||||
if config.blob_message_strategy == "image": # 仅在启用了image时才加载字体
|
||||
|
||||
@@ -3,10 +3,9 @@ import logging
|
||||
import os.path
|
||||
|
||||
import requests
|
||||
import json
|
||||
|
||||
import pkg.utils.constants
|
||||
import pkg.utils.network as network
|
||||
from . import constants
|
||||
from . import network
|
||||
|
||||
|
||||
def check_dulwich_closure():
|
||||
@@ -70,7 +69,7 @@ def get_release_list() -> list:
|
||||
|
||||
def get_current_tag() -> str:
|
||||
"""获取当前tag"""
|
||||
current_tag = pkg.utils.constants.semantic_version
|
||||
current_tag = constants.semantic_version
|
||||
if os.path.exists("current_tag"):
|
||||
with open("current_tag", "r") as f:
|
||||
current_tag = f.read()
|
||||
|
||||
Reference in New Issue
Block a user