style: normalize code formatting across the codebase
- Standardize quote style (single to double quotes) - Improve code formatting consistency - Apply formatting to utilities, GUI components, and tools - Update imports and docstrings for consistency Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -28,10 +28,12 @@ class ConfigLoader:
|
||||
"""
|
||||
if os.path.exists(config_file):
|
||||
try:
|
||||
with open(config_file, 'r', encoding='utf-8') as f:
|
||||
with open(config_file, "r", encoding="utf-8") as f:
|
||||
loaded_settings = json.load(f)
|
||||
# 合并默认配置和加载的配置
|
||||
merged_settings = ConfigLoader._merge_settings(DEFAULT_SETTINGS_DICT, loaded_settings)
|
||||
merged_settings = ConfigLoader._merge_settings(
|
||||
DEFAULT_SETTINGS_DICT, loaded_settings
|
||||
)
|
||||
return ConfigLoader._dict_to_config(merged_settings)
|
||||
except (json.JSONDecodeError, IOError) as e:
|
||||
print(f"加载配置文件失败: {e},使用默认配置")
|
||||
@@ -57,7 +59,7 @@ class ConfigLoader:
|
||||
# 确保配置目录存在
|
||||
os.makedirs(os.path.dirname(config_file), exist_ok=True)
|
||||
|
||||
with open(config_file, 'w', encoding='utf-8') as f:
|
||||
with open(config_file, "w", encoding="utf-8") as f:
|
||||
json.dump(config.to_dict(), f, ensure_ascii=False, indent=2)
|
||||
return True
|
||||
except IOError as e:
|
||||
@@ -79,7 +81,11 @@ class ConfigLoader:
|
||||
result = defaults.copy()
|
||||
|
||||
for key, value in loaded.items():
|
||||
if key in result and isinstance(result[key], dict) and isinstance(value, dict):
|
||||
if (
|
||||
key in result
|
||||
and isinstance(result[key], dict)
|
||||
and isinstance(value, dict)
|
||||
):
|
||||
result[key] = ConfigLoader._merge_settings(result[key], value)
|
||||
else:
|
||||
result[key] = value
|
||||
@@ -117,20 +123,26 @@ class ConfigLoader:
|
||||
username=database_dict.get("username", ""),
|
||||
password=database_dict.get("password", ""),
|
||||
driver=database_dict.get("driver", "ODBC Driver 18 for SQL Server"),
|
||||
trust_server_certificate=database_dict.get("trust_server_certificate", "yes"),
|
||||
trust_server_certificate=database_dict.get(
|
||||
"trust_server_certificate", "yes"
|
||||
),
|
||||
),
|
||||
paths=PathConfig(
|
||||
data_dir=paths_dict.get("data_dir", ""),
|
||||
production_id_file=paths_dict.get("production_id_file", ""),
|
||||
default_output=paths_dict.get("default_output", "离散备料计划维护_合并.xlsx"),
|
||||
validation_output=paths_dict.get("validation_output", "物料状态校验结果.xlsx"),
|
||||
default_output=paths_dict.get(
|
||||
"default_output", "离散备料计划维护_合并.xlsx"
|
||||
),
|
||||
validation_output=paths_dict.get(
|
||||
"validation_output", "物料状态校验结果.xlsx"
|
||||
),
|
||||
),
|
||||
extraction=ExtractionConfig(
|
||||
batch_size=extraction_dict.get("batch_size", 100),
|
||||
verbose=extraction_dict.get("verbose", True),
|
||||
auto_convert=extraction_dict.get("auto_convert", True),
|
||||
merge_batches=extraction_dict.get("merge_batches", True),
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user