How to disable mypy error code at package level?

Viewed 1354

variable=[]

Error:

 error: Need type annotation for 'variable' (hint: "variable: List[<type>] = ...")

In config file: mypy.ini

disallow_any_expr=False

Is there any way to override this error by a flag in config file?

1 Answers

You could try this:

  • run mypy --show-error-code your_module.py, which will output the error code inside square brackets
  • in mypy.ini, add disable_error_code = code
Related