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 ignore not working with Black #7762

Closed
IIBenII opened this issue Oct 21, 2019 · 1 comment
Closed

Type ignore not working with Black #7762

IIBenII opened this issue Oct 21, 2019 · 1 comment

Comments

@IIBenII
Copy link

IIBenII commented Oct 21, 2019

I have a this code:

while self.get_task_status(session, task_id)["progress"] < 1:  # type: ignore
   time.sleep(60)

when I launch black this code become:

while (
    self.get_task_status(session, task_id)["progress"] < 1
):  # type: ignore
   time.sleep(60)

When # type: ignore is on multiple line mypy ignore it and raise an error Unsupported operand types for < (\"str\" and \"int\")

I'm using mypy 0.74 on python 3.7.4
Mypy is launch with --ignore-missing-imports --follow-imports=silent --show-column-numbers

Thanks for your help :)

@emmatyping
Copy link
Collaborator

This is an error in Black. In general, type ignores are per-line, and Black should not move them. In this case, the type ignore is on a different line after formatting, so the error is no longer ignored.

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

2 participants