-
Notifications
You must be signed in to change notification settings - Fork 182
Labels
UserBugs reported by external users that should be prioritisedBugs reported by external users that should be prioritisedpytorch
Description
Describe the Bug
from typing import *
P = ParamSpec("P")
RV = TypeVar("RV", covariant=True)
class CachedMethod(Protocol, Generic[P, RV]):
@staticmethod
def clear_cache(cache: Any) -> None: ...
def __call__(self, *args: P.args, **kwargs: P.kwargs) -> RV: ...
def cache_on_self(fn: Callable[Concatenate[Any, P], RV]) -> CachedMethod[P, RV]:
...
class Foo:
@cache_on_self
def pointwise_read_writes(self): ...
def f(self):
self.pointwise_read_writes.clear_cache(self) # E: ERROR 20:9-47: Object of class `MethodType` has no attribute `clear_cache`This should work as pointwise_read_writes is actually a CachedMethod.
Sandbox Link
(Only applicable for extension issues) IDE Information
No response
Metadata
Metadata
Assignees
Labels
UserBugs reported by external users that should be prioritisedBugs reported by external users that should be prioritisedpytorch