comtypes 1.4.10__zip → 1.4.12__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.
Files changed (151) hide show
  1. {comtypes-1.4.10 → comtypes-1.4.12}/CHANGES.txt +48 -0
  2. {comtypes-1.4.10/comtypes.egg-info → comtypes-1.4.12}/PKG-INFO +4 -3
  3. {comtypes-1.4.10 → comtypes-1.4.12}/README.md +1 -1
  4. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/__init__.py +11 -5
  5. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_comobject.py +29 -31
  6. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_memberspec.py +107 -81
  7. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_meta.py +1 -1
  8. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_npsupport.py +12 -17
  9. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_post_coinit/_cominterface_meta_patcher.py +8 -10
  10. comtypes-1.4.12/comtypes/_post_coinit/activeobj.py +61 -0
  11. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_post_coinit/misc.py +1 -23
  12. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_post_coinit/unknwn.py +33 -26
  13. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_vtbl.py +55 -58
  14. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/automation.py +19 -23
  15. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/__init__.py +2 -1
  16. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/_activeobj.py +8 -0
  17. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/_code_cache.py +10 -24
  18. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/_constants.py +1 -1
  19. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/_events.py +92 -54
  20. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/_generate.py +1 -3
  21. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/dynamic.py +3 -3
  22. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/lazybind.py +3 -3
  23. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/connectionpoints.py +37 -3
  24. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/errorinfo.py +54 -16
  25. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/hints.pyi +15 -2
  26. comtypes-1.4.12/comtypes/hresult.py +159 -0
  27. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/messageloop.py +15 -13
  28. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/patcher.py +2 -2
  29. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/persist.py +9 -2
  30. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/safearray.py +10 -10
  31. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/server/__init__.py +5 -37
  32. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/server/automation.py +2 -2
  33. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/server/connectionpoints.py +71 -70
  34. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/server/inprocserver.py +10 -7
  35. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/server/localserver.py +16 -22
  36. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/server/register.py +7 -7
  37. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_GUID.py +6 -7
  38. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_agilent.py +1 -1
  39. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_basic.py +6 -3
  40. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_client_dynamic.py +1 -1
  41. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_collections.py +6 -3
  42. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_comobject.py +19 -6
  43. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_comserver.py +32 -4
  44. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_createwrappers.py +1 -1
  45. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_dict.py +2 -1
  46. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_dispifc_records.py +0 -2
  47. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_dispifc_safearrays.py +0 -2
  48. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_dispinterface.py +1 -1
  49. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_dyndispatch.py +4 -2
  50. comtypes-1.4.12/comtypes/test/test_errorinfo.py +115 -0
  51. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_excel.py +1 -3
  52. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_getactiveobj.py +19 -2
  53. comtypes-1.4.12/comtypes/test/test_hresult.py +87 -0
  54. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_inout_args.py +9 -2
  55. comtypes-1.4.12/comtypes/test/test_messageloop.py +117 -0
  56. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_midl_safearray_create.py +0 -2
  57. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_msscript.py +1 -1
  58. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_npsupport.py +22 -11
  59. comtypes-1.4.12/comtypes/test/test_persist.py +71 -0
  60. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_recordinfo.py +0 -2
  61. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_safearray.py +2 -1
  62. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_server.py +6 -6
  63. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_server_register.py +2 -1
  64. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_storage.py +1 -1
  65. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_stream.py +22 -2
  66. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_typeinfo.py +19 -2
  67. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_urlhistory.py +1 -1
  68. comtypes-1.4.12/comtypes/test/test_util.py +227 -0
  69. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_variant.py +43 -25
  70. comtypes-1.4.12/comtypes/test/test_viewobject.py +78 -0
  71. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_w_getopt.py +4 -4
  72. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_word.py +1 -1
  73. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/codegenerator.py +1 -1
  74. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/comments.py +1 -1
  75. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/heads.py +5 -5
  76. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/helpers.py +7 -7
  77. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/namespaces.py +3 -3
  78. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/typeannotator.py +2 -2
  79. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/tlbparser.py +8 -7
  80. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/typedesc.py +14 -14
  81. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/typedesc_base.py +19 -19
  82. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/typeinfo.py +14 -9
  83. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/util.py +38 -6
  84. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/viewobject.py +29 -5
  85. {comtypes-1.4.10 → comtypes-1.4.12/comtypes.egg-info}/PKG-INFO +4 -3
  86. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes.egg-info/SOURCES.txt +6 -0
  87. {comtypes-1.4.10 → comtypes-1.4.12}/pyproject.toml +13 -7
  88. comtypes-1.4.10/comtypes/hresult.py +0 -81
  89. comtypes-1.4.10/comtypes/test/test_persist.py +0 -38
  90. {comtypes-1.4.10 → comtypes-1.4.12}/LICENSE.txt +0 -0
  91. {comtypes-1.4.10 → comtypes-1.4.12}/MANIFEST.in +0 -0
  92. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/GUID.py +0 -0
  93. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_post_coinit/__init__.py +0 -0
  94. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_post_coinit/bstr.py +0 -0
  95. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_post_coinit/instancemethod.py +0 -0
  96. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_safearray.py +0 -0
  97. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/_tlib_version_checker.py +0 -0
  98. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/clear_cache.py +0 -0
  99. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/_create.py +0 -0
  100. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/client/_managing.py +0 -0
  101. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/git.py +0 -0
  102. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/logutil.py +0 -0
  103. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/server/w_getopt.py +0 -0
  104. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/shelllink.py +0 -0
  105. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/stream.py +0 -0
  106. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/TestComServer.idl +0 -0
  107. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/TestComServer.py +0 -0
  108. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/TestComServer.tlb +0 -0
  109. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/TestDispServer.idl +0 -0
  110. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/TestDispServer.py +0 -0
  111. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/TestDispServer.tlb +0 -0
  112. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/__init__.py +0 -0
  113. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/find_memleak.py +0 -0
  114. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/mylib.idl +0 -0
  115. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/mylib.tlb +0 -0
  116. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/mytypelib.idl +0 -0
  117. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/runtests.py +0 -0
  118. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/setup.py +0 -0
  119. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_BSTR.py +0 -0
  120. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_DISPPARAMS.py +0 -0
  121. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_QueryService.py +0 -0
  122. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_avmc.py +0 -0
  123. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_casesensitivity.py +0 -0
  124. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_clear_cache.py +0 -0
  125. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_client.py +0 -0
  126. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_client_regenerate_modules.py +0 -0
  127. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_findgendir.py +0 -0
  128. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_ie.py +0 -0
  129. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_ienum.py +0 -0
  130. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_imfattributes.py +0 -0
  131. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_jscript.js +0 -0
  132. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_monikers.py +0 -0
  133. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_outparam.py +0 -0
  134. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_pump_events.py +0 -0
  135. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_sapi.py +0 -0
  136. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_shelllink.py +0 -0
  137. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_showevents.py +0 -0
  138. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_subinterface.py +0 -0
  139. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_typeannotator.py +0 -0
  140. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_win32com_interop.py +0 -0
  141. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/test_wmi.py +0 -0
  142. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/test/urlhist.tlb +0 -0
  143. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/__init__.py +0 -0
  144. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/__init__.py +0 -0
  145. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/modulenamer.py +0 -0
  146. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes/tools/codegenerator/packing.py +0 -0
  147. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes.egg-info/dependency_links.txt +0 -0
  148. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes.egg-info/entry_points.txt +0 -0
  149. {comtypes-1.4.10 → comtypes-1.4.12}/comtypes.egg-info/top_level.txt +0 -0
  150. {comtypes-1.4.10 → comtypes-1.4.12}/setup.cfg +0 -0
  151. {comtypes-1.4.10 → comtypes-1.4.12}/setup.py +0 -0
