Describe the bug
I have a generic parent class with a property, when I then try to subclass this PyRight fails to find this property.
To Reproduce
See the following code:
from typing import Callable, Generic
from typing_extensions import ParamSpec
P = ParamSpec('P')
class Hider(Generic[P]):
"""Hide a callable under a property."""
__hidden: Callable[P, None]
def __init__(self, value: Callable[P, None]) -> None:
self.value = value
@property
def value(self) -> Callable[P, None]:
return self.__hidden
@value.setter
def value(self, function: Callable[P, None]) -> None:
self.__hidden = function
O = ParamSpec('O')
class Revealer(Hider[O]):
def compare(self, func: Callable[O, None]) -> bool:
"""Compare the names with the hidden callable."""
print(dir(self))
return self.value.__name__ == func.__name__ # Cannot access member "value" for type "Revealer[O@Revealer]"
Expected behavior
When I run this it in-fact works, so I would expect PyRight to let this pass as well.
VS Code extension or command-line
Released on
22/03/2019, 04:10:23
Last updated
25/09/2021, 06:09:18
Identifier
ms-pyright.pyright
Additional contextParamSpec is being imported from typing_extensions.
When I remove the variable and just inherit from Hider (class Revealer(Hider):) it works. When I change it from being a property it also works.
Describe the bug I have a generic parent class with a property, when I then try to subclass this PyRight fails to find this property.
To Reproduce See the following code:
Expected behavior When I run this it in-fact works, so I would expect PyRight to let this pass as well.
VS Code extension or command-line
Additional context
ParamSpec
is being imported fromtyping_extensions
.When I remove the variable and just inherit from
Hider
(class Revealer(Hider):
) it works. When I change it from being a property it also works.