Suppress misleading Foo[...] suggestion for annotations with keyword args by Chessing234 · Pull Request #21179 · python/mypy
Repeating my suggestion from the main issue discussion, since it's also relevant here:
Assuming we can't/won't make calling the function in the annotation just work, if the problem mypy is trying to help you with is that people write Foo(arg=x) when they mean Foo[x], then isn't an additional suggestion called for? Like, keep the note: Suggestion: use Foo[...] instead of Foo(...), but add an additional note: Cannot use named arguments as type arguments. This could even fire orthogonally, as another note on invalid-type, whenever named arguments are used. According to 87f1588 this should be a pretty simple feature to implement. If we can make both of those not appear, and be replaced with note: Can't call a function in a type annotation if mypy determines the call is actually to a function, even better.