comtypes 1.4.6__zip → 1.4.8__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 (138) hide show
  1. {comtypes-1.4.6 → comtypes-1.4.8}/CHANGES.txt +36 -0
  2. {comtypes-1.4.6/comtypes.egg-info → comtypes-1.4.8}/PKG-INFO +32 -38
  3. {comtypes-1.4.6 → comtypes-1.4.8}/README.md +30 -36
  4. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/__init__.py +1 -1
  5. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/_comobject.py +0 -1
  6. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/_memberspec.py +1 -1
  7. comtypes-1.4.8/comtypes/_meta.py +95 -0
  8. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/_npsupport.py +2 -1
  9. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/_post_coinit/__init__.py +1 -0
  10. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/_post_coinit/bstr.py +13 -6
  11. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/_post_coinit/misc.py +20 -39
  12. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/_post_coinit/unknwn.py +94 -69
  13. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/automation.py +9 -15
  14. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/client/__init__.py +21 -31
  15. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/client/_code_cache.py +1 -0
  16. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/client/_events.py +0 -1
  17. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/client/_generate.py +5 -5
  18. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/client/lazybind.py +0 -5
  19. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/git.py +1 -0
  20. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/hints.pyi +6 -4
  21. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/persist.py +19 -3
  22. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/safearray.py +2 -6
  23. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/server/__init__.py +1 -0
  24. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/server/register.py +1 -0
  25. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/shelllink.py +90 -34
  26. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/TestComServer.py +1 -1
  27. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/TestDispServer.py +1 -1
  28. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/__init__.py +0 -1
  29. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/find_memleak.py +0 -1
  30. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_agilent.py +0 -1
  31. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_clear_cache.py +1 -0
  32. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_client.py +9 -0
  33. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_createwrappers.py +0 -2
  34. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_dispinterface.py +0 -1
  35. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_excel.py +0 -1
  36. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_inout_args.py +1 -1
  37. comtypes-1.4.8/comtypes/test/test_monikers.py +70 -0
  38. comtypes-1.4.8/comtypes/test/test_persist.py +40 -0
  39. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_server.py +6 -0
  40. comtypes-1.4.8/comtypes/test/test_shelllink.py +129 -0
  41. comtypes-1.4.8/comtypes/test/test_storage.py +127 -0
  42. comtypes-1.4.8/comtypes/test/test_stream.py +131 -0
  43. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_typeannotator.py +1 -1
  44. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_urlhistory.py +1 -0
  45. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_variant.py +0 -2
  46. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/tools/codegenerator/namespaces.py +97 -27
  47. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/tools/codegenerator/typeannotator.py +2 -4
  48. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/tools/tlbparser.py +33 -32
  49. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/tools/typedesc.py +2 -2
  50. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/typeinfo.py +42 -43
  51. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/util.py +1 -0
  52. {comtypes-1.4.6 → comtypes-1.4.8/comtypes.egg-info}/PKG-INFO +32 -38
  53. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes.egg-info/SOURCES.txt +5 -1
  54. comtypes-1.4.8/pyproject.toml +54 -0
  55. {comtypes-1.4.6 → comtypes-1.4.8}/setup.cfg +1 -1
  56. comtypes-1.4.6/comtypes/_meta.py +0 -70
  57. comtypes-1.4.6/comtypes/test/test_istream.py +0 -53
  58. comtypes-1.4.6/pyproject.toml +0 -3
  59. {comtypes-1.4.6 → comtypes-1.4.8}/LICENSE.txt +0 -0
  60. {comtypes-1.4.6 → comtypes-1.4.8}/MANIFEST.in +0 -0
  61. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/GUID.py +0 -0
  62. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/_idl_stuff.py +0 -0
  63. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/_py_instance_method.py +0 -0
  64. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/_safearray.py +0 -0
  65. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/_tlib_version_checker.py +0 -0
  66. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/clear_cache.py +0 -0
  67. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/client/_constants.py +0 -0
  68. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/client/dynamic.py +0 -0
  69. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/connectionpoints.py +0 -0
  70. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/errorinfo.py +0 -0
  71. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/hresult.py +0 -0
  72. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/logutil.py +0 -0
  73. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/messageloop.py +0 -0
  74. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/patcher.py +0 -0
  75. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/server/automation.py +0 -0
  76. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/server/connectionpoints.py +0 -0
  77. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/server/inprocserver.py +0 -0
  78. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/server/localserver.py +0 -0
  79. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/server/w_getopt.py +0 -0
  80. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/stream.py +0 -0
  81. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/TestComServer.idl +0 -0
  82. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/TestComServer.tlb +0 -0
  83. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/TestDispServer.idl +0 -0
  84. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/TestDispServer.tlb +0 -0
  85. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/mylib.idl +0 -0
  86. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/mylib.tlb +0 -0
  87. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/mytypelib.idl +0 -0
  88. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/runtests.py +0 -0
  89. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/setup.py +0 -0
  90. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_BSTR.py +0 -0
  91. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_DISPPARAMS.py +0 -0
  92. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_GUID.py +0 -0
  93. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_QueryService.py +0 -0
  94. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_avmc.py +0 -0
  95. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_basic.py +0 -0
  96. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_casesensitivity.py +0 -0
  97. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_client_dynamic.py +0 -0
  98. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_client_regenerate_modules.py +0 -0
  99. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_collections.py +0 -0
  100. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_comserver.py +0 -0
  101. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_dict.py +0 -0
  102. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_dispifc_records.py +0 -0
  103. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_dispifc_safearrays.py +0 -0
  104. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_dyndispatch.py +0 -0
  105. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_findgendir.py +0 -0
  106. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_getactiveobj.py +0 -0
  107. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_ie.py +0 -0
  108. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_ienum.py +0 -0
  109. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_imfattributes.py +0 -0
  110. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_jscript.js +0 -0
  111. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_midl_safearray_create.py +0 -0
  112. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_msscript.py +0 -0
  113. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_npsupport.py +0 -0
  114. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_outparam.py +0 -0
  115. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_propputref.py +0 -0
  116. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_pump_events.py +0 -0
  117. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_recordinfo.py +0 -0
  118. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_safearray.py +0 -0
  119. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_sapi.py +0 -0
  120. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_showevents.py +0 -0
  121. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_subinterface.py +0 -0
  122. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_typeinfo.py +0 -0
  123. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_win32com_interop.py +0 -0
  124. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_wmi.py +0 -0
  125. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/test_word.py +0 -0
  126. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/test/urlhist.tlb +0 -0
  127. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/tools/__init__.py +0 -0
  128. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/tools/codegenerator/__init__.py +0 -0
  129. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/tools/codegenerator/codegenerator.py +0 -0
  130. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/tools/codegenerator/helpers.py +0 -0
  131. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/tools/codegenerator/modulenamer.py +0 -0
  132. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/tools/codegenerator/packing.py +0 -0
  133. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/tools/typedesc_base.py +0 -0
  134. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes/viewobject.py +0 -0
  135. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes.egg-info/dependency_links.txt +0 -0
  136. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes.egg-info/entry_points.txt +0 -0
  137. {comtypes-1.4.6 → comtypes-1.4.8}/comtypes.egg-info/top_level.txt +0 -0
  138. {comtypes-1.4.6 → comtypes-1.4.8}/setup.py +0 -0
