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

C419 autofix can remove comment #4094

Closed
Skylion007 opened this issue Apr 25, 2023 · 3 comments · Fixed by #4099
Closed

C419 autofix can remove comment #4094

Skylion007 opened this issue Apr 25, 2023 · 3 comments · Fixed by #4099
Assignees
Labels
bug Something isn't working

Comments

@Skylion007
Copy link
Contributor

Skylion007 commented Apr 25, 2023

We did a large change of the PyTorch codebase with ruff in pytorch/pytorch#99890 by enabling C419 with autofixes. It mostly worked out of the box, but we did have to add back in one type comment for mypy that got deleted by the autofix: pytorch/pytorch@ad98f63

@charliermarsh charliermarsh added the bug Something isn't working label Apr 25, 2023
@charliermarsh
Copy link
Member

👍 Thanks. We preserve some comments in the comprehension fixes, but clearly not that one :)

@dhruvmanila
Copy link
Member

I can pick this up, wanted to get into CST :)

@dhruvmanila
Copy link
Member

Ok, so it seems like we're not copying over the lbracket and rbracket fields from the ListComp node. Now, this is a challenge as we need to convert it into a GeneratorExp which only has the lpar and rpar fields. We'll need to pick the required parts from the Bracket nodes into the Parenthesis nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants