-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Provides end_col_offset
for mypy ast nodes (pr proposal)
#12940
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
Comments
Seems useful! We could also use this in mypy itself for giving an output range for errors. |
Hi @JelleZijlstra . Can I start working in a PR to expose that? |
Sure! We'll have to think about how to use this new data in mypy's output and about what to do on mypy 3.6/3.7 where the feature is not yet available. |
For mypy 3.6/3.7 this could be an optional int as well the Regarding the use of this new data, I've made a comment on #12288. I can work in a separate PR for that because I think that changing the report system needs a lot of discussion and also will create much more changes in the codebase than just exposing the What I doing in my project (pyastrx) using the The other thing that I have now using the |
Uh oh!
There was an error while loading. Please reload this page.
I can work and send a PR solving this
Feature
The mypy ast nodes sould have the
end_col_offset
attribute if this information is available in the original python AST nodesPitch
AST nodes from python version 3.8 and up providess the
end_col_offset
attribute. This information can be used to adress some issues in mypy:#12288
#4868
#12513
and also in LibCST
Instagram/LibCST#451
The reason is because the

end_col_offset
allows to associate a section in the source code with the type information.We can latter on implement something similar to pyre query API using this feature.
I working on in a TypeVisitor that represents a MypyFile node as json string (similar to pyre query result), which maybe in the future can be used by
dmypy
.But I need
end_col_offest
to be exposed, currently, I have a local copy of mypy that exposes theend_col_offset
. I can work in a PR to integrate this modification in mypy. I don't think that PR will change so much stuff.The text was updated successfully, but these errors were encountered: