Minor code cleanup in check_system_module #621
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem: Reading a file using
f.open().read()
keeps the file open until the garbage collector deletes the variable.Since this uses Pathlib already, using
Path(...).read_text()
is cleaner and does not depend on the opening mode beingr
.A file with no content could not be distinguished from a missing file. Instead, this changes the behaviour to return None when the file is missing instead of an empty string.