Open clokep opened 12 months ago
I think we might need to expand the plugin to update the information when these sorts of methods are access as attributes instead of just when they're called as methods. mypy has other hooks we can use, but we need to be careful:
CachedDescriptor
(so that it has the invalidate
method, etc.)
If a method that is wrapped in
@cached
is passed into another function, e.g.run_in_background
then the type information is incorrect; the current mypy plugin only updates the type information when it is called as a method, not when it is accessed as an attribute.E.g. from #16590:
The method is not getting treated as bound (and there might be other issues too).