Do not raise SIM115 when a file is closed immediately? #7907
-
The following code violates open("a.txt", "w").close() # create or reset a.txt
# a.py:1:1: SIM115 Use context handler for opening files I'm wondering if SIM115 should not be raised in this case. We could use the following as a workaround: with open("a.txt", "w"):
pass |
Beta Was this translation helpful? Give feedback.
Answered by
charliermarsh
Oct 11, 2023
Replies: 1 comment 1 reply
-
Yeah, I think we should allow this. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
harupy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yeah, I think we should allow this.