Skip to content

Commit dfb04b1

Browse files
authored
perf: 优化代码和错误提示 (#101)
1 parent 2375b47 commit dfb04b1

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

apps/common/util/file_util.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010

1111
def get_file_content(path):
12-
file = open(path, "r",
13-
encoding='utf-8')
14-
content = file.read()
15-
file.close()
12+
with open(path, "r", encoding='utf-8') as file:
13+
content = file.read()
1614
return content

apps/smartdoc/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,11 @@ def load_user_config(cls, root_path=None, config_class=None):
193193
if manager.load_from_yml():
194194
config = manager.config
195195
else:
196-
msg = """
196+
msg = f"""
197197
198198
Error: No config file found.
199199
200-
You can run `cp config_example.yml config_example.yml`, and edit it.
200+
You can run `cp config_example.yml {root_path}/config_example.yml`, and edit it.
201201
"""
202202
raise ImportError(msg)
203203
return config

0 commit comments

Comments
 (0)