enthought / enthought/comtypes
modernize and add annotation to `_compointer_base.value`
- Dominant language
- Python
- Stars
- 345
- Forks
- 105
- PR merge metrics
- No merged PRs in 30d
Description
This is the old `property` style.
https://github.com/enthought/comtypes/blob/4cbdb03b31583c6a974dd690d38f1abe69767dda/comtypes/_post_coinit/unknwn.py#L441-L445
This should be changed to the modern style with additional import sections.
```diff
from comtypes._memberspec import _ComMemberSpec, _DispMemberSpec
from comtypes._py_instance_method import instancemethod
+if TYPE_CHECKING:
+ from comtypes import hints # type: ignore
+
```
```diff
# redefine the .value property; return the object itself.
- def __get_value(self):
+ @property
+ def value(self) -> "hints.Self":
+ """Return self."""
return self
- value = property(__get_value, doc="""Return self.""")
-
```
`_compointer_base`, as its name implies, is the base class for `POINTER(IUnknown)` by metaclasses.
So, when returning `self`, it returns a `POINTER(IUnknown)` instance.
This is a 'GOOD FIRST ISSUE' because it requires only a few modifications to the code.
Contributor guide
Assessment
This issue has not been assessed yet.