@@ -34,6 +34,7 @@ longlong_type = typedesc.FundamentalType("long long int", 64, 64)
34
34
  ulonglong_type = typedesc.FundamentalType("long long unsigned int", 64, 64)
35
35
  float_type = typedesc.FundamentalType("float", 32, 32)
36
36
  double_type = typedesc.FundamentalType("double", 64, 64)
37
+ void_type = typedesc.FundamentalType("void", 0, 0)
37
38
 
38
39
  # basic COM data types
39
40
  BSTR_type = typedesc.Typedef("BSTR", PTR(wchar_t_type))
@@ -89,7 +90,7 @@ COMTYPES = {
89
90
  automation.VT_UI8: ulonglong_type, # 21
90
91
  automation.VT_INT: int_type, # 22
91
92
  automation.VT_UINT: uint_type, # 23
92
- automation.VT_VOID: typedesc.FundamentalType("void", 0, 0), # 24
93
+ automation.VT_VOID: void_type, # 24
93
94
  automation.VT_HRESULT: HRESULT_type, # 25
94
95
  automation.VT_LPSTR: PTR(char_type), # 30
95
96
  automation.VT_LPWSTR: PTR(wchar_t_type), # 31
@@ -126,20 +127,18 @@ class Parser(object):
126
127
  )
127
128
  return typ
128
129
  elif tdesc.vt == automation.VT_PTR:
129
- ptrdesc: typeinfo.TYPEDESC = tdesc._.lptdesc[0]
130
- typ = self.make_type(ptrdesc, tinfo)
131
- return PTR(typ)
130
+ return PTR(self.make_type(tdesc._.lptdesc[0], tinfo))
132
131
  elif tdesc.vt == automation.VT_USERDEFINED:
133
132
  try:
134
133
  ti = tinfo.GetRefTypeInfo(tdesc._.hreftype)
135
134
  except COMError as details:
136
- type_name = "__error_hreftype_%d__" % tdesc._.hreftype
135
+ type_name = f"__error_hreftype_{tdesc._.hreftype:d}__"
137
136
  tlib_name = get_tlib_filename(self.tlib)
138
137
  if tlib_name is None:
139
138
  tlib_name = "unknown typelib"
140
139
  message = (
141
- "\n\tGetRefTypeInfo failed in %s: %s\n\tgenerating type '%s' instead"
142
- % (tlib_name, details, type_name)
140
+ f"\n\tGetRefTypeInfo failed in {tlib_name}: {details}"
141
+ f"\n\tgenerating type '{type_name}' instead"
143
142
  )
144
143
  import warnings
145
144
 
@@ -153,8 +152,7 @@ class Parser(object):
153
152
  return result
154
153
  elif tdesc.vt == automation.VT_SAFEARRAY:
155
154
  # SAFEARRAY(<type>), see Don Box pp.331f
156
- safearraydesc: typeinfo.TYPEDESC = tdesc._.lptdesc[0]
157
- return midlSAFEARRAY(self.make_type(safearraydesc, tinfo))
155
+ return midlSAFEARRAY(self.make_type(tdesc._.lptdesc[0], tinfo))
158
156
  raise NotImplementedError(tdesc.vt)
159
157
 
160
158
  ################################################################
@@ -271,7 +269,7 @@ class Parser(object):
271
269
  # Don't known what artefact that is - we ignore it.
272
270
  # It's an interface without methods anyway.
273
271
  if itf_name != "IOleControlTypes":
274
- message = "Ignoring interface %s which has no base interface" % itf_name
272
+ message = f"Ignoring interface {itf_name} which has no base interface"
275
273
  import warnings
276
274
 
277
275
  warnings.warn(message, UserWarning)
@@ -591,33 +589,26 @@ class Parser(object):
591
589
  self, name: Optional[str], value: Any, tlib: Optional[typeinfo.ITypeLib] = None
592
590
  ) -> None:
593
591
  modname = self._typelib_module(tlib)
594
- fullname = "%s.%s" % (modname, name)
592
+ fullname = f"{modname}.{name}"
595
593
  if fullname in self.items:
596
594
  # XXX Can we really allow this? It happens, at least.
597
595
  if isinstance(value, typedesc.External):
598
596
  return
599
597
  # BUG: We try to register an item that's already registered.
600
- raise ValueError("Bug: Multiple registered name '%s': %r" % (name, value))
598
+ raise ValueError(f"Bug: Multiple registered name '{name}': {value!r}")
601
599
  self.items[fullname] = value
602
600
 
603
601
  def parse_typeinfo(self, tinfo: typeinfo.ITypeInfo) -> Any:
604
602
  name = tinfo.GetDocumentation(-1)[0]
605
603
  modname = self._typelib_module()
606
604
  try:
607
- return self.items["%s.%s" % (modname, name)]
605
+ return self.items[f"{modname}.{name}"]
608
606
  except KeyError:
609
607
  pass
610
608
 
611
609
  tlib = tinfo.GetContainingTypeLib()[0]
612
610
  if tlib != self.tlib:
613
- ta = tinfo.GetTypeAttr()
614
- size = ta.cbSizeInstance * 8
615
- align = ta.cbAlignment * 8
616
- typ = typedesc.External(
617
- tlib, name, size, align, tlib.GetDocumentation(-1)[:2]
618
- )
619
- self._register(name, typ, tlib)
620
- return typ
611
+ return self._parse_External(name, tlib, tinfo)
621
612
 
622
613
  ta = tinfo.GetTypeAttr()
623
614
  tkind = ta.typekind
@@ -638,10 +629,7 @@ class Parser(object):
638
629
  except COMError:
639
630
  # no dual interface
640
631
  return self.ParseDispatch(tinfo, ta)
641
- tinfo = tinfo.GetRefTypeInfo(href)
642
- ta = tinfo.GetTypeAttr()
643
- assert ta.typekind == typeinfo.TKIND_INTERFACE
644
- return self.ParseInterface(tinfo, ta)
632
+ return self._parse_DualInterface(tinfo.GetRefTypeInfo(href))
645
633
  elif tkind == typeinfo.TKIND_COCLASS: # 5
646
634
  return self.ParseCoClass(tinfo, ta)
647
635
  elif tkind == typeinfo.TKIND_ALIAS: # 6
@@ -652,6 +640,24 @@ class Parser(object):
652
640
  print("NYI", tkind)
653
641
  # raise "NYI", tkind
654
642
 
643
+ def _parse_DualInterface(
644
+ self, tinfo: typeinfo.ITypeInfo
645
+ ) -> Optional[typedesc.ComInterface]:
646
+ ta = tinfo.GetTypeAttr()
647
+ assert ta.typekind == typeinfo.TKIND_INTERFACE
648
+ return self.ParseInterface(tinfo, ta)
649
+
650
+ def _parse_External(
651
+ self, name: str, tlib: typeinfo.ITypeLib, tinfo: typeinfo.ITypeInfo
652
+ ) -> typedesc.External:
653
+ ta = tinfo.GetTypeAttr()
654
+ size = ta.cbSizeInstance * 8
655
+ align = ta.cbAlignment * 8
656
+ docs = tlib.GetDocumentation(-1)[:2]
657
+ typ = typedesc.External(tlib, name, size, align, docs)
658
+ self._register(name, typ, tlib)
659
+ return typ
660
+
655
661
  def parse_LibraryDescription(self):
656
662
  la = self.tlib.GetLibAttr()
657
663
  name, doc = self.tlib.GetDocumentation(-1)[:2]
@@ -731,18 +737,13 @@ class TypeLibParser(Parser):
731
737
  # path = r"c:\vc98\include\activscp.tlb"
732
738
 
733
739
 
734
- def get_tlib_filename(tlib):
740
+ def get_tlib_filename(tlib: typeinfo.ITypeLib) -> Optional[str]:
735
741
  # seems if the typelib is not registered, there's no way to
736
742
  # determine the filename.
737
743
  la = tlib.GetLibAttr()
738
744
  name = BSTR()
739
- try:
740
- windll.oleaut32.QueryPathOfRegTypeLib
741
- except AttributeError:
742
- # Windows CE doesn't have this function
743
- return None
744
745
  if 0 == windll.oleaut32.QueryPathOfRegTypeLib(
745
- byref(la.guid), la.wMajorVerNum, la.wMinorVerNum, 0, byref(name) # lcid
746
+ byref(la.guid), la.wMajorVerNum, la.wMinorVerNum, 0, byref(name)
746
747
  ):
747
748
  full_filename = name.value.split("\0")[0]
748
749
  if not os.path.isabs(full_filename):
@@ -49,7 +49,7 @@ class External(object):
49
49
  name: str,
50
50
  size: int,
51
51
  align: int,
52
- docs: Optional[Tuple[str, str]] = None,
52
+ docs: Optional[Tuple[str, Optional[str]]] = None,
53
53
  ) -> None:
54
54
  # the type library containing the symbol
55
55
  self.tlib = tlib
@@ -238,7 +238,7 @@ _SourceInterfaces = Sequence[_Interface]
238
238
 
239
239
 
240
240
  def groupby_impltypeflags(
241
- seq: Sequence[Tuple[_Interface, _ImplTypeFlags]]
241
+ seq: Sequence[Tuple[_Interface, _ImplTypeFlags]],
242
242
  ) -> Tuple[_ImplementedInterfaces, _SourceInterfaces]:
243
243
  implemented = []
244
244
  sources = []
@@ -3,7 +3,6 @@
3
3
  # generated by 'xml2py'
4
4
  # flags '..\tools\windows.xml -m comtypes -m comtypes.automation -w -r .*TypeLibEx -r .*TypeLib -o typeinfo.py'
5
5
  # then hacked manually
6
- import os
7
6
  import sys
8
7
  from typing import Any, overload, TypeVar, TYPE_CHECKING
9
8
  from typing import List, Type, Tuple
@@ -14,7 +13,7 @@ import weakref
14
13
  import ctypes
15
14
  from ctypes import HRESULT, POINTER, _Pointer, byref, c_int, c_void_p, c_wchar_p
16
15
  from ctypes.wintypes import DWORD, LONG, UINT, ULONG, WCHAR, WORD
17
- from comtypes import BSTR, _CData, COMMETHOD, _GUID, GUID, IID, IUnknown, STDMETHOD
16
+ from comtypes import BSTR, _CData, COMMETHOD, GUID, IID, IUnknown, STDMETHOD
18
17
  from comtypes.automation import DISPID, LCID, SCODE
19
18
  from comtypes.automation import DISPPARAMS, EXCEPINFO, VARIANT, VARIANTARG, VARTYPE
20
19
 
@@ -219,7 +218,9 @@ class ITypeLib(IUnknown):
219
218
  """Return an ITypeComp pointer."""
220
219
  ...
221
220
 
222
- def GetDocumentation(self, index: int) -> Tuple[str, str, int, Optional[str]]:
221
+ def GetDocumentation(
222
+ self, index: int
223
+ ) -> Tuple[str, Optional[str], int, Optional[str]]:
223
224
  """Return documentation for a type description."""
224
225
  ...
225
226
 
@@ -227,11 +228,12 @@ class ITypeLib(IUnknown):
227
228
  """Release TLIBATTR"""
228
229
  ...
229
230
 
230
- _GetLibAttr: Callable[[], "_Pointer[TLIBATTR]"]
231
-
232
231
  def GetLibAttr(self) -> "TLIBATTR":
233
232
  """Return type library attributes"""
234
- return _deref_with_release(self._GetLibAttr(), self.ReleaseTLibAttr)
233
+ return _deref_with_release(
234
+ self._GetLibAttr(), # type: ignore
235
+ self.ReleaseTLibAttr,
236
+ )
235
237
 
236
238
  def IsName(self, name: str, lHashVal: int = 0) -> Optional[str]:
237
239
  """Check if there is type information for this name.
@@ -268,15 +270,9 @@ class ITypeLib(IUnknown):
268
270
 
269
271
 
270
272
  @overload
271
- def fix_name(name: None) -> None:
272
- pass
273
-
274
-
273
+ def fix_name(name: None) -> None: ...
275
274
  @overload
276
- def fix_name(name: str) -> str:
277
- pass
278
-
279
-
275
+ def fix_name(name: str) -> str: ...
280
276
  def fix_name(name):
281
277
  # Some typelibs contain BSTR with embedded NUL characters,
282
278
  # probably the len of the BSTR is wrong.
@@ -341,27 +337,33 @@ class ITypeInfo(IUnknown):
341
337
  """Releases a VARDESC previously returned by VarDesc"""
342
338
  ...
343
339
 
344
- _GetTypeAttr: Callable[[], "_Pointer[TYPEATTR]"]
345
- _GetFuncDesc: Callable[[int], "_Pointer[FUNCDESC]"]
346
- _GetVarDesc: Callable[[int], "_Pointer[VARDESC]"]
347
- _GetDocumentation: Callable[[int], Tuple[str, str, int, Optional[str]]]
348
-
349
- def GetTypeAttr(self):
340
+ def GetTypeAttr(self) -> "TYPEATTR":
350
341
  """Return the TYPEATTR for this type"""
351
- return _deref_with_release(self._GetTypeAttr(), self.ReleaseTypeAttr)
342
+ return _deref_with_release(
343
+ self._GetTypeAttr(), # type: ignore
344
+ self.ReleaseTypeAttr,
345
+ )
352
346
 
353
- def GetDocumentation(self, memid):
347
+ def GetDocumentation(
348
+ self, memid: int
349
+ ) -> Tuple[str, Optional[str], int, Optional[str]]:
354
350
  """Return name, docstring, helpcontext, and helpfile for 'memid'."""
355
- name, doc, helpcontext, helpfile = self._GetDocumentation(memid)
356
- return fix_name(name), fix_name(doc), helpcontext, fix_name(helpfile)
351
+ name, doc, helpctx, helpfile = self._GetDocumentation(memid) # type: ignore
352
+ return fix_name(name), fix_name(doc), helpctx, fix_name(helpfile)
357
353
 
358
- def GetFuncDesc(self, index):
354
+ def GetFuncDesc(self, index: int) -> "FUNCDESC":
359
355
  """Return FUNCDESC for index"""
360
- return _deref_with_release(self._GetFuncDesc(index), self.ReleaseFuncDesc)
356
+ return _deref_with_release(
357
+ self._GetFuncDesc(index), # type: ignore
358
+ self.ReleaseFuncDesc,
359
+ )
361
360
 
362
- def GetVarDesc(self, index):
361
+ def GetVarDesc(self, index: int) -> "VARDESC":
363
362
  """Return VARDESC for index"""
364
- return _deref_with_release(self._GetVarDesc(index), self.ReleaseVarDesc)
363
+ return _deref_with_release(
364
+ self._GetVarDesc(index), # type: ignore
365
+ self.ReleaseVarDesc,
366
+ )
365
367
 
366
368
  def GetNames(self, memid: int, count: int = 1) -> List[str]:
367
369
  """Return names for memid"""
@@ -455,13 +457,12 @@ class ICreateTypeLib2(ICreateTypeLib):
455
457
  class ICreateTypeInfo(IUnknown):
456
458
  _iid_ = GUID("{00020405-0000-0000-C000-000000000046}")
457
459
  # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 915
458
- _SetFuncAndParamNames: Callable[[int, "ctypes.Array[c_wchar_p]", int], int]
459
460
 
460
461
  def SetFuncAndParamNames(self, index: int, *names: str) -> int:
461
462
  rgszNames = (c_wchar_p * len(names))()
462
463
  for i, n in enumerate(names):
463
464
  rgszNames[i] = n
464
- return self._SetFuncAndParamNames(index, rgszNames, len(names))
465
+ return self._SetFuncAndParamNames(index, rgszNames, len(names)) # type: ignore
465
466
 
466
467
 
467
468
  class IRecordInfo(IUnknown):
@@ -478,25 +479,23 @@ class IRecordInfo(IUnknown):
478
479
  return result
479
480
 
480
481
  if TYPE_CHECKING:
481
- # fmt: off
482
482
  # def RecordInit
483
483
  # def RecordClear
484
- def RecordCopy( # noqa
484
+ def RecordCopy(
485
485
  self, pvExisting: hints.Incomplete, pvNew: hints.Incomplete
486
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
487
+ def GetGuid(self) -> GUID: ...
488
+ def GetName(self) -> str: ...
489
+ def GetSize(self) -> int: ...
490
+ def GetTypeInfo(self) -> ITypeInfo: ...
491
491
  # def GetField
492
492
  # def GetFieldNoCopy
493
493
  # def PutField
494
494
  # def PutFieldNoCopy
495
- def IsMatchingType(self, value: "IRecordInfo") -> bool: ... # noqa
495
+ def IsMatchingType(self, value: "IRecordInfo") -> bool: ...
496
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
497
+ def RecordCreateCopy(self, pvSource: hints.Incomplete) -> int: ...
498
+ def RecordDestroy(self, pvRecord: hints.Incomplete) -> hints.Hresult: ...
500
499
 
501
500
 
502
501
  IRecordInfo._methods_ = [
@@ -1122,8 +1121,8 @@ tagTLIBATTR._fields_ = [
1122
1121
  class N11tagTYPEDESC5DOLLAR_203E(ctypes.Union):
1123
1122
  # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 584
1124
1123
  if TYPE_CHECKING:
1125
- lptdesc: TYPEDESC
1126
- lpadesc: tagARRAYDESC
1124
+ lptdesc: _Pointer[tagTYPEDESC]
1125
+ lpadesc: _Pointer[tagARRAYDESC]
1127
1126
  hreftype: int
1128
1127
 
1129
1128
 
@@ -1172,7 +1171,7 @@ class N10tagVARDESC5DOLLAR_205E(ctypes.Union):
1172
1171
  # C:/Programme/gccxml/bin/Vc71/PlatformSDK/oaidl.h 807
1173
1172
  if TYPE_CHECKING:
1174
1173
  oInst: int
1175
- lpvarValue: VARIANT
1174
+ lpvarValue: _Pointer[VARIANT]
1176
1175
 
1177
1176
 
1178
1177
  N10tagVARDESC5DOLLAR_205E._fields_ = [
@@ -1,6 +1,7 @@
1
1
  """This module defines the funtions byref_at(cobj, offset)
2
2
  and cast_field(struct, fieldname, fieldtype).
