-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
decouple types.DynamicClassAttribute from property #13276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
03cc7f8
44c28b4
a4e5f7f
6c0b1ce
5f62e26
4d7f932
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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], None] | None | ||
| fdel: Callable[[Any], None] | None | ||
| overwrite_doc: bool | ||
| __isabstractmethod__: bool | ||
| def __init__( | ||
| self, | ||
| fget: Callable[[Any], Any] | None = None, | ||
| fset: Callable[[Any, Any], None] | None = None, | ||
| fdel: Callable[[Any], None] | None = None, | ||
tungol marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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], None]) -> DynamicClassAttribute: ... | ||
|
||
| def deleter(self, fdel: Callable[[Any], None]) -> DynamicClassAttribute: ... | ||
tungol marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| _Fn = TypeVar("_Fn", bound=Callable[..., object]) | ||
| _R = TypeVar("_R") | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.