-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Option to disable Python2/comment-style type annotations #13177
Comments
I'd welcome a PR adding an option for this! Also see #12947 and the associated typing-sig discussion |
Yes, please. I run into the same issue where completely innocent comments written for humans are being interpreted by |
Adding some sample code here since I ran across this in my issue. This not only applies to random comments, but also to commented out Python 3 code with PEP 526 type hints. I'm not sure why
|
You are welcome to create a PR implementing this feature. |
I will help work on this |
Can someone please provide some guidance on where in the code base I should look to implement this new feature? I am new to the codebase so any help pointing me in the right direction would be super appreciated! Thanks! |
Could i get some help locating where the syntax is checked for type annotations? |
Probably can be done by making these lines not run and have Lines 364 to 366 in 70d4bb2
|
Added pull request #15068 for this |
Our codebase (all Python3) has a few places where we ended up writing comments that look like
# type: some description ...
prior to adding Mypy. They're usually within a larger multiline comment block when we're describing an expected Dict layout, e.g.Since we're only using Python3 and "proper" type annotations, it'd be nice if we could stop Mypy from trying to parse these types of comments. I know we could change our comment style to use dashes or something else that won't anger Mypy but it's annoying that it's necessary; and honestly colons are the better delimter anyways.
The text was updated successfully, but these errors were encountered: