mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-05-06 21:43:59 +08:00
Decouple types.DynamicClassAttribute from property (#13276)
This commit is contained in:
+21
-2
@@ -615,8 +615,27 @@ def prepare_class(
|
||||
if sys.version_info >= (3, 12):
|
||||
def get_original_bases(cls: type, /) -> tuple[Any, ...]: ...
|
||||
|
||||
# Actually a different type, but `property` is special and we want that too.
|
||||
DynamicClassAttribute = property
|
||||
# Does not actually inherit from property, but saying it does makes sure that
|
||||
# pyright handles this class correctly.
|
||||
class DynamicClassAttribute(property):
|
||||
fget: Callable[[Any], Any] | None
|
||||
fset: Callable[[Any, Any], object] | None # type: ignore[assignment]
|
||||
fdel: Callable[[Any], object] | None # type: ignore[assignment]
|
||||
overwrite_doc: bool
|
||||
__isabstractmethod__: bool
|
||||
def __init__(
|
||||
self,
|
||||
fget: Callable[[Any], Any] | None = None,
|
||||
fset: Callable[[Any, Any], object] | None = None,
|
||||
fdel: Callable[[Any], object] | None = None,
|
||||
doc: str | None = None,
|
||||
) -> None: ...
|
||||
def __get__(self, instance: Any, ownerclass: type | None = None) -> Any: ...
|
||||
def __set__(self, instance: Any, value: Any) -> None: ...
|
||||
def __delete__(self, instance: Any) -> None: ...
|
||||
def getter(self, fget: Callable[[Any], Any]) -> DynamicClassAttribute: ...
|
||||
def setter(self, fset: Callable[[Any, Any], object]) -> DynamicClassAttribute: ...
|
||||
def deleter(self, fdel: Callable[[Any], object]) -> DynamicClassAttribute: ...
|
||||
|
||||
_Fn = TypeVar("_Fn", bound=Callable[..., object])
|
||||
_R = TypeVar("_R")
|
||||
|
||||
Reference in New Issue
Block a user