-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Omit asyncio.timeout
from SIM117
#8606
Comments
This seems like a reasonable suggestion -- I agree that collapsing the timeout here is awkward, since semantically it's meant to be wrapping the inner |
asyncio.timeout
from SIM117
PR welcome if you're interested :) The changes would be in |
I will happily have a go at a PR this week (am a little busy) Locks crossed my mind as a possible further candidate for "more explicit scoping", but I will stick with timing for starters. |
Awesome, just ask here or in Discord if you have any questions. |
Semantically it makes sense to put certain contextmanagers into separate with statements. Currently asyncio.timeout and its relatives in anyio and trio are exempt from SIM117. Closes astral-sh#8606
Semantically it makes sense to put certain contextmanagers into separate with statements. Currently asyncio.timeout and its relatives in anyio and trio are exempt from SIM117. Closes astral-sh#8606
Semantically it makes sense to put certain contextmanagers into separate with statements. Currently asyncio.timeout and its relatives in anyio and trio are exempt from SIM117. Closes #8606 ## Summary Exempt asyncio.timeout and related functions from SIM117 (Collapse with statements where possible). See #8606 for more. ## Test Plan Extended the insta tests.
While I generally agree with SIM117 (combine with statements where possible), I am wondering if there are cases where there should be exceptions to the rule, in particular
asyncio.timeout
comes to mind.I.e. I find the following clearer
Less clear in my opinion:
While this is a minor cosmetic issue, I am wondering if this warrants a configuration option (a list of contextmanagers for which to ignore SIM117), or is to much of an edge case to consider complicating the configuration.
For now I ignore SIM117 for tests, which is the main case in which I trigger these.
The text was updated successfully, but these errors were encountered: