@@ -749,32 +749,28 @@ def __del__(self):
749
749
DISPID_COLLECT = - 8
750
750
751
751
752
- if TYPE_CHECKING :
753
- RawGetIDsOfNamesFunc = Callable [
754
- [_byref_type , Array [c_wchar_p ], int , int , Array [DISPID ]],
755
- int ,
756
- ]
757
- RawInvokeFunc = Callable [
758
- [
759
- int ,
760
- _byref_type ,
761
- int ,
762
- int , # dispIdMember, riid, lcid, wFlags
763
- _UnionT [_byref_type , DISPPARAMS ], # *pDispParams
764
- _UnionT [_byref_type , VARIANT ], # pVarResult
765
- _UnionT [_byref_type , EXCEPINFO , None ], # pExcepInfo
766
- _UnionT [_byref_type , c_uint ], # puArgErr
767
- ],
768
- int ,
769
- ]
752
+ RawGetIDsOfNamesFunc = Callable [
753
+ [_byref_type , "Array[c_wchar_p]" , int , int , "Array[DISPID]" ], int
754
+ ]
755
+ # fmt: off
756
+ RawInvokeFunc = Callable [
757
+ [
758
+ int , _byref_type , int , int , # dispIdMember, riid, lcid, wFlags
759
+ _UnionT [_byref_type , DISPPARAMS ], # *pDispParams
760
+ _UnionT [_byref_type , VARIANT ], # pVarResult
761
+ _UnionT [_byref_type , EXCEPINFO , None ], # pExcepInfo
762
+ _UnionT [_byref_type , c_uint ], # puArgErr
763
+ ],
764
+ int ,
765
+ ]
766
+ # fmt: on
770
767
771
768
772
769
class IDispatch (IUnknown ):
773
- if TYPE_CHECKING :
774
- _disp_methods_ : ClassVar [List [comtypes ._DispMemberSpec ]]
775
- _GetTypeInfo : Callable [[int , int ], IUnknown ]
776
- __com_GetIDsOfNames : RawGetIDsOfNamesFunc
777
- __com_Invoke : RawInvokeFunc
770
+ _disp_methods_ : ClassVar [List [comtypes ._DispMemberSpec ]]
771
+ _GetTypeInfo : Callable [[int , int ], IUnknown ]
772
+ __com_GetIDsOfNames : RawGetIDsOfNamesFunc
773
+ __com_Invoke : RawInvokeFunc
778
774
779
775
_iid_ = GUID ("{00020400-0000-0000-C000-000000000046}" )
780
776
_methods_ = [
@@ -811,16 +807,14 @@ class IDispatch(IUnknown):
811
807
),
812
808
]
813
809
814
- def GetTypeInfo (self , index , lcid = 0 ):
815
- # type: (int, int) -> hints.ITypeInfo
810
+ def GetTypeInfo (self , index : int , lcid : int = 0 ) -> "hints.ITypeInfo" :
816
811
"""Return type information. Index 0 specifies typeinfo for IDispatch"""
817
812
import comtypes .typeinfo
818
813
819
814
result = self ._GetTypeInfo (index , lcid )
820
815
return result .QueryInterface (comtypes .typeinfo .ITypeInfo )
821
816
822
- def GetIDsOfNames (self , * names , ** kw ):
823
- # type: (str, Any) -> List[int]
817
+ def GetIDsOfNames (self , * names : str , ** kw : Any ) -> List [int ]:
824
818
"""Map string names to integer ids."""
825
819
lcid = kw .pop ("lcid" , 0 )
826
820
assert not kw
@@ -829,8 +823,7 @@ def GetIDsOfNames(self, *names, **kw):
829
823
self .__com_GetIDsOfNames (riid_null , arr , len (names ), lcid , ids )
830
824
return ids [:]
831
825
832
- def _invoke (self , memid , invkind , lcid , * args ):
833
- # type: (int, int, int, Any) -> Any
826
+ def _invoke (self , memid : int , invkind : int , lcid : int , * args : Any ) -> Any :
834
827
var = VARIANT ()
835
828
argerr = c_uint ()
836
829
dp = DISPPARAMS ()
@@ -850,8 +843,7 @@ def _invoke(self, memid, invkind, lcid, *args):
850
843
self .__com_Invoke (memid , riid_null , lcid , invkind , dp , var , None , argerr )
851
844
return var ._get_value (dynamic = True )
852
845
853
- def Invoke (self , dispid , * args , ** kw ):
854
- # type: (int, Any, Any) -> Any
846
+ def Invoke (self , dispid : int , * args : Any , ** kw : Any ) -> Any :
855
847
"""Invoke a method or property."""
856
848
857
849
# Memory management in Dispatch::Invoke calls:
0 commit comments