comtypes 1.4.5__zip → 1.4.6__zip
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {comtypes-1.4.5 → comtypes-1.4.6}/CHANGES.txt +12 -0
- {comtypes-1.4.5/comtypes.egg-info → comtypes-1.4.6}/PKG-INFO +1 -1
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/GUID.py +24 -24
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/__init__.py +1 -1
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/_memberspec.py +4 -12
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/automation.py +12 -39
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/client/__init__.py +2 -9
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/client/_code_cache.py +2 -2
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/hints.pyi +6 -18
- comtypes-1.4.6/comtypes/test/test_recordinfo.py +79 -0
- comtypes-1.4.6/comtypes/test/test_typeannotator.py +127 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/tools/codegenerator/codegenerator.py +0 -1
- comtypes-1.4.6/comtypes/tools/codegenerator/modulenamer.py +23 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/tools/codegenerator/typeannotator.py +27 -22
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/tools/tlbparser.py +22 -24
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/tools/typedesc_base.py +2 -8
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/typeinfo.py +33 -35
- {comtypes-1.4.5 → comtypes-1.4.6/comtypes.egg-info}/PKG-INFO +1 -1
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes.egg-info/SOURCES.txt +2 -0
- comtypes-1.4.5/comtypes/tools/codegenerator/modulenamer.py +0 -24
- {comtypes-1.4.5 → comtypes-1.4.6}/LICENSE.txt +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/MANIFEST.in +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/README.md +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/_comobject.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/_idl_stuff.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/_meta.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/_npsupport.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/_post_coinit/__init__.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/_post_coinit/bstr.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/_post_coinit/misc.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/_post_coinit/unknwn.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/_py_instance_method.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/_safearray.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/_tlib_version_checker.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/clear_cache.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/client/_constants.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/client/_events.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/client/_generate.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/client/dynamic.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/client/lazybind.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/connectionpoints.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/errorinfo.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/git.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/hresult.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/logutil.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/messageloop.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/patcher.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/persist.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/safearray.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/server/__init__.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/server/automation.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/server/connectionpoints.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/server/inprocserver.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/server/localserver.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/server/register.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/server/w_getopt.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/shelllink.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/stream.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/TestComServer.idl +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/TestComServer.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/TestComServer.tlb +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/TestDispServer.idl +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/TestDispServer.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/TestDispServer.tlb +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/__init__.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/find_memleak.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/mylib.idl +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/mylib.tlb +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/mytypelib.idl +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/runtests.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/setup.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_BSTR.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_DISPPARAMS.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_GUID.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_QueryService.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_agilent.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_avmc.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_basic.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_casesensitivity.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_clear_cache.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_client.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_client_dynamic.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_client_regenerate_modules.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_collections.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_comserver.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_createwrappers.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_dict.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_dispifc_records.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_dispifc_safearrays.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_dispinterface.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_dyndispatch.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_excel.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_findgendir.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_getactiveobj.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_ie.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_ienum.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_imfattributes.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_inout_args.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_istream.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_jscript.js +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_midl_safearray_create.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_msscript.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_npsupport.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_outparam.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_propputref.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_pump_events.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_safearray.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_sapi.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_server.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_showevents.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_subinterface.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_typeinfo.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_urlhistory.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_variant.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_win32com_interop.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_wmi.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/test_word.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/test/urlhist.tlb +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/tools/__init__.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/tools/codegenerator/__init__.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/tools/codegenerator/helpers.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/tools/codegenerator/namespaces.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/tools/codegenerator/packing.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/tools/typedesc.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/util.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes/viewobject.py +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes.egg-info/dependency_links.txt +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes.egg-info/entry_points.txt +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/comtypes.egg-info/top_level.txt +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/pyproject.toml +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/setup.cfg +0 -0
- {comtypes-1.4.5 → comtypes-1.4.6}/setup.py +0 -0
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import abc
|
|
2
2
|
import keyword
|
|
3
|
-
from typing import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
Generic,
|
|
7
|
-
Iterable,
|
|
8
|
-
Iterator,
|
|
9
|
-
List,
|
|
10
|
-
Optional,
|
|
11
|
-
Sequence,
|
|
12
|
-
Tuple,
|
|
13
|
-
TYPE_CHECKING,
|
|
14
|
-
TypeVar,
|
|
15
|
-
)
|
|
3
|
+
from typing import Any, Generic, TypeVar, TYPE_CHECKING
|
|
4
|
+
from typing import Dict, List, Optional, Sequence, Tuple
|
|
5
|
+
from typing import Iterable, Iterator
|
|
16
6
|
|
|
17
7
|
from comtypes.tools import typedesc
|
|
18
8
|
|
|
@@ -124,6 +114,8 @@ class _MethodsAnnotator(abc.ABC, Generic[_T_MTD]):
|
|
|
124
114
|
content = f"{mem_name} = hints.named_property('{mem_name}', fset={setter})"
|
|
125
115
|
else:
|
|
126
116
|
return
|
|
117
|
+
if keyword.iskeyword(mem_name):
|
|
118
|
+
content = f"pass # avoid using a keyword for {content}"
|
|
127
119
|
self._define_member(content)
|
|
128
120
|
|
|
129
121
|
def _define_normal_prop(
|
|
@@ -137,6 +129,8 @@ class _MethodsAnnotator(abc.ABC, Generic[_T_MTD]):
|
|
|
137
129
|
content = f"{mem_name} = hints.normal_property(fset={setter})"
|
|
138
130
|
else:
|
|
139
131
|
return
|
|
132
|
+
if keyword.iskeyword(mem_name):
|
|
133
|
+
content = f"pass # avoid using a keyword for {content}"
|
|
140
134
|
self._define_member(content)
|
|
141
135
|
|
|
142
136
|
def _define_member(self, content: str) -> None:
|
|
@@ -242,14 +236,14 @@ class ComMethodAnnotator(_MethodAnnotator[typedesc.ComMethod]):
|
|
|
242
236
|
has_optional = False
|
|
243
237
|
for _, argname, default in self.inarg_specs:
|
|
244
238
|
if keyword.iskeyword(argname):
|
|
245
|
-
inargs = ["*args: Any", "**kwargs: Any"]
|
|
239
|
+
inargs = ["*args: hints.Any", "**kwargs: hints.Any"]
|
|
246
240
|
break
|
|
247
241
|
if default is None:
|
|
248
242
|
if has_optional:
|
|
249
243
|
# probably propput or propputref
|
|
250
244
|
# HACK: Something that goes into this conditional branch
|
|
251
245
|
# should be a special callback.
|
|
252
|
-
inargs.append("**kwargs: Any")
|
|
246
|
+
inargs.append("**kwargs: hints.Any")
|
|
253
247
|
break
|
|
254
248
|
inargs.append(f"{argname}: hints.Incomplete")
|
|
255
249
|
else:
|
|
@@ -261,9 +255,12 @@ class ComMethodAnnotator(_MethodAnnotator[typedesc.ComMethod]):
|
|
|
261
255
|
elif len(outargs) == 1:
|
|
262
256
|
out = outargs[0]
|
|
263
257
|
else:
|
|
264
|
-
out = "Tuple[" + ", ".join(outargs) + "]"
|
|
258
|
+
out = "hints.Tuple[" + ", ".join(outargs) + "]"
|
|
265
259
|
in_ = ("self, " + ", ".join(inargs)) if inargs else "self"
|
|
266
|
-
|
|
260
|
+
content = f"def {name}({in_}) -> {out}: ..."
|
|
261
|
+
if keyword.iskeyword(name):
|
|
262
|
+
content = f"pass # avoid using a keyword for {content}"
|
|
263
|
+
return content
|
|
267
264
|
|
|
268
265
|
|
|
269
266
|
class ComMethodsAnnotator(_MethodsAnnotator[typedesc.ComMethod]):
|
|
@@ -285,14 +282,14 @@ class DispMethodAnnotator(_MethodAnnotator[typedesc.DispMethod]):
|
|
|
285
282
|
has_optional = False
|
|
286
283
|
for _, argname, default in self.inarg_specs:
|
|
287
284
|
if keyword.iskeyword(argname):
|
|
288
|
-
inargs = ["*args: Any", "**kwargs: Any"]
|
|
285
|
+
inargs = ["*args: hints.Any", "**kwargs: hints.Any"]
|
|
289
286
|
break
|
|
290
287
|
if default is None:
|
|
291
288
|
if has_optional:
|
|
292
289
|
# probably propput or propputref
|
|
293
290
|
# HACK: Something that goes into this conditional branch
|
|
294
291
|
# should be a special callback.
|
|
295
|
-
inargs.append("**kwargs: Any")
|
|
292
|
+
inargs.append("**kwargs: hints.Any")
|
|
296
293
|
break
|
|
297
294
|
inargs.append(f"{argname}: hints.Incomplete")
|
|
298
295
|
else:
|
|
@@ -300,7 +297,10 @@ class DispMethodAnnotator(_MethodAnnotator[typedesc.DispMethod]):
|
|
|
300
297
|
has_optional = True
|
|
301
298
|
out = _to_outtype(self.method.returns)
|
|
302
299
|
in_ = ("self, " + ", ".join(inargs)) if inargs else "self"
|
|
303
|
-
|
|
300
|
+
content = f"def {name}({in_}) -> {out}: ..."
|
|
301
|
+
if keyword.iskeyword(name):
|
|
302
|
+
content = f"pass # avoid using a keyword for {content}"
|
|
303
|
+
return content
|
|
304
304
|
|
|
305
305
|
|
|
306
306
|
class DispMethodsAnnotator(_MethodsAnnotator[typedesc.DispMethod]):
|
|
@@ -328,9 +328,14 @@ class DispInterfaceMembersAnnotator(object):
|
|
|
328
328
|
props, methods = self._categorize_members()
|
|
329
329
|
property_lines: List[str] = []
|
|
330
330
|
for mem in props:
|
|
331
|
-
property_lines.append("@property # dispprop")
|
|
332
331
|
out = _to_outtype(mem.typ)
|
|
333
|
-
|
|
332
|
+
decorator = "@property # dispprop"
|
|
333
|
+
content = f"def {mem.name}(self) -> {out}: ..."
|
|
334
|
+
if keyword.iskeyword(mem.name):
|
|
335
|
+
decorator = f"pass # {decorator}"
|
|
336
|
+
content = f"pass # avoid using a keyword for {content}"
|
|
337
|
+
property_lines.append(decorator)
|
|
338
|
+
property_lines.append(content)
|
|
334
339
|
dispprops = "\n".join(f" {p}" for p in property_lines)
|
|
335
340
|
dispmethods = DispMethodsAnnotator().generate(methods)
|
|
336
341
|
return "\n".join(d for d in (dispprops, dispmethods) if d)
|
|
@@ -298,27 +298,25 @@ class Parser(object):
|
|
|
298
298
|
names = tinfo.GetNames(fd.memid, fd.cParams + 1)
|
|
299
299
|
names.append("rhs")
|
|
300
300
|
names = names[: fd.cParams + 1]
|
|
301
|
+
# function name first, then parameter names
|
|
301
302
|
assert len(names) == fd.cParams + 1
|
|
302
303
|
flags = self.func_flags(fd.wFuncFlags)
|
|
303
304
|
flags += self.inv_kind(fd.invkind)
|
|
304
305
|
mth = typedesc.ComMethod(
|
|
305
306
|
fd.invkind, fd.memid, func_name, returns, flags, func_doc
|
|
306
307
|
)
|
|
307
|
-
for
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
for j in range(fd.cParams):
|
|
309
|
+
elemdesc = fd.lprgelemdescParam[j]
|
|
310
|
+
typ = self.make_type(elemdesc.tdesc, tinfo)
|
|
311
|
+
name = names[j + 1]
|
|
312
|
+
paramdesc = elemdesc._.paramdesc
|
|
313
|
+
if paramdesc.wParamFlags & typeinfo.PARAMFLAG_FHASDEFAULT:
|
|
312
314
|
# XXX should be handled by VARIANT itself
|
|
313
|
-
|
|
314
|
-
fd.lprgelemdescParam[p]
|
|
315
|
-
._.paramdesc.pparamdescex[0]
|
|
316
|
-
.varDefaultValue
|
|
317
|
-
)
|
|
318
|
-
default: Any = var.value
|
|
315
|
+
default: Any = paramdesc.pparamdescex[0].varDefaultValue.value
|
|
319
316
|
else:
|
|
320
317
|
default = None
|
|
321
|
-
|
|
318
|
+
param_flags = self.param_flags(paramdesc.wParamFlags)
|
|
319
|
+
mth.add_argument(typ, name, param_flags, default)
|
|
322
320
|
members.append((fd.oVft, mth))
|
|
323
321
|
# Sort the methods by oVft (VTable offset): Some typeinfo
|
|
324
322
|
# don't list methods in VTable order.
|
|
@@ -386,25 +384,25 @@ class Parser(object):
|
|
|
386
384
|
names = tinfo.GetNames(fd.memid, fd.cParams + 1)
|
|
387
385
|
names.append("rhs")
|
|
388
386
|
names = names[: fd.cParams + 1]
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
) # function name first, then parameter names
|
|
387
|
+
# function name first, then parameter names
|
|
388
|
+
assert len(names) == fd.cParams + 1
|
|
392
389
|
flags = self.func_flags(fd.wFuncFlags)
|
|
393
390
|
flags += self.inv_kind(fd.invkind)
|
|
394
391
|
mth = typedesc.DispMethod(
|
|
395
392
|
fd.memid, fd.invkind, func_name, returns, flags, func_doc
|
|
396
393
|
)
|
|
397
|
-
for
|
|
398
|
-
|
|
399
|
-
typ = self.make_type(
|
|
400
|
-
name = names[
|
|
401
|
-
|
|
402
|
-
if
|
|
403
|
-
|
|
404
|
-
default: Any =
|
|
394
|
+
for j in range(fd.cParams):
|
|
395
|
+
elemdesc = fd.lprgelemdescParam[j]
|
|
396
|
+
typ = self.make_type(elemdesc.tdesc, tinfo)
|
|
397
|
+
name = names[j + 1]
|
|
398
|
+
paramdesc = elemdesc._.paramdesc
|
|
399
|
+
if paramdesc.wParamFlags & typeinfo.PARAMFLAG_FHASDEFAULT:
|
|
400
|
+
# XXX should be handled by VARIANT itself
|
|
401
|
+
default: Any = paramdesc.pparamdescex[0].varDefaultValue.value
|
|
405
402
|
else:
|
|
406
403
|
default = None
|
|
407
|
-
|
|
404
|
+
param_flags = self.param_flags(paramdesc.wParamFlags)
|
|
405
|
+
mth.add_argument(typ, name, param_flags, default)
|
|
408
406
|
itf.add_member(mth)
|
|
409
407
|
return itf
|
|
410
408
|
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
# typedesc.py - classes representing C type descriptions
|
|
2
|
-
from typing import
|
|
3
|
-
|
|
4
|
-
List,
|
|
5
|
-
Optional,
|
|
6
|
-
Tuple,
|
|
7
|
-
Union as _UnionT,
|
|
8
|
-
SupportsInt,
|
|
9
|
-
)
|
|
2
|
+
from typing import Any, SupportsInt
|
|
3
|
+
from typing import List, Optional, Tuple, Union as _UnionT
|
|
10
4
|
|
|
11
5
|
import comtypes
|
|
12
6
|
|
|
@@ -5,45 +5,22 @@
|
|
|
5
5
|
# then hacked manually
|
|
6
6
|
import os
|
|
7
7
|
import sys
|
|
8
|
-
from typing import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Optional,
|
|
13
|
-
overload,
|
|
14
|
-
Sequence,
|
|
15
|
-
Type,
|
|
16
|
-
TypeVar,
|
|
17
|
-
Tuple,
|
|
18
|
-
Union as _UnionT,
|
|
19
|
-
)
|
|
8
|
+
from typing import Any, overload, TypeVar, TYPE_CHECKING
|
|
9
|
+
from typing import List, Type, Tuple
|
|
10
|
+
from typing import Optional, Union as _UnionT
|
|
11
|
+
from typing import Callable, Sequence
|
|
20
12
|
import weakref
|
|
21
13
|
|
|
22
14
|
import ctypes
|
|
23
15
|
from ctypes import HRESULT, POINTER, _Pointer, byref, c_int, c_void_p, c_wchar_p
|
|
24
16
|
from ctypes.wintypes import DWORD, LONG, UINT, ULONG, WCHAR, WORD
|
|
25
|
-
from comtypes import
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
IUnknown,
|
|
33
|
-
STDMETHOD,
|
|
34
|
-
TYPE_CHECKING,
|
|
35
|
-
)
|
|
36
|
-
from comtypes.automation import (
|
|
37
|
-
DISPID,
|
|
38
|
-
DISPPARAMS,
|
|
39
|
-
EXCEPINFO,
|
|
40
|
-
LCID,
|
|
41
|
-
SCODE,
|
|
42
|
-
VARIANT,
|
|
43
|
-
VARIANTARG,
|
|
44
|
-
VARTYPE,
|
|
45
|
-
tagVARIANT,
|
|
46
|
-
)
|
|
17
|
+
from comtypes import BSTR, _CData, COMMETHOD, _GUID, GUID, IID, IUnknown, STDMETHOD
|
|
18
|
+
from comtypes.automation import DISPID, LCID, SCODE
|
|
19
|
+
from comtypes.automation import DISPPARAMS, EXCEPINFO, VARIANT, VARIANTARG, VARTYPE
|
|
20
|
+
|
|
21
|
+
if TYPE_CHECKING:
|
|
22
|
+
from comtypes import hints # type: ignore
|
|
23
|
+
|
|
47
24
|
|
|
48
25
|
_CT = TypeVar("_CT", bound=_CData)
|
|
49
26
|
_T_IUnknown = TypeVar("_T_IUnknown", bound=IUnknown)
|
|
@@ -500,6 +477,27 @@ class IRecordInfo(IUnknown):
|
|
|
500
477
|
# XXX Should SysFreeString the array contents. How to?
|
|
501
478
|
return result
|
|
502
479
|
|
|
480
|
+
if TYPE_CHECKING:
|
|
481
|
+
# fmt: off
|
|
482
|
+
# def RecordInit
|
|
483
|
+
# def RecordClear
|
|
484
|
+
def RecordCopy( # noqa
|
|
485
|
+
self, pvExisting: hints.Incomplete, pvNew: hints.Incomplete
|
|
486
|
+
) -> hints.Hresult: ...
|
|
487
|
+
def GetGuid(self) -> GUID: ... # noqa
|
|
488
|
+
def GetName(self) -> str: ... # noqa
|
|
489
|
+
def GetSize(self) -> int: ... # noqa
|
|
490
|
+
def GetTypeInfo(self) -> ITypeInfo: ... # noqa
|
|
491
|
+
# def GetField
|
|
492
|
+
# def GetFieldNoCopy
|
|
493
|
+
# def PutField
|
|
494
|
+
# def PutFieldNoCopy
|
|
495
|
+
def IsMatchingType(self, value: "IRecordInfo") -> bool: ... # noqa
|
|
496
|
+
# def RecordCreate
|
|
497
|
+
def RecordCreateCopy(self, pvSource: hints.Incomplete) -> int: ... # noqa
|
|
498
|
+
def RecordDestroy(self, pvRecord: hints.Incomplete) -> hints.Hresult: ... # noqa
|
|
499
|
+
# fmt: on
|
|
500
|
+
|
|
503
501
|
|
|
504
502
|
IRecordInfo._methods_ = [
|
|
505
503
|
COMMETHOD([], HRESULT, "RecordInit", (["in"], c_void_p, "pvNew")),
|
|
@@ -1201,7 +1199,7 @@ class N11tagELEMDESC5DOLLAR_204E(ctypes.Union):
|
|
|
1201
1199
|
class tagPARAMDESC(ctypes.Structure):
|
|
1202
1200
|
# C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 609
|
|
1203
1201
|
if TYPE_CHECKING:
|
|
1204
|
-
pparamdescex: "tagPARAMDESCEX"
|
|
1202
|
+
pparamdescex: "_Pointer[tagPARAMDESCEX]"
|
|
1205
1203
|
wParamFlags: int
|
|
1206
1204
|
|
|
1207
1205
|
|
|
@@ -103,11 +103,13 @@ comtypes/test/test_npsupport.py
|
|
|
103
103
|
comtypes/test/test_outparam.py
|
|
104
104
|
comtypes/test/test_propputref.py
|
|
105
105
|
comtypes/test/test_pump_events.py
|
|
106
|
+
comtypes/test/test_recordinfo.py
|
|
106
107
|
comtypes/test/test_safearray.py
|
|
107
108
|
comtypes/test/test_sapi.py
|
|
108
109
|
comtypes/test/test_server.py
|
|
109
110
|
comtypes/test/test_showevents.py
|
|
110
111
|
comtypes/test/test_subinterface.py
|
|
112
|
+
comtypes/test/test_typeannotator.py
|
|
111
113
|
comtypes/test/test_typeinfo.py
|
|
112
114
|
comtypes/test/test_urlhistory.py
|
|
113
115
|
comtypes/test/test_variant.py
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import comtypes
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def name_wrapper_module(tlib):
|
|
5
|
-
"""Determine the name of a typelib wrapper module"""
|
|
6
|
-
libattr = tlib.GetLibAttr()
|
|
7
|
-
modname = "_%s_%s_%s_%s" % (
|
|
8
|
-
str(libattr.guid)[1:-1].replace("-", "_"),
|
|
9
|
-
libattr.lcid,
|
|
10
|
-
libattr.wMajorVerNum,
|
|
11
|
-
libattr.wMinorVerNum,
|
|
12
|
-
)
|
|
13
|
-
return "comtypes.gen.%s" % modname
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def name_friendly_module(tlib):
|
|
17
|
-
"""Determine the friendly-name of a typelib module.
|
|
18
|
-
If cannot get friendly-name from typelib, returns `None`.
|
|
19
|
-
"""
|
|
20
|
-
try:
|
|
21
|
-
modulename = tlib.GetDocumentation(-1)[0]
|
|
22
|
-
except comtypes.COMError:
|
|
23
|
-
return
|
|
24
|
-
return "comtypes.gen.%s" % modulename
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|