You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
option no-implicit-optional ignored as inline configuration and per-module flags #8029
run.py:4: error: Unsupported operand types for + ("int" and "None")
run.py:4: note: Right operand is of type "Optional[int]"
… but I would expect to get the more clear
run.py:3: error: Incompatible default for argument "b" (default has type "None", argument has type "int")
… because the inline config "no-implicit-optional" is set. It is the same if I have a per file/moule section in my mypy.ini, but it works i if define it globally (in [mypy] section) or via command line switch.
Hm, interesting. It seems to me this may be related to #7773. In particular, it seems to me logic of definition of --no-implicit-optional in mypy/main.py should match that of --no-warn-no-return.
Also this is one of only two flags that have no_ prefix in mypy/options.py and both suffer from #7773.
@ilevkivskyi I was able to reproduce the scenario mentioned by @efenka :
I also saw #7773 issue. I guess the "unrecognized options" error is being produced because the options which cause those errors are not defined in mypy/options.py or are defined with different names ?
However I don't understand what you meant by this:
In particular, it seems to me logic of definition of --no-implicit-optional in mypy/main.py should match that of --no-warn-no-return
Did you mean to change line 548 in mypy/main.py: add_invertible_flag('--no-implicit-optional', default=False, strict_flag=True, help="Don't assume arguments with default values of None are Optional", group=none_group)
to match line 570 in mypy/main.py:
add_invertible_flag('--no-warn-no-return', dest='warn_no_return', default=True, help="Do not warn about functions that end without returning", group=lint_group)
@ilevkivskyi I saw your comment on no_* settings. I'm involved in the --no-site-packages issue #7768 (PR: #8524) and to do that I've added no_site_packages to options.py. I suspect if your intuition comes out to be true, my contribution there might influence it.
I will look into this issue further Wednesday, so any other information might come in handy.
Activity
ilevkivskyi commentedon Nov 28, 2019
Hm, interesting. It seems to me this may be related to #7773. In particular, it seems to me logic of definition of
--no-implicit-optionalinmypy/main.pyshould match that of--no-warn-no-return.Also this is one of only two flags that have
no_prefix inmypy/options.pyand both suffer from #7773.MrRaval17 commentedon Mar 11, 2020
@ilevkivskyi I was able to reproduce the scenario mentioned by @efenka :

I also saw #7773 issue. I guess the "unrecognized options" error is being produced because the options which cause those errors are not defined in mypy/options.py or are defined with different names ?
However I don't understand what you meant by this:
Did you mean to change line 548 in mypy/main.py:
add_invertible_flag('--no-implicit-optional', default=False, strict_flag=True, help="Don't assume arguments with default values of None are Optional", group=none_group)to match line 570 in mypy/main.py:
add_invertible_flag('--no-warn-no-return', dest='warn_no_return', default=True, help="Do not warn about functions that end without returning", group=lint_group)davidzwa commentedon Mar 17, 2020
@ilevkivskyi I saw your comment on
no_*settings. I'm involved in the --no-site-packages issue #7768 (PR: #8524) and to do that I've addedno_site_packagesto options.py. I suspect if your intuition comes out to be true, my contribution there might influence it.I will look into this issue further Wednesday, so any other information might come in handy.
srbhss commentedon Mar 29, 2021
Hey @ilevkivskyi, I would like to work on this issue. Please assign me this one.
ilevkivskyi commentedon Mar 29, 2021
@srbhss OK, note however I may not have time to review your PR, but others might have.
odesenfans commentedon Jul 16, 2022
This issue appears to be fixed in mypy 0.961.
hauntsaninja commentedon Jan 1, 2023
Looks like it got fixed a long time ago, somewhere between 0.780 and 0.790