equinox
equinox copied to clipboard
AbstractVar implemented as property wrongly appears in default init signature
To be honest, I've mostly avoided this pattern by making things attributes, but, just to report:
import equinox as eqx
class AbstractClass(eqx.Module):
a: eqx.AbstractVar[int]
class MyClass(AbstractClass):
@property
def a(self) -> int:
return 1
# Pyright: Argument missing for parameter a
MyClass() # LSP signature hint: (a: AbstractVar[int]) -> MyClass
Ah, I'm aware of this. The workaround is to explicitly define a custom MyClass.__init__ method. Unfortunately I don't know of a good way to fool the typechecker on this one. (In particular, statically pretending that it is a ClassVar does not work due to https://github.com/microsoft/pyright/issues/4965.)