ruff检查问题修复

This commit is contained in:
li-xiaochen 2024-12-14 20:52:05 +08:00
parent effcc2874e
commit 94009c8136
3 changed files with 6 additions and 14 deletions

View file

@ -1,26 +1,18 @@
import json import json
import os import os
from pathlib import Path
import yaml import yaml
from yamlcore import CoreDumper, CoreLoader from yamlcore import CoreLoader
from launcher.config.conf import Conf from launcher.config.conf import Conf
from pathlib import Path
conf_path = Path(os.path.join(os.getcwd(), "conf.json")) conf_path = Path(os.path.join(os.getcwd(), "conf.json"))
def save_conf(): def save_conf():
with conf_path.open("w", encoding="utf8") as f: with conf_path.open("w", encoding="utf8") as f:
json.dump(conf.model_dump(), f, ensure_ascii=False, indent=4) # Use json.dump json.dump(conf.model_dump(), f, ensure_ascii=False, indent=4)
# yaml.dump(
# conf.model_dump(),
# f,
# Dumper=CoreDumper,
# encoding="utf-8",
# default_flow_style=False,
# allow_unicode=True,
# )
def load_conf(): def load_conf():

View file

@ -1,5 +1,5 @@
import sys
import os import os
import sys
import yaml import yaml
@ -44,7 +44,7 @@ class SysConfig:
except FileNotFoundError: except FileNotFoundError:
pass pass
# logger.error(f"配置文件未找到: {self.config_path}") # logger.error(f"配置文件未找到: {self.config_path}")
except Exception as e: except Exception:
pass pass
# logger.error(f"加载配置文件时出错: {str(e)}") # logger.error(f"加载配置文件时出错: {str(e)}")

View file

@ -1,7 +1,7 @@
import webview import webview
from launcher.webview.api import Api
from launcher.sys_config import sys_config from launcher.sys_config import sys_config
from launcher.webview.api import Api
window = None window = None