Skip to content

add trio.as_safe_channel to async900 safe decorators #374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2025

Conversation

jakkdl
Copy link
Member

@jakkdl jakkdl commented Apr 29, 2025

fixes #370
I thought this was gonna be a one-line fix, but ended up getting really messy. There's definitely a cleaner way of implementing this, but it should work... 🙃

The reason it gets messy is because has_decorator->_get_identifier only matches against the last part of an attribute, but I want trio.as_safe_decorator in the error message, so the message and the implementation gets a mismatch. The main alternative approach would be to have separate lists of decorators for the error message and the logic.

Copy link
Member

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@Zac-HD
Copy link
Member

Zac-HD commented Apr 29, 2025

@agronholm might want to add a similar decorator to anyio too, but if so that can be a future PR for flake8-async 🙂

@Zac-HD Zac-HD merged commit 2fdaff1 into python-trio:main Apr 29, 2025
11 checks passed
@jakkdl jakkdl deleted the async900_as_safe_channel branch April 30, 2025 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

suggest @as_safe_channel in ASYNC900
2 participants