Skip to content

Commit

Permalink
Add type hints to class variables and instance variables of COMObject.
Browse files Browse the repository at this point in the history
  • Loading branch information
junkmd committed Dec 17, 2024
1 parent 3f38d57 commit dccc1c7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions comtypes/_comobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
Callable,
ClassVar,
Dict,
List,
Optional,
Sequence,
Tuple,
Expand All @@ -45,7 +46,7 @@
from comtypes.typeinfo import IProvideClassInfo, IProvideClassInfo2

if TYPE_CHECKING:
from ctypes import _FuncPointer
from ctypes import _FuncPointer, _Pointer

from comtypes import hints # type: ignore
from comtypes._memberspec import _ParamFlagType
Expand Down Expand Up @@ -452,9 +453,13 @@ def DllCanUnloadNow(self) -> int:


class COMObject(object):
_com_interfaces_: ClassVar[List[Type[IUnknown]]]
_instances_: ClassVar[Dict["COMObject", None]] = {}
_reg_clsid_: ClassVar[GUID]
_reg_typelib_: ClassVar[Tuple[str, int, int]]
__typelib: "hints.ITypeLib"
_com_pointers_: Dict[GUID, "_Pointer[_Pointer[Structure]]"]
_dispimpl_: Dict[Tuple[int, int], Callable[..., Any]]

def __new__(cls, *args, **kw):
self = super(COMObject, cls).__new__(cls)
Expand Down Expand Up @@ -610,7 +615,7 @@ def _get_method_finder_(self, itf):

################################################################
# LocalServer / InprocServer stuff
__server__ = None
__server__: Union[None, InprocServer, LocalServer] = None

@staticmethod
def __run_inprocserver__():
Expand Down

0 comments on commit dccc1c7

Please sign in to comment.