python-trio / flake8-async

Highly opinionated linter for Trio code
https://flake8-async.readthedocs.io
MIT License
17 stars 2 forks source link

Don't raise `TRIO200` if the call is immediately awaited #85

Closed Zac-HD closed 1 year ago

Zac-HD commented 1 year ago

One thing I just tried was configuring websocket.* as a known-sync call, in order to suggest https://pypi.org/project/trio-websocket/ over https://pypi.org/project/websocket/

But then it turns out that quite naturally we've used websocket as a variable name for a... websocket... and then we get a lint error on e.g. message = await websocket.get_message(). One option is to go through and rename each such instance to e.g. ws, but another would be to avoid emitting TRIO200 if the call is immediately awaited, because in these cases it's clearly not a blocking sync call after all.