Skip to content

Commit 64e5fff

Browse files
committed
refractor: 清理掉 nc 中无用的导出
1 parent 7b966c2 commit 64e5fff

File tree

11 files changed

+350
-375
lines changed

11 files changed

+350
-375
lines changed

ncatbot/core/adapter/nc/__init__.py

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,12 @@
55
"""
66

77
from .service import (
8-
NapCatService,
98
launch_napcat_service,
109
)
11-
from .auth import (
12-
AuthHandler,
13-
LoginStatus,
14-
)
15-
from .platform import (
16-
PlatformOps,
17-
WindowsOps,
18-
LinuxOps,
19-
UnsupportedPlatformError,
20-
)
21-
from .config_manager import (
22-
ConfigManager,
23-
config_napcat,
24-
)
25-
from .websocket import (
26-
NapCatWebSocket,
27-
)
10+
from .websocket import NapCatWebSocket
11+
2812

2913
__all__ = [
30-
# 主服务
31-
"NapCatService",
3214
"launch_napcat_service",
33-
# 认证
34-
"AuthHandler",
35-
"LoginStatus",
36-
# 平台操作
37-
"PlatformOps",
38-
"WindowsOps",
39-
"LinuxOps",
40-
"UnsupportedPlatformError",
41-
# 配置管理
42-
"ConfigManager",
43-
"config_napcat",
44-
# WebSocket
4515
"NapCatWebSocket",
4616
]

ncatbot/core/adapter/nc/auth.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
import qrcode
1414

15-
from ....utils import NAPCAT_WEBUI_SALT, get_log, ncatbot_config, post_json
15+
from ncatbot.utils import NAPCAT_WEBUI_SALT, get_log, ncatbot_config
16+
from .utils import post_json
1617

1718
LOG = get_log("ncatbot.core.adapter.nc.auth")
1819

ncatbot/core/adapter/nc/config_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
from typing import Optional
1111
from urllib.parse import urlparse
1212

13-
from ....utils import get_log, ncatbot_config
14-
from ....utils.assets.default_webui_config import config as default_webui_config
13+
from ncatbot.utils import get_log, ncatbot_config
14+
from ncatbot.utils.assets.default_webui_config import config as default_webui_config
1515
from .platform import PlatformOps
1616

1717
LOG = get_log("ncatbot.core.adapter.nc.config")

ncatbot/core/adapter/nc/platform.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
使用工厂模式统一 Windows/Linux 平台的 NapCat 安装、启动、停止操作。
55
"""
66

7-
import atexit
87
import json
98
import os
109
import platform
@@ -15,16 +14,14 @@
1514
from pathlib import Path
1615
from typing import Optional
1716

18-
from ....utils import (
17+
from ncatbot.utils import (
1918
INSTALL_SCRIPT_URL,
2019
LINUX_NAPCAT_DIR,
2120
WINDOWS_NAPCAT_DIR,
22-
gen_url_with_proxy,
23-
get_json,
2421
get_log,
2522
ncatbot_config,
2623
)
27-
from .utils import download_file, unzip_file
24+
from .utils import download_file, unzip_file, gen_url_with_proxy, get_json
2825

2926
LOG = get_log("ncatbot.core.adapter.nc.platform")
3027

ncatbot/core/adapter/nc/service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import websockets
1313

14-
from ....utils import NcatBotError, get_log, ncatbot_config
14+
from ncatbot.utils import NcatBotError, get_log, ncatbot_config
1515
from .auth import AuthHandler, LoginStatus
1616
from .config_manager import ConfigManager
1717
from .platform import PlatformOps, UnsupportedPlatformError

0 commit comments

Comments
 (0)