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

Support for inline disable_error_code #10279

Closed
DevilXD opened this issue Apr 4, 2021 · 2 comments
Closed

Support for inline disable_error_code #10279

DevilXD opened this issue Apr 4, 2021 · 2 comments
Labels

Comments

@DevilXD
Copy link

DevilXD commented Apr 4, 2021

Feature

Unless I'm doing something wrong, this appears to be currently not supported (or broken):

# mypy: disable_error_code = misc

import ...
# <rest_of_the_file>

Pitch

Most other flags, work with a comment like that. This one doesn't appear so, and I'm not sure if this should be a feature request or a bug report. Constructions I tried:

# mypy: disable_error_code = misc
# mypy: disable_error_code = "misc"
# mypy: disable_error_code=misc
# mypy: disable_error_code="misc"
# mypy: disable_error_code misc  # Unrecognized option: disable_error_code misc = True
# mypy: disable_error_code "misc"  # Unrecognized option: disable_error_code misc = True
# mypy: disable_error_code: misc  # Unrecognized option: disable_error_code: misc = True
# mypy: disable_error_code: "misc"  # Unrecognized option: disable_error_code: misc = True

The first 4 do not produce an error, but also do not work: I'm still getting error: Self argument missing for a non-static method (or an invalid type for self) [misc] on the lines where I'd want that ignored. The file has 10+ of those, so I figured it'd be better to just disable them in the entire file, instead of "littering" the code with # type: ignore[misc].

Python: 3.8.8
Checked both, PyPi release of mypy-0.812, and the current master of mypy-0.820+dev.2a43cb95a194fa5d43d2e094be4be8e88e48f3ef

@hauntsaninja
Copy link
Collaborator

https://mypy.readthedocs.io/en/stable/error_codes.html

@JukkaL
Copy link
Collaborator

JukkaL commented Apr 13, 2021

#9440 is related.

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

No branches or pull requests

3 participants