@@ -615,8 +615,27 @@ def prepare_class(
615615if sys .version_info >= (3 , 12 ):
616616 def get_original_bases (cls : type , / ) -> tuple [Any , ...]: ...
617617
618- # Actually a different type, but `property` is special and we want that too.
619- DynamicClassAttribute = property
618+ # Does not actually inherit from property, but saying it does makes sure that
619+ # pyright handles this class correctly.
620+ class DynamicClassAttribute (property ):
621+ fget : Callable [[Any ], Any ] | None
622+ fset : Callable [[Any , Any ], object ] | None # type: ignore[assignment]
623+ fdel : Callable [[Any ], object ] | None # type: ignore[assignment]
624+ overwrite_doc : bool
625+ __isabstractmethod__ : bool
626+ def __init__ (
627+ self ,
628+ fget : Callable [[Any ], Any ] | None = None ,
629+ fset : Callable [[Any , Any ], object ] | None = None ,
630+ fdel : Callable [[Any ], object ] | None = None ,
631+ doc : str | None = None ,
632+ ) -> None : ...
633+ def __get__ (self , instance : Any , ownerclass : type | None = None ) -> Any : ...
634+ def __set__ (self , instance : Any , value : Any ) -> None : ...
635+ def __delete__ (self , instance : Any ) -> None : ...
636+ def getter (self , fget : Callable [[Any ], Any ]) -> DynamicClassAttribute : ...
637+ def setter (self , fset : Callable [[Any , Any ], object ]) -> DynamicClassAttribute : ...
638+ def deleter (self , fdel : Callable [[Any ], object ]) -> DynamicClassAttribute : ...
620639
621640_Fn = TypeVar ("_Fn" , bound = Callable [..., object ])
622641_R = TypeVar ("_R" )
0 commit comments