Skip to content

Commit 5ea6e13

Browse files
committed
chore(core.config): ruff rewrite
1 parent a60d6fe commit 5ea6e13

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

astrbot/core/config/astrbot_config.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import logging
44
import enum
55
from .default import DEFAULT_CONFIG, DEFAULT_VALUE_MAP
6-
from typing import Dict
76
from astrbot.core.utils.astrbot_path import get_astrbot_data_path
87

98
ASTRBOT_CONFIG_PATH = os.path.join(get_astrbot_data_path(), "cmd_config.json")
@@ -45,7 +44,7 @@ def __init__(
4544
json.dump(default_config, f, indent=4, ensure_ascii=False)
4645
object.__setattr__(self, "first_deploy", True) # 标记第一次部署
4746

48-
with open(config_path, "r", encoding="utf-8-sig") as f:
47+
with open(config_path, encoding="utf-8-sig") as f:
4948
conf_str = f.read()
5049
conf = json.loads(conf_str)
5150

@@ -82,7 +81,7 @@ def _parse_schema(schema: dict, conf: dict):
8281

8382
return conf
8483

85-
def check_config_integrity(self, refer_conf: Dict, conf: Dict, path=""):
84+
def check_config_integrity(self, refer_conf: dict, conf: dict, path=""):
8685
"""检查配置完整性,如果有新的配置项或顺序不一致则返回 True"""
8786
has_new = False
8887

@@ -140,7 +139,7 @@ def check_config_integrity(self, refer_conf: Dict, conf: Dict, path=""):
140139

141140
return has_new
142141

143-
def save_config(self, replace_config: Dict = None):
142+
def save_config(self, replace_config: dict = None):
144143
"""将配置写入文件
145144
146145
如果传入 replace_config,则将配置替换为 replace_config

0 commit comments

Comments
 (0)