Use context manager for file reading

This commit is contained in:
Peter Bittner 2022-03-11 10:22:51 +01:00
parent 52aa88f08a
commit d82ca0aed5

View file

@ -10,7 +10,9 @@ import analytical as package
def read_file(fname):
return (Path(__file__).resolve().parent / fname).open().read()
"""Read content of a file in project folder."""
with (Path(__file__).resolve().parent / fname).open() as file:
return file.read()
setup(