Skip to content
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

SIM104: Remove false-positives in case the loop is not a direct child of an async function #147

Merged
merged 3 commits into from Jul 28, 2022

Conversation

wyuenho
Copy link
Contributor

@wyuenho wyuenho commented Jul 7, 2022

Not all for loops within a function body is a direct child of the function body

Closes #146

@MartinThoma MartinThoma changed the title Fix #146 make sure the async func def is found SIM104: Remove false-positives in case the loop is not a direct child of an async function Jul 7, 2022
@MartinThoma
Copy link
Owner

Thank you for the PR! The idea is good, but I think you need to add a check on the parent. Maybe you can check isinstance(parent, typing.Callable) to avoid getting up to module level?

@wyuenho
Copy link
Contributor Author

wyuenho commented Jul 7, 2022

isinstance(parent, typing.Callable)

I'm very confused by this comment lol, wut?

BTW, I've fixed the tests, and added one extra.

@MartinThoma MartinThoma merged commit 381fff5 into MartinThoma:master Jul 28, 2022
@MartinThoma
Copy link
Owner

Thank you very much 🤗 I'll make a release in a few minutes

@wyuenho wyuenho deleted the fix_146 branch July 28, 2022 16:58
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.

yield from is not allowed in async function
2 participants