Files
divkit/json-builder/python/pydivkit/core/compat.py
T
p-mosein 2987d93ba7 pydivkit. migrate to uv+hatch, decompose entities.py, fix Python 3.14 compat
commit_hash:cf5070a543788fa57136adb1a4a7ea42f4490329
2026-02-10 16:34:59 +03:00

19 lines
444 B
Python

from typing import Any, Callable, Generic, Type, TypeVar
T = TypeVar("T")
V = TypeVar("V")
# noinspection PyPep8Naming
class classproperty(Generic[T, V]):
"""mypy friendly classproperty"""
def __init__(self, getter: Callable[[Type[T]], V]) -> None:
self.getter = getattr(getter, "__func__", getter)
def __get__(self, instance: Any, owner: Type[T]) -> V:
return self.getter(owner)
__all__ = ("classproperty",)