Skip to content

Commit

Permalink
perf: 优化代码和错误提示 (1Panel-dev#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeEirc authored Apr 15, 2024
1 parent 2375b47 commit dfb04b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions apps/common/util/file_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@


def get_file_content(path):
file = open(path, "r",
encoding='utf-8')
content = file.read()
file.close()
with open(path, "r", encoding='utf-8') as file:
content = file.read()
return content
4 changes: 2 additions & 2 deletions apps/smartdoc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ def load_user_config(cls, root_path=None, config_class=None):
if manager.load_from_yml():
config = manager.config
else:
msg = """
msg = f"""
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)
return config

0 comments on commit dfb04b1

Please sign in to comment.