ruff/crates/ruff_linter/resources/test/fixtures/flake8_async/ASYNC210.py
Auguste Lalande 8cc96d7868 Re-code flake8-trio and flake8-async rules to match upstream (#10416)
Co-authored-by: Micha Reiser <micha@reiser.io>
2024-06-27 13:44:11 +02:00

69 lines
1.2 KiB
Python

import urllib
import requests
import httpx
import urllib3
async def foo():
urllib.request.urlopen("http://example.com/foo/bar").read() # ASYNC210
async def foo():
requests.get() # ASYNC210
async def foo():
httpx.get() # ASYNC210
async def foo():
requests.post() # ASYNC210
async def foo():
httpx.post() # ASYNC210
async def foo():
requests.get() # ASYNC210
requests.get(...) # ASYNC210
requests.get # Ok
print(requests.get()) # ASYNC210
print(requests.get(requests.get())) # ASYNC210
requests.options() # ASYNC210
requests.head() # ASYNC210
requests.post() # ASYNC210
requests.put() # ASYNC210
requests.patch() # ASYNC210
requests.delete() # ASYNC210
requests.foo()
httpx.options("") # ASYNC210
httpx.head("") # ASYNC210
httpx.post("") # ASYNC210
httpx.put("") # ASYNC210
httpx.patch("") # ASYNC210
httpx.delete("") # ASYNC210
httpx.foo() # Ok
urllib3.request() # ASYNC210
urllib3.request(...) # ASYNC210
urllib.request.urlopen("") # ASYNC210
r = {}
r.get("not a sync http client") # Ok
async def bar():
def request():
pass
request() # Ok
def urlopen():
pass
urlopen() # Ok