Skip to content

Commit

Permalink
Merge pull request #46 from Missing-Tech/master
Browse files Browse the repository at this point in the history
Close yaml files after opening
  • Loading branch information
junzis authored Apr 15, 2024
2 parents 8e6a2bc + d32058d commit 8559381
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion openap/drag.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def dragpolar(self):
raise RuntimeError(f"Drag polar for {self.ac} not avaiable in OpenAP.")

f = dir_dragpolar + ac + ".yml"
dragpolar = yaml.safe_load(open(f))
with open(f, "r") as file:
dragpolar = yaml.safe_load(file.read())
return dragpolar

@ndarrayconvert
Expand Down
3 changes: 2 additions & 1 deletion openap/prop.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def aircraft(ac, use_synonym=False, **kwargs):
raise RuntimeError(f"Aircraft {ac} not avaiable in OpenAP.")

f = files[0]
acdict = yaml.safe_load(open(f))
with open(f, "r") as file:
acdict = yaml.safe_load(file.read())

return acdict

Expand Down

0 comments on commit 8559381

Please sign in to comment.