79833105

Date: 2025-11-29 07:19:31
Score: 5
Natty:
Report link

Oops, you're right, thank you. I just assumed this behaviour of "#type: ignore" for some reason, and didn't even check it, shame on me. So, your answer has almost solved my problem. The only issue left is (in case of existing optional_module), mypy gives the following error:


main.py:2: error: Unused "type: ignore" comment  [unused-ignore]
        import optional_module # type: ignore[import-not-found]
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I see it's the result of enabled flag warn_unused_ignores in my config. I can just turn it off, but wouldn't like to do it globally. Is it possible to disable it just for my instance, without altering the global mypy INI file?

Reasons:
  • Blacklisted phrase (0.5): thank you
  • Blacklisted phrase (1): Is it possible to
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
  • Looks like a comment (1):
  • Low reputation (1):
Posted by: Phant