comtypes 1.4.11__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 (150) hide show
  1. {comtypes-1.4.11 → comtypes-1.4.12}/CHANGES.txt +26 -0
  2. {comtypes-1.4.11/comtypes.egg-info → comtypes-1.4.12}/PKG-INFO +2 -2
  3. {comtypes-1.4.11 → comtypes-1.4.12}/README.md +1 -1
  4. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/__init__.py +8 -2
  5. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/_comobject.py +6 -6
  6. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/_memberspec.py +7 -7
  7. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/_npsupport.py +12 -17
  8. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/_post_coinit/_cominterface_meta_patcher.py +5 -5
  9. comtypes-1.4.12/comtypes/_post_coinit/activeobj.py +61 -0
  10. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/_post_coinit/misc.py +1 -23
  11. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/_post_coinit/unknwn.py +4 -6
  12. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/_vtbl.py +3 -3
  13. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/automation.py +10 -13
  14. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/client/__init__.py +2 -1
  15. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/client/_activeobj.py +8 -0
  16. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/client/_code_cache.py +1 -1
  17. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/client/_constants.py +1 -1
  18. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/client/_events.py +6 -6
  19. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/client/_generate.py +1 -1
  20. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/client/dynamic.py +3 -3
  21. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/client/lazybind.py +3 -3
  22. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/errorinfo.py +1 -1
  23. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/hresult.py +68 -0
  24. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/messageloop.py +1 -1
  25. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/patcher.py +2 -2
  26. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/persist.py +9 -2
  27. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/safearray.py +10 -10
  28. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/server/__init__.py +5 -37
  29. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/server/automation.py +2 -2
  30. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/server/connectionpoints.py +3 -3
  31. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/server/inprocserver.py +2 -2
  32. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/server/localserver.py +3 -3
  33. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/server/register.py +5 -5
  34. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_agilent.py +1 -1
  35. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_client_dynamic.py +1 -1
  36. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_comserver.py +7 -2
  37. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_createwrappers.py +1 -1
  38. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_dispifc_records.py +0 -2
  39. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_dispifc_safearrays.py +0 -2
  40. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_dispinterface.py +1 -1
  41. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_excel.py +1 -3
  42. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_getactiveobj.py +19 -2
  43. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_hresult.py +39 -0
  44. comtypes-1.4.12/comtypes/test/test_messageloop.py +117 -0
  45. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_midl_safearray_create.py +0 -2
  46. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_msscript.py +1 -1
  47. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_npsupport.py +22 -11
  48. comtypes-1.4.12/comtypes/test/test_persist.py +71 -0
  49. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_recordinfo.py +0 -2
  50. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_server.py +6 -6
  51. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_storage.py +1 -1
  52. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_stream.py +22 -2
  53. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_urlhistory.py +1 -1
  54. comtypes-1.4.12/comtypes/test/test_util.py +227 -0
  55. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_variant.py +41 -24
  56. comtypes-1.4.12/comtypes/test/test_viewobject.py +78 -0
  57. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_word.py +1 -1
  58. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/tools/codegenerator/codegenerator.py +1 -1
  59. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/tools/codegenerator/comments.py +1 -1
  60. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/tools/codegenerator/heads.py +5 -5
  61. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/tools/codegenerator/helpers.py +7 -7
  62. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/tools/codegenerator/namespaces.py +3 -3
  63. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/tools/codegenerator/typeannotator.py +2 -2
  64. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/tools/tlbparser.py +1 -1
  65. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/tools/typedesc.py +14 -14
  66. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/tools/typedesc_base.py +19 -19
  67. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/util.py +38 -6
  68. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/viewobject.py +29 -5
  69. {comtypes-1.4.11 → comtypes-1.4.12/comtypes.egg-info}/PKG-INFO +2 -2
  70. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes.egg-info/SOURCES.txt +4 -0
  71. {comtypes-1.4.11 → comtypes-1.4.12}/pyproject.toml +12 -1
  72. comtypes-1.4.11/comtypes/test/test_persist.py +0 -38
  73. {comtypes-1.4.11 → comtypes-1.4.12}/LICENSE.txt +0 -0
  74. {comtypes-1.4.11 → comtypes-1.4.12}/MANIFEST.in +0 -0
  75. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/GUID.py +0 -0
  76. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/_meta.py +0 -0
  77. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/_post_coinit/__init__.py +0 -0
  78. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/_post_coinit/bstr.py +0 -0
  79. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/_post_coinit/instancemethod.py +0 -0
  80. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/_safearray.py +0 -0
  81. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/_tlib_version_checker.py +0 -0
  82. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/clear_cache.py +0 -0
  83. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/client/_create.py +0 -0
  84. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/client/_managing.py +0 -0
  85. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/connectionpoints.py +0 -0
  86. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/git.py +0 -0
  87. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/hints.pyi +0 -0
  88. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/logutil.py +0 -0
  89. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/server/w_getopt.py +0 -0
  90. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/shelllink.py +0 -0
  91. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/stream.py +0 -0
  92. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/TestComServer.idl +0 -0
  93. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/TestComServer.py +0 -0
  94. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/TestComServer.tlb +0 -0
  95. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/TestDispServer.idl +0 -0
  96. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/TestDispServer.py +0 -0
  97. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/TestDispServer.tlb +0 -0
  98. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/__init__.py +0 -0
  99. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/find_memleak.py +0 -0
  100. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/mylib.idl +0 -0
  101. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/mylib.tlb +0 -0
  102. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/mytypelib.idl +0 -0
  103. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/runtests.py +0 -0
  104. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/setup.py +0 -0
  105. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_BSTR.py +0 -0
  106. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_DISPPARAMS.py +0 -0
  107. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_GUID.py +0 -0
  108. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_QueryService.py +0 -0
  109. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_avmc.py +0 -0
  110. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_basic.py +0 -0
  111. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_casesensitivity.py +0 -0
  112. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_clear_cache.py +0 -0
  113. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_client.py +0 -0
  114. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_client_regenerate_modules.py +0 -0
  115. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_collections.py +0 -0
  116. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_comobject.py +0 -0
  117. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_dict.py +0 -0
  118. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_dyndispatch.py +0 -0
  119. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_errorinfo.py +0 -0
  120. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_findgendir.py +0 -0
  121. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_ie.py +0 -0
  122. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_ienum.py +0 -0
  123. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_imfattributes.py +0 -0
  124. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_inout_args.py +0 -0
  125. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_jscript.js +0 -0
  126. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_monikers.py +0 -0
  127. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_outparam.py +0 -0
  128. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_pump_events.py +0 -0
  129. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_safearray.py +0 -0
  130. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_sapi.py +0 -0
  131. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_server_register.py +0 -0
  132. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_shelllink.py +0 -0
  133. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_showevents.py +0 -0
  134. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_subinterface.py +0 -0
  135. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_typeannotator.py +0 -0
  136. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_typeinfo.py +0 -0
  137. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_w_getopt.py +0 -0
  138. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_win32com_interop.py +0 -0
  139. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/test_wmi.py +0 -0
  140. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/test/urlhist.tlb +0 -0
  141. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/tools/__init__.py +0 -0
  142. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/tools/codegenerator/__init__.py +0 -0
  143. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/tools/codegenerator/modulenamer.py +0 -0
  144. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/tools/codegenerator/packing.py +0 -0
  145. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes/typeinfo.py +0 -0
  146. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes.egg-info/dependency_links.txt +0 -0
  147. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes.egg-info/entry_points.txt +0 -0
  148. {comtypes-1.4.11 → comtypes-1.4.12}/comtypes.egg-info/top_level.txt +0 -0
  149. {comtypes-1.4.11 → comtypes-1.4.12}/setup.cfg +0 -0
  150. {comtypes-1.4.11 → comtypes-1.4.12}/setup.py +0 -0
@@ -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
1
  Metadata-Version: 2.4
2
2
  Name: comtypes
3
- Version: 1.4.11
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
@@ -25,7 +25,7 @@ Dynamic: license-file
25
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 Requires)](https://pypi.org/project/comtypes/)
26
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/)
27
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)
28
- [![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)
29
29
 
30
30
 
31
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
@@ -103,6 +104,7 @@ comtypes/test/test_ienum.py
103
104
  comtypes/test/test_imfattributes.py
104
105
  comtypes/test/test_inout_args.py
105
106
  comtypes/test/test_jscript.js
107
+ comtypes/test/test_messageloop.py
106
108
  comtypes/test/test_midl_safearray_create.py
107
109
  comtypes/test/test_monikers.py
108
110
  comtypes/test/test_msscript.py
@@ -123,7 +125,9 @@ comtypes/test/test_subinterface.py
123
125
  comtypes/test/test_typeannotator.py
124
126
  comtypes/test/test_typeinfo.py
125
127
  comtypes/test/test_urlhistory.py
128
+ comtypes/test/test_util.py
126
129
  comtypes/test/test_variant.py
130
+ comtypes/test/test_viewobject.py
127
131
  comtypes/test/test_w_getopt.py
128
132
  comtypes/test/test_win32com_interop.py
129
133
  comtypes/test/test_wmi.py
@@ -12,7 +12,6 @@ ignore = ["E402"]
12
12
  "comtypes/_vtbl.py" = ["E722"]
13
13
  "comtypes/automation.py" = ["F401", "F403", "F405"]
14
14
  "comtypes/git.py" = ["F401", "F403", "F405"]
15
- "comtypes/util.py" = ["F403", "F405"]
16
15
  "comtypes/viewobject.py" = ["F403", "F405"]
17
16
  "comtypes/client/_constants.py" = ["F401"]
18
17
  "comtypes/server/automation.py" = ["F403", "F405"]
@@ -40,3 +39,15 @@ ignore = ["E402"]
40
39
  "comtypes/test/test_subinterface.py" = ["E401", "F401", "F403", "F405"]
41
40
  "comtypes/test/test_urlhistory.py" = ["E401", "F401", "F403", "F405", "F841"]
42
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,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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes