Closed nikolajsheller closed 2 years ago
This is unfortunate behavior by PyCharm that cannot be solved by nptptying
. I ~am about to release~ just released a patch that would allow you to use extra quotes as follows:
Shape['"*"']
This will appease PyCharm. Though I agree that it looks less attractive, at least it offers you a choice. As I state in the FAQ of the release to come, there is only this option, or the option of accepting the PyCharm complaints... alas.
Thank you for your reply @ramonhagenaars, I think I will go with the extra quote solution. It is very distracting to me when PyCharm complains.
Thank you for your work
There is one other option I forgot to mention. You can also replace Shape
by typing.Literal
, this will silence the PyCharm complaints as well.
If you use an alias, it doesn't look so bad:
from typing import Literal as Shape
s: Shape["*"] # PyCharm is still happy.
The following will run correctly:
But causes PyCharm to issue the syntax error: