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

Type comment left in place when expression is type ignored #34

Closed
PeterJCLaw opened this issue Mar 7, 2021 · 1 comment · Fixed by #35
Closed

Type comment left in place when expression is type ignored #34

PeterJCLaw opened this issue Mar 7, 2021 · 1 comment · Fixed by #35

Comments

@PeterJCLaw
Copy link

Thanks for this tool, it's really useful :)

If you have code like this:

    foo = object()

    bar = (
        # Comment which explains why this ignored
        foo.quox   # type: ignore[attribute]
    )  # type: Mapping[str, Distribution]

Then after running com2ann you end up with:

    foo = object()

    bar: Mapping[str, int] = (
        # Comment which explains why this ignored
        foo.quox   # type: ignore[attribute]
    )  # type: Mapping[str, int]

which mypy then complains about due to the double signature.

The intermediate (explanatory) comment doesn't seem to be related, though the type: ignore comment is.

@ilevkivskyi
Copy link
Owner

Thanks, should be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants