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

Adding asyncio.sleep() to Asyncified function #69

Closed
MementoRC opened this issue Dec 8, 2022 · 1 comment
Closed

Adding asyncio.sleep() to Asyncified function #69

MementoRC opened this issue Dec 8, 2022 · 1 comment

Comments

@MementoRC
Copy link
Contributor

MementoRC commented Dec 8, 2022

I seem to hit a conceptualization issue trying to do this. When I reach the FunctionDef, I look for await statements and if there's none, I want to add asyncio.sleep(0) to the last line, I search in the body and try an InsertAfter the last node of the body, but that errors out

Well, the crude method of adding the Expr at the end of body kinda works, but an empty line is inserted as well and it felt clunky

@MementoRC
Copy link
Contributor Author

Just a bit confused somehow, I simply need to use LazyInsertAfter on the last node then Replace the method. I was creating the new ast.AsyncFunctionDef then had context issues with the LazyInsertAfter

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

No branches or pull requests

1 participant