diff --git a/stgpytools/types/utils.py b/stgpytools/types/utils.py index d80e412..eea8146 100644 --- a/stgpytools/types/utils.py +++ b/stgpytools/types/utils.py @@ -213,6 +213,15 @@ def clean(cls, function: Callable[Concatenate[T0, P0], R0]) -> inject_self[T0, P inj.clean_kwargs = True return inj # type: ignore + class property(Generic[T0, R0]): + def __init__(self, function: Callable[[T0], R0]) -> None: + self.function = inject_self(function) + + def __get__( + self, class_obj: type[T0] | T0 | None, class_type: type[T0] | type[type[T0]] # type: ignore + ) -> R0: + return self.function.__get__(class_obj, class_type)() + class complex_hash(Generic[T]): """