Parameterized generics cannot be used with class or instance checks

That looks like a bug in pycharm where it’s a bit overeager in assuming that you’re using the typing module in an unintended way. See this example here where that assumption would have been correct:

enter image description here

The classes in the typing module are only useful in a type annotation context, not to inspect or compare to actual classes, which is what isinstance tries to do. Since pycharm sees a simple object with square brackets that do not contain a literal, it jumps to the wrong conclusion you are seeing.

Your code is fine, you can use it exactly as it is.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)