Skip to content

Omit asyncio.timeout from SIM117 #8606

@maltevesper

Description

@maltevesper

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

async with asyncio.timeout(0.2):
    async with line_processor:
        await line_processor.stop(0)

Less clear in my opinion:

async with asyncio.timeout(0.2), line_processor:
    await line_processor.stop(0)

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions