Currently the following code will infer type Any for Foo().bar, although it should infer type str:
from werkzeug.utils import cached_property
class Foo:
@cached_property
def bar(self) -> str:
return ""
reveal_type(Foo().bar)
Making class cached_property generic over the value solves this problem and corrects the type of a few fields like Request.base_url. I have a PR ready for this that actually removes a few instances of # type: ignore in werkzeug code (although it adds two new ones.)
Currently the following code will infer type
AnyforFoo().bar, although it should infer typestr:Making
class cached_propertygeneric over the value solves this problem and corrects the type of a few fields likeRequest.base_url. I have a PR ready for this that actually removes a few instances of# type: ignorein werkzeug code (although it adds two new ones.)