Skip to content

False positives due to incorrect async with semantics #367

Closed
@tim-becker

Description

@tim-becker

flake8-async seems to generally handle async with statements with multiple items incorrectly.

Below is an example demonstrating a false positive detection of ASYNC100, but this surely affects many other rules as well (e.g. ASYNC912)

import asyncio

async def main():
    async with asyncio.timeout(1), asyncio.TaskGroup() as tg: # noqa: ASYNC100 ; false positive because tg.__aexit__ occurs within timeout scope
        _ = tg.create_task(asyncio.sleep(2))

asyncio.run(main())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions