style: format all Python files with Black
Apply Black formatter to the entire codebase for consistent code style. Co-Authored-By: Claude (glm-5) <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
负责加载、保存和管理用户配置。
|
||||
支持从环境变量和 .env 文件加载配置。
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import TYPE_CHECKING
|
||||
from config.loader import ConfigLoader
|
||||
@@ -20,7 +21,9 @@ if TYPE_CHECKING:
|
||||
class ConfigManager:
|
||||
"""配置管理器"""
|
||||
|
||||
def __init__(self, config_file: str = "config/user_settings.json", use_env: bool = True):
|
||||
def __init__(
|
||||
self, config_file: str = "config/user_settings.json", use_env: bool = True
|
||||
):
|
||||
"""
|
||||
初始化配置管理器
|
||||
|
||||
@@ -99,7 +102,9 @@ class ConfigManager:
|
||||
field_type = type(getattr(obj, target_field))
|
||||
|
||||
# 如果是字符串且目标字段是枚举类型,进行转换
|
||||
if isinstance(value, str) and hasattr(field_type, "__members__"): # 它是一个 Enum
|
||||
if isinstance(value, str) and hasattr(
|
||||
field_type, "__members__"
|
||||
): # 它是一个 Enum
|
||||
try:
|
||||
value = field_type(value)
|
||||
except ValueError:
|
||||
|
||||
Reference in New Issue
Block a user