For thoses who need type hint, this code works with pyright
class staticproperty(Generic[GetterReturnType]):
def __init__(self, func: Callable[..., GetterReturnType]):
if isinstance(func, staticmethod):
fget = func
else:
fget = staticmethod(func)
self.fget = fget
def __get__(self, obj, klass=None) -> GetterReturnType:
if klass is None:
klass = type(obj)
return self.fget.__get__(obj, klass)()