3
3
  """
4
+
4
5
  from ctypes import *
5
6
 
6
7
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: comtypes
3
- Version: 1.4.6
3
+ Version: 1.4.8
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
@@ -13,58 +13,53 @@ Classifier: Operating System :: Microsoft :: Windows
13
13
  Classifier: Programming Language :: Python
14
14
  Classifier: Programming Language :: Python :: 3
15
15
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
- Requires-Python: >=3.7
16
+ Requires-Python: >=3.8
17
17
  Description-Content-Type: text/markdown
18
18
  License-File: LICENSE.txt
19
19
 
20
20
  # comtypes
21
21
 
22
22
  ![Works on Windows only](https://img.shields.io/badge/-Windows-0078D6.svg?logo=windows&style=flat)
23
- [![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 - 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/)
24
- [![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)
23
+ [![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/)
24
+ [![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/)
25
+ [![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)
25
26
  [![Tidelift Subscription](https://tidelift.com/badges/package/pypi/comtypes)](https://tidelift.com/subscription/pkg/pypi-comtypes?utm_source=pypi-comtypes&utm_medium=readme)
26
27
 
27
- ## About
28
28
 
29
- `comtypes` is a lightweight `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) FFI library.
29
+ `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.
30
30
 
31
- `comtypes` allows to define, call, and implement custom and dispatch-based COM interfaces in pure `Python`.
31
+ `comtypes` allows you to define, call, and implement custom and dispatch-based COM interfaces in pure Python.
32
32
 
33
- This package works on Windows only.
33
+ `comtypes` requires Windows and Python 3.8 or later.
34
+ - Version <= [1.4.7](https://pypi.org/project/comtypes/1.4.7/) does not work with Python 3.13 as reported in [GH-618](https://github.com/enthought/comtypes/issues/618). Version [1.4.8](https://pypi.org/project/comtypes/1.4.8/) can work with Python 3.13.
35
+ - Version [1.4.6](https://pypi.org/project/comtypes/1.4.6/) is the last version to support Python 3.7.
36
+ - Version [1.2.1](https://pypi.org/project/comtypes/1.2.1/) is the last version to support Python 2.7 and 3.3–3.6.
37
+ - `comtypes` does not work with Python 3.8.1 as reported in [GH-202](https://github.com/enthought/comtypes/issues/202). This bug has been fixed in Python >= 3.8.2.
38
+ - Certain `comtypes` functions may not work correctly in Python 3.8 and 3.9 as reported in [GH-212](https://github.com/enthought/comtypes/issues/212). This bug has been fixed in Python >= 3.10.10 and >= 3.11.2.
34
39
 
35
- Available on `Python` 3.7-3.12.
36
- - [`comtypes==1.2.1`](https://pypi.org/project/comtypes/1.2.1/) is the last version supporting `Python` 2.7 and 3.3-3.6.
37
- - In `Python` 3.7.6 and 3.8.1, `comtypes` would not work as reported in [GH-202](https://github.com/enthought/comtypes/issues/202).
38
- This bug has been fixed in `Python` >= 3.7.7 and >= 3.8.2.
39
- - In `Python` 3.8 and 3.9, some of `comtypes` functionalities may not work correctly as reported in [GH-212](https://github.com/enthought/comtypes/issues/212).
40
- This bug has been fixed in `Python` >= 3.10.10 and >= 3.11.2.
41
-
42
- ## Where to get it
43
-
44
- The source code is currently hosted on GitHub at:
45
- https://github.com/enthought/comtypes
46
-
47
- An installer for the latest released version is available at the [Python Package Index (PyPI)](https://pypi.org/project/comtypes).
40
+ ## Installation
48
41
 
42
+ `comtypes` is available on [PyPI](https://pypi.org/project/comtypes) and can be installed with `pip`:
49
43
  ```sh
50
44
  # PyPI
51
45
  pip install comtypes
52
46
  ```
53
47
 
54
- ## Dependencies
48
+ The source code is currently hosted [here](https://github.com/enthought/comtypes) on GitHub.
49
+
50
+ ### Dependencies
55
51
 
56
- `comtypes` requires no third-party packages to run - this is truly **pure** `Python` package.
52
+ `comtypes` is a pure Python package — it has no additional required dependencies.
57
53
 
58
- Optional features include the follows...
59
- - to process arrays as `numpy`'s `ndarray`
60
- - type hints be interpreted by `mypy` or several static type checkers
54
+ Optional functionalities can be enabled by installing:
55
+ - `numpy`, in order to process arrays as `numpy`'s `ndarray`.
56
+ - `mypy` or other static type checkers, in order to interpret type hints.
61
57
 
62
- But these third-parties are not required as a prerequisite for runtime.
58
+ None of these packages, however, are required in order to run `comtypes`.
63
59
 
64
- ## Community of the developers
60
+ ## Community
65
61
 
66
- Tracking issues, reporting bugs and contributing to the codebase and documentation are on GitHub at:
67
- https://github.com/enthought/comtypes
62
+ The [GitHub repository](https://github.com/enthought/comtypes) is used for tracking issues, reporting bugs, and contributing to the codebase and documentation.
68
63
 
69
64
  ## For Enterprise
70
65
 
@@ -77,17 +72,17 @@ This project and the maintainers of thousands of other packages are working with
77
72
  ## Frequently Asked Questions
78
73
 
79
74
  ### Q: Why does this package not support platforms other than Windows?
80
- **A:** [The Microsoft Component Object Model (COM)](https://learn.microsoft.com/en-us/windows/win32/com/com-technical-overview) is a technology that is unique to Windows and is not supported on other platforms.
75
+ **A:** The [Microsoft Component Object Model (COM)](https://learn.microsoft.com/en-us/windows/win32/com/com-technical-overview) is a technology that is unique to Windows and is not supported on other platforms.
81
76
 
82
77
  [The phrase _"COM is a platform-independent"_ in the MS documentation](https://learn.microsoft.com/en-us/windows/win32/com/component-object-model--com--portal) means that COM maintains compatibility across different versions of Windows, and does NOT imply that it is supported on Linux or Mac.
83
78
 
84
- As long as COM is not supported outside of Windows, this project does not plan to port to other platforms.
79
+ For as long as COM is not supported outside of Windows, there is no plan to port `comtypes` to other platforms.
85
80
 
86
81
  ### Q: Why does `cannot import name 'COMError' from '_ctypes'` error occur when using this package on platforms other than Windows?
87
- **A:** The [`_ctypes`](https://github.com/python/cpython/blob/main/Modules/_ctypes/_ctypes.c) is part of the internal implementation of the [`ctypes`](https://github.com/python/cpython/blob/main/Lib/ctypes/) standard library that exists for Python on all platforms.
88
- However, `COMError` and COM-related features are implemented only in Python for Windows.
82
+ **A:** The [`_ctypes`](https://github.com/python/cpython/blob/main/Modules/_ctypes/_ctypes.c) is part of the internal implementation of the [`ctypes`](https://github.com/python/cpython/blob/main/Lib/ctypes/) standard library that exists for Python on all platforms.
83
+ However, `COMError` and COM-related features are only implemented in Python for Windows.
89
84
 
90
- In cross-platform software development, care must be taken to ensure that codebase dependent on `comtypes` does not execute in environments other than Windows.
85
+ In cross-platform software development, care must be taken to ensure that codebases that depend on `comtypes` do not execute in environments other than Windows.
91
86
 
92
87
  ### Q: Despite a script that depends on `comtypes` having run successfully before, a error (`ImportError`, `NameError`, or `SyntaxError`) is raised now, and the same error occurs again and again.
93
88
 
@@ -102,7 +97,6 @@ After deleting these partial modules and running the script again, `comtypes.cli
102
97
 
103
98
  However, if the script implementation does not use `comtypes.client.GetModule` or processes generated files, it may not be a solution.
104
99
 
105
- ## Documentation:
100
+ ## Documentation
106
101
 
107
- The documentation is currently hosted on pythonhosted at:
108
- https://pythonhosted.org/comtypes
102
+ The documentation is currently hosted [here](https://pythonhosted.org/comtypes) on PythonHosted.
@@ -95,19 +95,23 @@ comtypes/test/test_ie.py
95
95
  comtypes/test/test_ienum.py
96
96
  comtypes/test/test_imfattributes.py
97
97
  comtypes/test/test_inout_args.py
98
- comtypes/test/test_istream.py
99
98
  comtypes/test/test_jscript.js
100
99
  comtypes/test/test_midl_safearray_create.py
100
+ comtypes/test/test_monikers.py
101
101
  comtypes/test/test_msscript.py
102
102
  comtypes/test/test_npsupport.py
103
103
  comtypes/test/test_outparam.py
104
+ comtypes/test/test_persist.py
104
105
  comtypes/test/test_propputref.py
105
106
  comtypes/test/test_pump_events.py
106
107
  comtypes/test/test_recordinfo.py
107
108
  comtypes/test/test_safearray.py
108
109
  comtypes/test/test_sapi.py
109
110
  comtypes/test/test_server.py
111
+ comtypes/test/test_shelllink.py
110
112
  comtypes/test/test_showevents.py
113
+ comtypes/test/test_storage.py
114
+ comtypes/test/test_stream.py
111
115
  comtypes/test/test_subinterface.py
112
116
  comtypes/test/test_typeannotator.py
113
117
  comtypes/test/test_typeinfo.py
@@ -0,0 +1,54 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.2"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [tool.ruff.lint]
6
+ ignore = ["E402"]
7
+
8
+ [tool.ruff.lint.per-file-ignores]
9
+ # production
10
+ "comtypes/_comobject.py" = ["E713", "E722", "F401"]
11
+ "comtypes/_npsupport.py" = ["F401"]
12
+ "comtypes/connectionpoints.py" = ["F401", "F403", "F405"]
13
+ "comtypes/automation.py" = ["F401", "F403", "F405"]
14
+ "comtypes/errorinfo.py" = ["F403", "F405"]
15
+ "comtypes/git.py" = ["F401", "F403", "F405"]
16
+ "comtypes/logutil.py" = ["E401"]
17
+ "comtypes/shelllink.py" = ["F401"]
18
+ "comtypes/util.py" = ["F403", "F405"]
19
+ "comtypes/viewobject.py" = ["F403", "F405"]
20
+ "comtypes/_post_coinit/unknwn.py" = ["F821"]
21
+ "comtypes/client/__init__.py" = ["F401", "F403"]
22
+ "comtypes/client/_code_cache.py" = ["E401", "E711"]
23
+ "comtypes/client/_constants.py" = ["F401"]
24
+ "comtypes/client/_events.py" = ["F841"]
25
+ "comtypes/client/lazybind.py" = ["F821"]
26
+ "comtypes/server/__init__.py" = ["E401"]
27
+ "comtypes/server/automation.py" = ["F403", "F405"]
28
+ "comtypes/server/connectionpoints.py" = ["F401", "F403", "F405"]
29
+ "comtypes/server/inprocserver.py" = ["E713", "E722", "F403", "F405", "F841"]
30
+ "comtypes/server/localserver.py" = ["F401", "F403", "F405"]
31
+ "comtypes/server/register.py" = ["F403", "F405", "E713", "E731"]
32
+ "comtypes/tools/codegenerator/codegenerator.py" = ["E713", "E721"]
33
+ "comtypes/tools/codegenerator/helpers.py" = ["F401"]
34
+ "comtypes/tools/codegenerator/packing.py" = ["F821", "F841"]
35
+ "comtypes/tools/tlbparser.py" = ["F401"]
36
+ "comtypes/tools/typedesc.py" = ["F403", "F405"]
37
+ "comtypes/tools/typedesc_base.py" = ["F401"]
38
+ # tests
39
+ "comtypes/test/TestComServer.py" = ["E401", "F401", "F403", "F405"]
40
+ "comtypes/test/TestDispServer.py" = ["E401"]
41
+ "comtypes/test/find_memleak.py" = ["E401", "F401", "F403", "F405"]
42
+ "comtypes/test/setup.py" = ["F401"]
43
+ "comtypes/test/test_BSTR.py" = ["E401", "F401", "F403", "F405"]
44
+ "comtypes/test/test_agilent.py" = ["F401", "F841"]
45
+ "comtypes/test/test_client.py" = ["F401"]
46
+ "comtypes/test/test_dict.py" = ["F841"]
47
+ "comtypes/test/test_ie.py" = ["F403", "F405", "F841"]
48
+ "comtypes/test/test_outparam.py" = ["F403", "F405", "F841"]
49
+ "comtypes/test/test_sapi.py" = ["E401"]
50
+ "comtypes/test/test_server.py" = ["E401", "E722", "F401", "F841"]
51
+ "comtypes/test/test_subinterface.py" = ["E401", "F401", "F403", "F405"]
52
+ "comtypes/test/test_typeinfo.py" = ["F401"]
53
+ "comtypes/test/test_urlhistory.py" = ["E401", "F401", "F403", "F405", "F841"]
54
+ "comtypes/test/test_variant.py" = ["F401", "F821", "F841"]
@@ -18,7 +18,7 @@ classifiers =
18
18
  Topic :: Software Development :: Libraries :: Python Modules
19
19
 
20
20
  [options]
21
- python_requires = >=3.7
21
+ python_requires = >=3.8
22
22
  packages =
23
23
  comtypes
24
24
  comtypes._post_coinit
@@ -1,70 +0,0 @@
1
- # comtypes._meta helper module
2
- from ctypes import POINTER, c_void_p, cast
3
- import comtypes
4
-
5
- ################################################################
6
- # metaclass for CoClass (in comtypes/__init__.py)
7
-
8
-
9
- def _wrap_coclass(self):
10
- # We are an IUnknown pointer, represented as a c_void_p instance,
11
- # but we really want this interface:
12
- itf = self._com_interfaces_[0]
13
- punk = cast(self, POINTER(itf))
14
- result = punk.QueryInterface(itf)
15
- result.__dict__["__clsid"] = str(self._reg_clsid_)
16
- return result
17
-
18
-
19
- def _coclass_from_param(cls, obj):
20
- if isinstance(obj, (cls._com_interfaces_[0], cls)):
21
- return obj
22
- raise TypeError(obj)
23
-
24
-
25
- #
26
- # The mro() of a POINTER(App) type, where class App is a subclass of CoClass:
27
- #
28
- # POINTER(App)
29
- # App
30
- # CoClass
31
- # c_void_p
32
- # _SimpleCData
33
- # _CData
34
- # object
35
-
36
-
37
- class _coclass_meta(type):
38
- # metaclass for CoClass
39
- #
40
- # When a CoClass subclass is created, create a POINTER(...) type
41
- # for that class, with bases <coclass> and c_void_p. Also, the
42
- # POINTER(...) type gets a __ctypes_from_outparam__ method which
43
- # will QueryInterface for the default interface: the first one on
44
- # the coclass' _com_interfaces_ list.
45
- def __new__(cls, name, bases, namespace):
46
- klass = type.__new__(cls, name, bases, namespace)
47
- if bases == (object,):
48
- return klass
49
- # XXX We should insist that a _reg_clsid_ is present.
50
- if "_reg_clsid_" in namespace:
51
- clsid = namespace["_reg_clsid_"]
52
- comtypes.com_coclass_registry[str(clsid)] = klass
53
- PTR = _coclass_pointer_meta(
54
- "POINTER(%s)" % klass.__name__,
55
- (klass, c_void_p),
56
- {
57
- "__ctypes_from_outparam__": _wrap_coclass,
58
- "from_param": classmethod(_coclass_from_param),
59
- },
60
- )
61
- from ctypes import _pointer_type_cache
62
-
63
- _pointer_type_cache[klass] = PTR
64
-
65
- return klass
66
-
67
-
68
- # will not work if we change the order of the two base classes!
69
- class _coclass_pointer_meta(type(c_void_p), _coclass_meta):
70
- pass