perf: 优化代码和错误提示 (#101)

This commit is contained in:
Eric_Lee 2024-04-15 16:53:26 +08:00 committed by GitHub
parent 2375b470b0
commit dfb04b1052
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 6 deletions

View File

@ -9,8 +9,6 @@
def get_file_content(path): def get_file_content(path):
file = open(path, "r", with open(path, "r", encoding='utf-8') as file:
encoding='utf-8') content = file.read()
content = file.read()
file.close()
return content return content

View File

@ -193,11 +193,11 @@ class ConfigManager:
if manager.load_from_yml(): if manager.load_from_yml():
config = manager.config config = manager.config
else: else:
msg = """ msg = f"""
Error: No config file found. Error: No config file found.
You can run `cp config_example.yml config_example.yml`, and edit it. You can run `cp config_example.yml {root_path}/config_example.yml`, and edit it.
""" """
raise ImportError(msg) raise ImportError(msg)
return config return config