Skip to content

Commit 625c8ce

Browse files
committed
Merge branch 'fix-file-handle-leak' of https://github.com/katajakasa/aiohttp-swagger into katajakasa-fix-file-handle-leak
2 parents 96b1554 + 0264285 commit 625c8ce

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

aiohttp_swagger/helpers/builders.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,9 @@ def nesteddict2yaml(d, indent=10, result=""):
159159

160160

161161
def load_doc_from_yaml_file(doc_path: str):
162-
loaded_yaml = yaml.full_load(open(doc_path, "r").read())
163-
return json.dumps(loaded_yaml)
162+
with open(doc_path, "r") as f:
163+
loaded_yaml = yaml.full_load(f.read())
164+
return json.dumps(loaded_yaml)
164165

165166

166167
__all__ = ("generate_doc_from_each_end_point", "load_doc_from_yaml_file")

0 commit comments

Comments
 (0)