[flake8-async] Make ASYNC210 example error out-of-the-box (#18977)

## Summary

Part of #18972

This PR makes [blocking-http-call-in-async-function
(ASYNC210)](https://docs.astral.sh/ruff/rules/blocking-http-call-in-async-function/#blocking-http-call-in-async-function-async210)'s
example error out-of-the-box

[Old example](https://play.ruff.rs/20cba4f4-fe2f-428a-a721-311d1a081e64)
```py
async def fetch():
    urllib.request.urlopen("https://example.com/foo/bar").read()
```

[New example](https://play.ruff.rs/5ca2a10d-5294-49ee-baee-0447f7188d9b)
```py
import urllib


async def fetch():
    urllib.request.urlopen("https://example.com/foo/bar").read()
```

## Test Plan

<!-- How was it tested? -->

N/A, no functionality/tests affected
This commit is contained in:
GiGaGon 2025-06-28 08:11:38 -07:00 committed by GitHub
parent 90cb0d3a7b
commit ed2e90371b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,12 +20,18 @@ use crate::checkers::ast::Checker;
///
/// ## Example
/// ```python
/// import urllib
///
///
/// async def fetch():
/// urllib.request.urlopen("https://example.com/foo/bar").read()
/// ```
///
/// Use instead:
/// ```python
/// import aiohttp
///
///
/// async def fetch():
/// async with aiohttp.ClientSession() as session:
/// async with session.get("https://example.com/foo/bar") as resp: