Skip to content

Commit

Permalink
[consider-using-with] Use the template allowing multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed Sep 4, 2023
1 parent edaf96b commit 7353853
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
file = open("apple.txt", "r", encoding="utf8") # [consider-using-with]
contents = file.read()
file.close()

worst = open("banana.txt", "r", encoding="utf8").read() # [consider-using-with]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
contents = open("apple.txt", "r", encoding="utf8").read() # [consider-using-with]
3 changes: 0 additions & 3 deletions doc/data/messages/c/consider-using-with/good.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
with open("apple.txt", "r", encoding="utf8") as file:
contents = file.read()

with open("banana.txt", "r", encoding="utf8") as f:
best = f.read()

0 comments on commit 7353853

Please sign in to comment.