mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
(cherry picked from commit 78a127e1a0083ece810ad996124ad6ea65887da2) GitOrigin-RevId: 0c33fe51f5f13116f773577056317c537cbc83ef
20 lines
359 B
Python
20 lines
359 B
Python
from typing import dataclass_transform, TypeVar, Generic
|
|
|
|
T = TypeVar("T")
|
|
|
|
@dataclass_transform()
|
|
def deco(cls):
|
|
...
|
|
|
|
class MyDescriptor(Generic[T]):
|
|
def __set__(self, obj: object, value: T) -> None:
|
|
...
|
|
|
|
@deco
|
|
class MyClass:
|
|
id: MyDescriptor[int]
|
|
name: MyDescriptor[str]
|
|
year: MyDescriptor[int]
|
|
new: MyDescriptor[bool]
|
|
|
|
MyClass(<arg1>) |