Skip to content

Invalid python code in the documentation for ASYNC100 rule #12921

@olutra

Description

@olutra

Examples for the rule cancel-scope-no-checkpoint (ASYNC100) are not valid python code

/// Use instead:
/// ```python
/// async def func():
/// with asyncio.timeout(2):
/// do_something()
/// await awaitable()
/// ```

The code

import asyncio

async def func():
    with asyncio.timeout(2):
        do_something()
        await awaitable()

asyncio.run(func())

will throw a TypeError
TypeError: 'Timeout' object does not support the context manager protocol
because asyncio.timeout is an asynchronous context manager.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions