pyre-check
pyre-check copied to clipboard
How to support the Descriptor Class type check?
class Foo:
def __get__(self, instance, owner) -> str:
...
def __set__(self, instance, value: str) -> None:
...
class Test:
foo = Foo()
test = Test()
test.foo.split() # Undefined attribute [16]: `Foo` has no attribute `split`.
test.foo = 1 # There should be an error.
That is correct, Pyre does not recognize descriptor classes just yet.
On the other hand, Pyre supports properties and @property annotations already, so if your use case is simple enough you might get type coverage that way.
I know that, but my case is ORM which can not be simplified by the @property. I think you can refer to the mypy.
It looks like support was added in https://github.com/facebook/pyre-check/commit/64487f55ce9fba75d894701eb35b23a147743c46. Should this issue be closed out?