@@ -10,7 +10,7 @@ from comtypes.tools.typedesc_base import *
10
10
  from comtypes.typeinfo import TLIBATTR, ITypeLib
11
11
 
12
12
 
13
- class TypeLib(object):
13
+ class TypeLib:
14
14
  def __init__(
15
15
  self, name: str, guid: str, major: int, minor: int, doc: Optional[str] = None
16
16
  ) -> None:
@@ -24,7 +24,7 @@ class TypeLib(object):
24
24
  return f"<TypeLib({self.name}: {self.guid}, {self.major}, {self.minor})>"
25
25
 
26
26
 
27
- class Constant(object):
27
+ class Constant:
28
28
  def __init__(
29
29
  self,
30
30
  name: str,
@@ -38,7 +38,7 @@ class Constant(object):
38
38
  self.doc = doc
39
39
 
40
40
 
41
- class External(object):
41
+ class External:
42
42
  def __init__(
43
43
  self,
44
44
  tlib: ITypeLib,
@@ -61,13 +61,13 @@ class External(object):
61
61
  return self
62
62
 
63
63
 
64
- class SAFEARRAYType(object):
64
+ class SAFEARRAYType:
65
65
  def __init__(self, typ: Any) -> None:
66
66
  self.typ = typ
67
67
  self.align = self.size = ctypes.sizeof(ctypes.c_void_p) * 8
68
68
 
69
69
 
70
- class ComMethod(object):
70
+ class ComMethod:
71
71
  # custom COM method, parsed from typelib
72
72
  def __init__(
73
73
  self,
@@ -92,7 +92,7 @@ class ComMethod(object):
92
92
  self.arguments.append((typ, name, idlflags, default))
93
93
 
94
94
 
95
- class DispMethod(object):
95
+ class DispMethod:
96
96
  # dispatchable COM method, parsed from typelib
97
97
  def __init__(
98
98
  self,
@@ -117,7 +117,7 @@ class DispMethod(object):
117
117
  self.arguments.append((typ, name, idlflags, default))
118
118
 
119
119
 
120
- class DispProperty(object):
120
+ class DispProperty:
121
121
  # dispatchable COM property, parsed from typelib
122
122
  def __init__(
123
123
  self, dispid: int, name: str, typ: Any, idlflags: List[str], doc: Optional[Any]
@@ -129,17 +129,17 @@ class DispProperty(object):
129
129
  self.doc = doc
130
130
 
131
131
 
132
- class DispInterfaceHead(object):
132
+ class DispInterfaceHead:
133
133
  def __init__(self, itf: "DispInterface") -> None:
134
134
  self.itf = itf
135
135
 
136
136
 
137
- class DispInterfaceBody(object):
137
+ class DispInterfaceBody:
138
138
  def __init__(self, itf: "DispInterface") -> None:
139
139
  self.itf = itf
140
140
 
141
141
 
142
- class DispInterface(object):
142
+ class DispInterface:
143
143
  def __init__(
144
144
  self,
145
145
  name: str,
@@ -167,17 +167,17 @@ class DispInterface(object):
167
167
  return self.itf_head
168
168
 
169
169
 
170
- class ComInterfaceHead(object):
170
+ class ComInterfaceHead:
171
171
  def __init__(self, itf: "ComInterface") -> None:
172
172
  self.itf = itf
173
173
 
174
174
 
175
- class ComInterfaceBody(object):
175
+ class ComInterfaceBody:
176
176
  def __init__(self, itf: "ComInterface") -> None:
177
177
  self.itf = itf
178
178
 
179
179
 
180
- class ComInterface(object):
180
+ class ComInterface:
181
181
  def __init__(
182
182
  self,
183
183
  name: str,
@@ -209,7 +209,7 @@ _ImplTypeFlags = int
209
209
  _Interface = _UnionT[ComInterface, DispInterface]
210
210
 
211
211
 
212
- class CoClass(object):
212
+ class CoClass:
213
213
  def __init__(
214
214
  self,
215
215
  name: str,
@@ -5,7 +5,7 @@ from typing import Union as _UnionT
5
5
  import comtypes
6
6
 
7
7
 
8
- class Argument(object):
8
+ class Argument:
9
9
  "a Parameter in the argument list of a callable (Function, Method, ...)"
10
10
 
11
11
  def __init__(self, atype, name):
@@ -13,7 +13,7 @@ class Argument(object):
13
13
  self.name = name
14
14
 
15
15
 
16
- class _HasArgs(object):
16
+ class _HasArgs:
17
17
  def __init__(self):
18
18
  self.arguments = []
19
19
 
@@ -37,7 +37,7 @@ class _HasArgs(object):
37
37
  ################
38
38
 
39
39
 
40
- class Alias(object):
40
+ class Alias:
41
41
  # a C preprocessor alias, like #define A B
42
42
  def __init__(self, name, alias, typ=None):
43
43
  self.name = name
@@ -45,7 +45,7 @@ class Alias(object):
45
45
  self.typ = typ
46
46
 
47
47
 
48
- class Macro(object):
48
+ class Macro:
49
49
  # a C preprocessor definition with arguments
50
50
  def __init__(self, name, args, body):
51
51
  # all arguments are strings, args is the literal argument list
@@ -56,7 +56,7 @@ class Macro(object):
56
56
  self.body = body
57
57
 
58
58
 
59
- class File(object):
59
+ class File:
60
60
  def __init__(self, name):
61
61
  self.name = name
62
62
 
@@ -107,7 +107,7 @@ class Method(_HasArgs):
107
107
  self.returns = returns
108
108
 
109
109
 
110
- class FundamentalType(object):
110
+ class FundamentalType:
111
111
  location = None
112
112
 
113
113
  def __init__(self, name, size, align):
@@ -117,7 +117,7 @@ class FundamentalType(object):
117
117
  self.align = int(align)
118
118
 
119
119
 
120
- class PointerType(object):
120
+ class PointerType:
121
121
  location = None
122
122
 
123
123
  def __init__(self, typ, size, align):
@@ -126,7 +126,7 @@ class PointerType(object):
126
126
  self.align = int(align)
127
127
 
128
128
 
129
- class Typedef(object):
129
+ class Typedef:
130
130
  location = None
131
131
 
132
132
  def __init__(self, name, typ):
@@ -134,7 +134,7 @@ class Typedef(object):
134
134
  self.typ = typ
135
135
 
136
136
 
137
- class ArrayType(object):
137
+ class ArrayType:
138
138
  location = None
139
139
 
140
140
  def __init__(self, typ: Any, min: int, max: int) -> None:
@@ -143,21 +143,21 @@ class ArrayType(object):
143
143
  self.max = max
144
144
 
145
145
 
146
- class StructureHead(object):
146
+ class StructureHead:
147
147
  location = None
148
148
 
149
149
  def __init__(self, struct: "_Struct_Union_Base") -> None:
150
150
  self.struct = struct
151
151
 
152
152
 
153
- class StructureBody(object):
153
+ class StructureBody:
154
154
  location = None
155
155
 
156
156
  def __init__(self, struct: "_Struct_Union_Base") -> None:
157
157
  self.struct = struct
158
158
 
159
159
 
160
- class _Struct_Union_Base(object):
160
+ class _Struct_Union_Base:
161
161
  name: str
162
162
  align: int
163
163
  members: List[_UnionT["Field", Method, Constructor]]
@@ -198,7 +198,7 @@ class Structure(_Struct_Union_Base):
198
198
  self.size = int(size)
199
199
  else:
200
200
  self.size = None
201
- super(Structure, self).__init__()
201
+ super().__init__()
202
202
 
203
203
 
204
204
  class Union(_Struct_Union_Base):
@@ -220,10 +220,10 @@ class Union(_Struct_Union_Base):
220
220
  self.size = int(size)
221
221
  else:
222
222
  self.size = None
223
- super(Union, self).__init__()
223
+ super().__init__()
224
224
 
225
225
 
226
- class Field(object):
226
+ class Field:
227
227
  def __init__(
228
228
  self, name: str, typ: Any, bits: Optional[Any], offset: SupportsInt
229
229
  ) -> None:
@@ -233,14 +233,14 @@ class Field(object):
233
233
  self.offset = int(offset)
234
234
 
235
235
 
236
- class CvQualifiedType(object):
236
+ class CvQualifiedType:
237
237
  def __init__(self, typ, const, volatile):
238
238
  self.typ = typ
239
239
  self.const = const
240
240
  self.volatile = volatile
241
241
 
242
242
 
243
- class Enumeration(object):
243
+ class Enumeration:
244
244
  location = None
245
245
 
246
246
  def __init__(self, name: str, size: SupportsInt, align: SupportsInt) -> None:
@@ -253,14 +253,14 @@ class Enumeration(object):
253
253
  self.values.append(v)
254
254
 
255
255
 
256
- class EnumValue(object):
256
+ class EnumValue:
257
257
  def __init__(self, name: str, value: int, enumeration: Enumeration) -> None:
258
258
  self.name = name
259
259
  self.value = value
260
260
  self.enumeration = enumeration
261
261
 
262
262
 
263
- class Variable(object):
263
+ class Variable:
264
264
  location = None
265
265
 
266
266
  def __init__(self, name, typ, init=None):
@@ -45,6 +45,14 @@ from typing import (
45
45
  from typing import Union as _UnionT
46
46
 
47
47
  from comtypes import BSTR, COMMETHOD, GUID, IID, STDMETHOD, IUnknown, _CData
48
+ from comtypes._memberspec import PARAMFLAG_FHASCUSTDATA as PARAMFLAG_FHASCUSTDATA
49
+ from comtypes._memberspec import PARAMFLAG_FHASDEFAULT as PARAMFLAG_FHASDEFAULT
50
+ from comtypes._memberspec import PARAMFLAG_FIN as PARAMFLAG_FIN
51
+ from comtypes._memberspec import PARAMFLAG_FLCID as PARAMFLAG_FLCID
52
+ from comtypes._memberspec import PARAMFLAG_FOPT as PARAMFLAG_FOPT
53
+ from comtypes._memberspec import PARAMFLAG_FOUT as PARAMFLAG_FOUT
54
+ from comtypes._memberspec import PARAMFLAG_FRETVAL as PARAMFLAG_FRETVAL
55
+ from comtypes._memberspec import PARAMFLAG_NONE as PARAMFLAG_NONE
48
56
  from comtypes.automation import (
49
57
  DISPID,
50
58
  DISPPARAMS,
@@ -205,15 +213,6 @@ VARFLAG_FREPLACEABLE = 2048
205
213
  VARFLAG_FIMMEDIATEBIND = 4096
206
214
  VARFLAGS = tagVARFLAGS
207
215
 
208
- PARAMFLAG_NONE = 0
209
- PARAMFLAG_FIN = 1
210
- PARAMFLAG_FOUT = 2
211
- PARAMFLAG_FLCID = 4
212
- PARAMFLAG_FRETVAL = 8
213
- PARAMFLAG_FOPT = 16
214
- PARAMFLAG_FHASDEFAULT = 32
215
- PARAMFLAG_FHASCUSTDATA = 64
216
-
217
216
  ################################################################
218
217
  # a helper
219
218
 
@@ -770,6 +769,8 @@ def GetModuleFileName(handle: Optional[int], maxsize: int) -> str:
770
769
  """
771
770
  buf = create_unicode_buffer(maxsize)
772
771
  length = _GetModuleFileNameW(handle, buf, maxsize)
772
+ if not length:
773
+ raise ctypes.WinError()
773
774
  return buf.value[:length]
774
775
 
775
776
 
@@ -1179,6 +1180,10 @@ class IProvideClassInfo(IUnknown):
1179
1180
  ]
1180
1181
 
1181
1182
 
1183
+ # Flags used to specify the kind of information requested from an object.
1184
+ GUIDKIND_DEFAULT_SOURCE_DISP_IID = 1
1185
+
1186
+
1182
1187
  class IProvideClassInfo2(IProvideClassInfo):
1183
1188
  _iid_ = GUID("{A6BC3AC0-DBAA-11CE-9DE3-00AA004BB851}")
1184
1189
  if TYPE_CHECKING:
@@ -2,7 +2,33 @@
2
2
  and cast_field(struct, fieldname, fieldtype).
3
3
  """
4
4
 
5
- from ctypes import *
5
+ from ctypes import (
6
+ POINTER,
7
+ Structure,
8
+ Union,
9
+ _SimpleCData,
10
+ addressof,
11
+ byref,
12
+ c_byte,
13
+ c_char,
14
+ c_double,
15
+ c_float,
16
+ c_int,
17
+ c_long,
18
+ c_longlong,
19
+ c_short,
20
+ c_void_p,
21
+ cast,
22
+ sizeof,
23
+ )
24
+ from ctypes import Array as _CArrayType
25
+ from typing import TYPE_CHECKING, Type, TypeVar, overload
26
+
27
+ if TYPE_CHECKING:
28
+ from ctypes import _CArgObject, _CData
29
+
30
+ _T = TypeVar("_T")
31
+ _CT = TypeVar("_CT", bound="_CData")
6
32
 
7
33
 
8
34
  def _calc_offset():
@@ -49,7 +75,7 @@ def _calc_offset():
49
75
 
50
76
  argobj = PyCArgObject.from_address(id(ref))
51
77
 
52
- if argobj.obj != id(obj) or argobj.p != addressof(obj) or argobj.tag != "P":
78
+ if argobj.obj != id(obj) or argobj.p != addressof(obj) or argobj.tag != b"P":
53
79
  raise RuntimeError("PyCArgObject field definitions incorrect")
54
80
 
55
81
  return PyCArgObject.p.offset # offset of the pointer field
@@ -59,6 +85,10 @@ def _calc_offset():
59
85
  #
60
86
  # byref_at
61
87
  #
88
+ @overload
89
+ def byref_at(obj: _CArrayType, offset: int) -> "_CArgObject": ...
90
+ @overload
91
+ def byref_at(obj: "_CData", offset: int) -> "_CArgObject": ...
62
92
  def byref_at(
63
93
  obj,
64
94
  offset,
@@ -84,16 +114,18 @@ def byref_at(
84
114
  #
85
115
  # cast_field
86
116
  #
117
+ @overload
118
+ def cast_field(
119
+ struct: Structure, fieldname: str, fieldtype: Type["_SimpleCData[_T]"]
120
+ ) -> _T: ...
121
+ @overload
122
+ def cast_field(struct: Structure, fieldname: str, fieldtype: Type[_CT]) -> _CT: ...
87
123
  def cast_field(
88
124
  struct,
89
125
  fieldname,
90
126
  fieldtype,
91
- offset=0,
92
127
  _POINTER=POINTER,
93
128
  _byref_at=byref_at,
94
- _byref=byref,
95
- _divmod=divmod,
96
- _sizeof=sizeof,
97
129
  ):
98
130
  """cast_field(struct, fieldname, fieldtype)
99
131
 
@@ -1,9 +1,22 @@
1
1
  # XXX need to find out what the share from comtypes.dataobject.
2
- from ctypes import *
2
+ from ctypes import (
3
+ HRESULT,
4
+ POINTER,
5
+ Structure,
6
+ alignment,
7
+ c_int,
8
+ c_ubyte,
9
+ c_ulong,
10
+ c_ushort,
11
+ c_void_p,
12
+ sizeof,
13
+ )
3
14
  from ctypes.wintypes import _RECTL, HDC, SIZEL, tagPOINT, tagRECT
4
15
 
5
16
  from comtypes import COMMETHOD, GUID, IUnknown
6
17
 
18
+ X64_PYTHON = sizeof(POINTER(c_int)) * 8 == 64
19
+
7
20
 
8
21
  class tagPALETTEENTRY(Structure):
9
22
  _fields_ = [
@@ -27,7 +40,10 @@ class tagLOGPALETTE(Structure):
27
40
  ]
28
41
 
29
42
 
30
- assert sizeof(tagLOGPALETTE) == 8, sizeof(tagLOGPALETTE)
43
+ if X64_PYTHON:
44
+ assert sizeof(tagLOGPALETTE) == 12, sizeof(tagLOGPALETTE)
45
+ else:
46
+ assert sizeof(tagLOGPALETTE) == 8, sizeof(tagLOGPALETTE)
31
47
  assert alignment(tagLOGPALETTE) == 2, alignment(tagLOGPALETTE)
32
48
 
33
49
 
@@ -42,8 +58,12 @@ class tagDVTARGETDEVICE(Structure):
42
58
  ]
43
59
 
44
60
 
45
- assert sizeof(tagDVTARGETDEVICE) == 16, sizeof(tagDVTARGETDEVICE)
46
- assert alignment(tagDVTARGETDEVICE) == 4, alignment(tagDVTARGETDEVICE)
61
+ if X64_PYTHON:
62
+ assert sizeof(tagDVTARGETDEVICE) == 24, sizeof(tagDVTARGETDEVICE)
63
+ assert alignment(tagDVTARGETDEVICE) == 8, alignment(tagDVTARGETDEVICE)
64
+ else:
65
+ assert sizeof(tagDVTARGETDEVICE) == 16, sizeof(tagDVTARGETDEVICE)
66
+ assert alignment(tagDVTARGETDEVICE) == 4, alignment(tagDVTARGETDEVICE)
47
67
 
48
68
 
49
69
  class tagExtentInfo(Structure):
@@ -55,7 +75,7 @@ class tagExtentInfo(Structure):
55
75
 
56
76
  def __init__(self, *args, **kw):
57
77
  self.cb = sizeof(self)
58
- super(tagExtentInfo, self).__init__(*args, **kw)
78
+ super().__init__(*args, **kw)
59
79
 
60
80
  def __repr__(self):
61
81
  size = (self.sizelProposed.cx, self.sizelProposed.cy)
@@ -64,6 +84,10 @@ class tagExtentInfo(Structure):
64
84
 
65
85
  assert sizeof(tagExtentInfo) == 16, sizeof(tagExtentInfo)
66
86
  assert alignment(tagExtentInfo) == 4, alignment(tagExtentInfo)
87
+
88
+ PALETTEENTRY = tagPALETTEENTRY
89
+ LOGPALETTE = tagLOGPALETTE
90
+ DVTARGETDEVICE = tagDVTARGETDEVICE
67
91
  DVEXTENTINFO = tagExtentInfo
68
92
 
69
93
  IAdviseSink = IUnknown # fake the interface
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: comtypes
3
- Version: 1.4.10
3
+ Version: 1.4.12
4
4
  Summary: Pure Python COM package
5
5
  Home-page: https://github.com/enthought/comtypes
6
6
  Download-URL: https://github.com/enthought/comtypes/releases
@@ -17,6 +17,7 @@ Requires-Python: >=3.8
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE.txt
19
19
  Dynamic: download-url
20
+ Dynamic: license-file
20
21
 
21
22
  # comtypes
22
23
 
@@ -24,7 +25,7 @@ Dynamic: download-url
24
25
  [![PyPI version](https://badge.fury.io/py/comtypes.svg)](https://pypi.org/project/comtypes/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/comtypes)](https://pypi.org/project/comtypes/) [![PyPI - Python Requires](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fpypi.org%2Fpypi%2Fcomtypes%2Fjson&query=info.requires_python&label=Python&nbsp;Requires)](https://pypi.org/project/comtypes/)
25
26
  [![PyPI - License](https://img.shields.io/pypi/l/comtypes)](https://pypi.org/project/comtypes/) [![PyPI - Downloads](https://img.shields.io/pypi/dm/comtypes)](https://pypi.org/project/comtypes/)
26
27
  [![GitHub Repo stars](https://img.shields.io/github/stars/enthought/comtypes?style=social)](https://github.com/enthought/comtypes/stargazers) [![GitHub forks](https://img.shields.io/github/forks/enthought/comtypes?style=social)](https://github.com/enthought/comtypes/network/members) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
27
- [![Tidelift Subscription](https://tidelift.com/badges/package/pypi/comtypes)](https://tidelift.com/subscription/pkg/pypi-comtypes?utm_source=pypi-comtypes&utm_medium=readme)
28
+ [![Tidelift Subscription](https://tidelift.com/badges/package/pypi/comtypes)](https://tidelift.com/subscription/pkg/pypi-comtypes?utm_source=pypi-comtypes&utm_medium=readme) [![Coverage](https://img.shields.io/codecov/c/github/enthought/comtypes)](https://app.codecov.io/github/enthought/comtypes)
28
29
 
29
30
 
30
31
  `comtypes` is a lightweight pure Python [COM](https://learn.microsoft.com/en-us/windows/win32/com/component-object-model--com--portal) package based on the [`ctypes`](https://docs.python.org/library/ctypes.html) foreign function interface library.
@@ -38,6 +38,7 @@ comtypes.egg-info/entry_points.txt
38
38
  comtypes.egg-info/top_level.txt
39
39
  comtypes/_post_coinit/__init__.py
40
40
  comtypes/_post_coinit/_cominterface_meta_patcher.py
41
+ comtypes/_post_coinit/activeobj.py
41
42
  comtypes/_post_coinit/bstr.py
42
43
  comtypes/_post_coinit/instancemethod.py
43
44
  comtypes/_post_coinit/misc.py
@@ -93,14 +94,17 @@ comtypes/test/test_dispifc_records.py
93
94
  comtypes/test/test_dispifc_safearrays.py
94
95
  comtypes/test/test_dispinterface.py
95
96
  comtypes/test/test_dyndispatch.py
97
+ comtypes/test/test_errorinfo.py
96
98
  comtypes/test/test_excel.py
97
99
  comtypes/test/test_findgendir.py
98
100
  comtypes/test/test_getactiveobj.py
101
+ comtypes/test/test_hresult.py
99
102
  comtypes/test/test_ie.py
100
103
  comtypes/test/test_ienum.py
101
104
  comtypes/test/test_imfattributes.py
102
105
  comtypes/test/test_inout_args.py
103
106
  comtypes/test/test_jscript.js
107
+ comtypes/test/test_messageloop.py
104
108
  comtypes/test/test_midl_safearray_create.py
105
109
  comtypes/test/test_monikers.py
106
110
  comtypes/test/test_msscript.py
@@ -121,7 +125,9 @@ comtypes/test/test_subinterface.py
121
125
  comtypes/test/test_typeannotator.py
122
126
  comtypes/test/test_typeinfo.py
123
127
  comtypes/test/test_urlhistory.py
128
+ comtypes/test/test_util.py
124
129
  comtypes/test/test_variant.py
130
+ comtypes/test/test_viewobject.py
125
131
  comtypes/test/test_w_getopt.py
126
132
  comtypes/test/test_win32com_interop.py
127
133
  comtypes/test/test_wmi.py
@@ -11,20 +11,14 @@ ignore = ["E402"]
11
11
  "comtypes/_npsupport.py" = ["F401"]
12
12
  "comtypes/_vtbl.py" = ["E722"]
13
13
  "comtypes/automation.py" = ["F401", "F403", "F405"]
14
- "comtypes/connectionpoints.py" = ["F401", "F403", "F405"]
15
- "comtypes/errorinfo.py" = ["F403", "F405"]
16
14
  "comtypes/git.py" = ["F401", "F403", "F405"]
17
- "comtypes/util.py" = ["F403", "F405"]
18
15
  "comtypes/viewobject.py" = ["F403", "F405"]
19
- "comtypes/client/_code_cache.py" = ["E401", "E711"]
20
16
  "comtypes/client/_constants.py" = ["F401"]
21
- "comtypes/client/_events.py" = ["F841"]
22
17
  "comtypes/server/automation.py" = ["F403", "F405"]
23
18
  "comtypes/server/connectionpoints.py" = ["F401", "F403", "F405"]
24
- "comtypes/server/inprocserver.py" = ["E713", "E722", "F841"]
19
+ "comtypes/server/inprocserver.py" = ["E722"]
25
20
  "comtypes/server/register.py" = ["E713"]
26
21
  "comtypes/tools/codegenerator/packing.py" = ["F821", "F841"]
27
- "comtypes/tools/tlbparser.py" = ["F401"]
28
22
  "comtypes/tools/typedesc.py" = ["F403", "F405"]
29
23
  "comtypes/tools/typedesc_base.py" = ["F401"]
30
24
  # gen directory
@@ -45,3 +39,15 @@ ignore = ["E402"]
45
39
  "comtypes/test/test_subinterface.py" = ["E401", "F401", "F403", "F405"]
46
40
  "comtypes/test/test_urlhistory.py" = ["E401", "F401", "F403", "F405", "F841"]
47
41
  "comtypes/test/test_variant.py" = ["F401", "F821", "F841"]
42
+
43
+ [tool.coverage.run]
44
+ # Specify the source directory to avoid tracking temporary files created by "test_client_regenerate_modules.py".
45
+ # Without this, coverage track these temporary files, leading to error when trying to generate a report.
46
+ source = ["comtypes"]
47
+ omit = ["comtypes/gen/*"]
48
+
49
+ [tool.coverage.report]
50
+ exclude_also = [
51
+ "if __name__ == .__main__.:",
52
+ "if TYPE_CHECKING:",
53
+ ]
@@ -1,81 +0,0 @@
1
- # comtypes.hresult
2
- # COM success and error codes
3
- #
4
- # Note that the codes should be written in decimal notation!
5
-
6
- S_OK = 0
7
- S_FALSE = 1
8
-
9
- E_UNEXPECTED = -2147418113 # 0x8000FFFFL
10
-
11
- E_NOTIMPL = -2147467263 # 0x80004001L
12
- E_NOINTERFACE = -2147467262 # 0x80004002L
13
- E_POINTER = -2147467261 # 0x80004003L
14
- E_FAIL = -2147467259 # 0x80004005L
15
- E_INVALIDARG = -2147024809 # 0x80070057L
16
- E_OUTOFMEMORY = -2147024882 # 0x8007000EL
17
-
18
- CLASS_E_NOAGGREGATION = -2147221232 # 0x80040110L
19
- CLASS_E_CLASSNOTAVAILABLE = -2147221231 # 0x80040111L
20
-
21
- CO_E_CLASSSTRING = -2147221005 # 0x800401F3L
22
-
23
- # connection point error codes
24
- CONNECT_E_CANNOTCONNECT = -2147220990
25
- CONNECT_E_ADVISELIMIT = -2147220991
26
- CONNECT_E_NOCONNECTION = -2147220992
27
-
28
- TYPE_E_ELEMENTNOTFOUND = -2147352077 # 0x8002802BL
29
-
30
- TYPE_E_REGISTRYACCESS = -2147319780 # 0x8002801CL
31
- TYPE_E_CANTLOADLIBRARY = -2147312566 # 0x80029C4AL
32
-
33
- # all the DISP_E_ values from windows.h
34
- DISP_E_BUFFERTOOSMALL = -2147352557
35
- DISP_E_DIVBYZERO = -2147352558
36
- DISP_E_NOTACOLLECTION = -2147352559
37
- DISP_E_BADCALLEE = -2147352560
38
- DISP_E_PARAMNOTOPTIONAL = -2147352561 # 0x8002000F
39
- DISP_E_BADPARAMCOUNT = -2147352562 # 0x8002000E
40
- DISP_E_ARRAYISLOCKED = -2147352563 # 0x8002000D
41
- DISP_E_UNKNOWNLCID = -2147352564 # 0x8002000C
42
- DISP_E_BADINDEX = -2147352565 # 0x8002000B
43
- DISP_E_OVERFLOW = -2147352566 # 0x8002000A
44
- DISP_E_EXCEPTION = -2147352567 # 0x80020009
45
- DISP_E_BADVARTYPE = -2147352568 # 0x80020008
46
- DISP_E_NONAMEDARGS = -2147352569 # 0x80020007
47
- DISP_E_UNKNOWNNAME = -2147352570 # 0x80020006
48
- DISP_E_TYPEMISMATCH = -2147352571 # 0800020005
49
- DISP_E_PARAMNOTFOUND = -2147352572 # 0x80020004
50
- DISP_E_MEMBERNOTFOUND = -2147352573 # 0x80020003
51
- DISP_E_UNKNOWNINTERFACE = -2147352575 # 0x80020001
52
-
53
- RPC_E_CHANGED_MODE = -2147417850 # 0x80010106
54
- RPC_E_SERVERFAULT = -2147417851 # 0x80010105
55
-
56
- # 'macros' and constants to create your own HRESULT values:
57
-
58
-
59
- def MAKE_HRESULT(sev, fac, code):
60
- # A hresult is SIGNED in comtypes
61
- from ctypes import c_long
62
-
63
- return c_long((sev << 31 | fac << 16 | code)).value
64
-
65
-
66
- SEVERITY_ERROR = 1
67
- SEVERITY_SUCCESS = 0
68
-
69
- FACILITY_ITF = 4
70
- FACILITY_WIN32 = 7
71
-
72
-
73
- def HRESULT_FROM_WIN32(x):
74
- # make signed
75
- from ctypes import c_long
76
-
77
- x = c_long(x).value
78
- if x < 0:
79
- return x
80
- # 0x80000000 | FACILITY_WIN32 << 16 | x & 0xFFFF
81
- return c_long(0x80070000 | (x & 0xFFFF)).value
@@ -1,38 +0,0 @@
1
- import tempfile
2
- import unittest as ut
3
- from pathlib import Path
4
-
5
- from comtypes import GUID, CoCreateInstance, IPersist, persist
6
-
7
- CLSID_ShellLink = GUID("{00021401-0000-0000-C000-000000000046}")
8
-
9
-
10
- class Test_IPersist(ut.TestCase):
11
- def test_GetClassID(self):
12
- p = CoCreateInstance(CLSID_ShellLink).QueryInterface(IPersist)
13
- self.assertEqual(p.GetClassID(), CLSID_ShellLink)
14
-
15
-
16
- class Test_IPersistFile(ut.TestCase):
17
- def setUp(self):
18
- td = tempfile.TemporaryDirectory()
19
- self.addCleanup(td.cleanup)
20
- self.tmp_dir = Path(td.name)
21
-
22
- def _create_pf(self) -> persist.IPersistFile:
23
- return CoCreateInstance(CLSID_ShellLink).QueryInterface(persist.IPersistFile)
24
-
25
- def test_load(self):
26
- pf = self._create_pf()
27
- tgt_file = (self.tmp_dir / "tgt.txt").resolve()
28
- tgt_file.touch()
29
- pf.Load(str(tgt_file), persist.STGM_DIRECT)
30
- self.assertEqual(pf.GetCurFile(), str(tgt_file))
31
-
32
- def test_save(self):
33
- pf = self._create_pf()
34
- tgt_file = self.tmp_dir / "tgt.txt"
35
- self.assertFalse(tgt_file.exists())
36
- pf.Save(str(tgt_file), True)
37
- self.assertEqual(pf.GetCurFile(), str(tgt_file))
38
- self.assertTrue(tgt_file.exists())
File without changes
File without changes
File without changes