Skip to content

Commit 0d5f9db

Browse files
allrob23denik
andauthored
refactor: use with statement for file reading (#2740)
## Changes This PR updates the file reading logic to use a with statement, aligning with Python best practices for resource management. is a minor change but ensures consistency with the project standard, as other parts already use with statements. Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
1 parent 804f62a commit 0d5f9db

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

tools/validate_whitespace.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ def main():
7171
if f in ignores:
7272
n_skipped += 1
7373
continue
74-
data = open(f, "rb").read()
74+
with open(f, "rb") as file:
75+
data = file.read()
7576
error = False
7677
for msg in validate_contents(data):
7778
print(f"{f}:{msg}")

0 commit comments

Comments
 (0)