Skip to content

Use context managers for file handles

Reese Daniel requested to merge file-context-managers into dev

This PR replaces all occurrences of explicit file opening and closing with context handlers. e.g. I've replaced

    f = open(filename, 'r')
    ...
    f.close()

with

    with open(filename, 'r') as f:
        ...

which is apparently better practice. This is intended to close #10 (closed).

I also refactored the LEGACY output while I was it and added a test of utilities.sparse_print.

Merge request reports

Loading