enthought / comtypes

A pure Python, lightweight COM client and server framework, based on the ctypes Python FFI package.
Other
292 stars 98 forks source link

Refactor from `%` string formatting to f-strings in every module. #657

Open junkmd opened 1 week ago

junkmd commented 1 week ago

We could replace % string formatting with f-strings wherever applicable, as was done in #654.

For details on f-string syntax, refer to the Python official documentation.

newwingbird commented 6 hours ago

I looked for the use location by git grep -n '%[sdxXorfFeEgGc]'

I will split modification into several PRs by file or dir.

result ``` admin/svndumpfilter2:183: self.prop = self.prop + "D %d" % len(key) + "\n" + key + "\n" admin/svndumpfilter2:185: self.prop = self.prop + "K %d" % len(key) + "\n" + key + "\n" admin/svndumpfilter2:186: self.prop = self.prop + "V %d" % len(val) + "\n" + val + "\n" admin/svndumpfilter2:290: treecmd = "svnlook tree -r%d %s %s" % \ admin/svndumpfilter2:312: props = os.popen("svnlook pl -r%d %s %s" % \ admin/svndumpfilter2:319: propf = os.popen("svnlook pg -r%d %s %s %s" % \ admin/svndumpfilter2:329: f = os.popen("svnlook cat -r%d %s %s" % \ comtypes/__init__.py:137: logger.debug("CoInitializeEx(None, %s)", flags) comtypes/_comobject.py:79: "Expected comtypes.COMERROR or WindowsError instance, got %s" comtypes/_comobject.py:87: _debug("unimplemented method %s_%s called", interface_name, method_name) comtypes/_comobject.py:104: "Exception in %s.%s implementation:", comtypes/_comobject.py:111: _warning("Unimplemented method %s.%s called", interface.__name__, mthname) comtypes/_comobject.py:115: "Exception in %s.%s implementation:", comtypes/_comobject.py:181: msg = "Method should have returned a %s-tuple" % args_out comtypes/_comobject.py:191: "Exception in %s.%s implementation:", comtypes/_comobject.py:201: msg = "%s: %s" % (source, descr) comtypes/_comobject.py:206: "Exception in %s.%s implementation:", comtypes/_comobject.py:214: _warning("Unimplemented method %s.%s called", interface.__name__, mthname) comtypes/_comobject.py:218: "Exception in %s.%s implementation:", comtypes/_comobject.py:254: fq_name = "%s_%s" % (interface.__name__, mthname) comtypes/_comobject.py:276: _debug("%r: %s.%s not implemented", self.inst, interface.__name__, mthname) comtypes/_comobject.py:309: Vtbl.__name__ = "Vtbl_%s" % itf.__name__ comtypes/_comobject.py:592: _debug("%d active COM objects: Added %r", len(COMObject._instances_), obj) comtypes/_comobject.py:601: _debug("? active COM objects: Removed %r", obj) comtypes/_comobject.py:603: _debug("%d active COM objects: Removed %r", len(COMObject._instances_), obj) comtypes/_comobject.py:604: _debug("Remaining: %s", list(COMObject._instances_.keys())) comtypes/_comobject.py:619: _debug("%r.AddRef() -> %s", self, result) comtypes/_comobject.py:635: _debug("%r.Release() -> %s", self, result) comtypes/_comobject.py:650: _debug("%r.QueryInterface(%s) -> S_OK", self, iid) comtypes/_comobject.py:652: _debug("%r.QueryInterface(%s) -> E_NOINTERFACE", self, iid) comtypes/_memberspec.py:67: # msg = ("'optional' only allowed for VARIANT and VARIANT*, not for %s" % typ.__name__) comtypes/_memberspec.py:179: name = "_get_%s" % methodname comtypes/_memberspec.py:181: name = "_set_%s" % methodname comtypes/_memberspec.py:183: name = "_setref_%s" % methodname comtypes/_memberspec.py:385: prop = named_property("%s.%s" % (self._cls_name, name), fget, fset, doc) comtypes/_memberspec.py:608: return "" % (self.name, id(self)) comtypes/_memberspec.py:612: msg = "%r is not iterable" % self.name comtypes/_memberspec.py:633: return "" % (self.name, id(self)) comtypes/_post_coinit/_cominterface_meta_patcher.py:125: msg = "%r object does not support item assignment" comtypes/_post_coinit/unknwn.py:280: _debug("Release %s", self) comtypes/automation.py:212: return "VARIANT(vt=0x%x, byref(%r))" % (self.vt, self[0]) comtypes/automation.py:219: return "VARIANT(vt=0x%x, %r)" % (self.vt, self.value) comtypes/automation.py:428: raise TypeError("Cannot put %r in VARIANT" % value) comtypes/automation.py:524: raise NotImplementedError("typecode %d = 0x%x)" % (vt, vt)) comtypes/automation.py:714: return "" % ( comtypes/automation.py:920: ("TypeError: Parameter %s" % (argerr.value + 1), args), comtypes/client/__init__.py:41: logger.debug("wrap_outparam(%s)", punk) comtypes/client/__init__.py:61: logger.debug("GetBestInterface(%s)", punk) comtypes/client/__init__.py:94: logger.debug("No Dispatch interface: %s", punk) comtypes/client/__init__.py:100: logger.debug("IDispatch.GetTypeInfo(0) failed: %s" % pdisp) comtypes/client/__init__.py:103: logger.debug("Default interface is %s", typeattr.guid) comtypes/client/__init__.py:117: logger.debug("Implements default interface from typeinfo %s", interface) comtypes/client/__init__.py:131: logger.debug("Final result is %s", result) comtypes/client/__init__.py:256: logger.debug("%s -> %s", progid, clsid) comtypes/client/__init__.py:265: "CoCreateInstance(%s, clsctx=%s, interface=%s)", clsid, clsctx, interface comtypes/client/__init__.py:270: "CoCreateInstanceEx(%s, clsctx=%s, interface=%s, machine=%s,\ comtypes/client/__init__.py:271: pServerInfo=%s)", comtypes/client/_code_cache.py:51: version_str = "%d%d" % sys.version_info[:2] comtypes/client/_code_cache.py:54: subdir = r"Python\Python%s\comtypes_cache" % version_str comtypes/client/_code_cache.py:61: subdir = r"comtypes_cache\%s-%s" % (base, version_str) comtypes/client/_code_cache.py:67: subdir = r"comtypes_cache\%s-%s" % (base, version_str) comtypes/client/_code_cache.py:72: logger.info("Creating writeable comtypes cache directory: '%s'", gen_dir) comtypes/client/_code_cache.py:76: logger.info("Using writeable comtypes cache directory: '%s'", result) comtypes/client/_code_cache.py:102: logger.info("Imported existing %s", comtypes.gen) comtypes/client/_code_cache.py:111: logger.info("Created comtypes.gen directory: '%s'", comtypes_path) comtypes/client/_code_cache.py:114: logger.info("Writing __init__.py file: '%s'", comtypes_init) comtypes/client/_code_cache.py:119: logger.info("Creating comtypes.gen package failed: %s", details) comtypes/client/_constants.py:121: # print("# Fixing keyword as VAR_CONST for %s" % name) comtypes/client/_events.py:24: logger.debug("Start advise %s", interface) comtypes/client/_events.py:31: logger.debug("Unadvised %s", self.cp) comtypes/client/_events.py:63: logger.debug("%s using sinkinterface %s", source, interface) comtypes/client/_events.py:75: logger.debug("%s using sinkinterface from clsid %s", source, interface) comtypes/client/_events.py:100: logger.debug("%s using sinkinterface from iid %s", source, interface) comtypes/client/_events.py:103: logger.debug("%s has more than one connection point", source) comtypes/client/_events.py:230: print("Event %s(%s)" % (name, ", ".join([repr(a) for a in args]))) comtypes/client/_generate.py:111: logger.debug("GetModule(%s), resolved: %s", pathname, is_abs) comtypes/client/_generate.py:117: logger.info("GetModule(%s): could not resolve to a filename", tlib) comtypes/client/_generate.py:124: logger.debug("GetModule(%s)", tlib.GetLibAttr()) comtypes/client/_generate.py:143: winreg.HKEY_CLASSES_ROOT, r"CLSID\%s\TypeLib" % clsid comtypes/client/_generate.py:147: winreg.HKEY_CLASSES_ROOT, r"CLSID\%s\Version" % clsid comtypes/client/_generate.py:155: with winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, r"TypeLib\%s" % libid) as key: comtypes/client/_generate.py:164: raise TypeError("'%r' is not supported type for loading typelib" % obj) comtypes/client/_generate.py:172: logger.info("Could not import %s: %s", friendly_name, details) comtypes/client/_generate.py:182: logger.info("Could not import %s: %s", name, details) comtypes/client/_generate.py:235: logger.info("# Generating %s", self.wrapper_name) comtypes/client/_generate.py:240: logger.info("# Generating %s", self.friendly_name) comtypes/client/lazybind.py:70: msg = "%r is not iterable" % self.disp comtypes/client/lazybind.py:154: raise RuntimeError("funckind %d not yet implemented" % descr.funckind) comtypes/errorinfo.py:106: text = "%s: %s (%s, line %d)" % (typ, value, name, line) comtypes/errorinfo.py:108: text = "%s: %s" % (typ, value) comtypes/server/connectionpoints.py:43: logger.debug("Unadvise %s", dwCookie) comtypes/server/connectionpoints.py:58: logger.debug("_call_sinks(%s, %s, *%s, **%s)", self, name, args, kw) comtypes/server/connectionpoints.py:70: "_call_sinks(%s, %s, *%s, **%s) failed; removing connection", comtypes/server/connectionpoints.py:83: "_call_sinks(%s, %s, *%s, **%s)", comtypes/server/connectionpoints.py:99: "_call_sinks(%s, %s, *%s, **%s) failed; removing connection", comtypes/server/connectionpoints.py:109: "_call_sinks(%s, %s, *%s, **%s)", comtypes/server/connectionpoints.py:146: logger.debug("FindConnectionPoint %s", iid) comtypes/server/connectionpoints.py:159: logger.debug("connectionpoint found, QI() -> %s", result) comtypes/server/connectionpoints.py:168: logger.debug("Fire_Event(%s, %s, *%s, **%s)", itf, name, args, kw) comtypes/server/inprocserver.py:26: _debug("ClassFactory.CreateInstance(%s)", riid[0]) comtypes/server/inprocserver.py:28: _debug("CreateInstance() -> %s", result) comtypes/server/inprocserver.py:47: key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, "CLSID\\%s\\InprocServer32" % clsid) comtypes/server/inprocserver.py:55: _debug("insert path %r", pathdir) comtypes/server/inprocserver.py:57: _debug("Already in path %r", pathdir) comtypes/server/inprocserver.py:62: _debug("modname: %s, classname %s", modname, classname) comtypes/server/inprocserver.py:66: _debug("Found class %s", result) comtypes/server/inprocserver.py:84: hkey = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, r"CLSID\%s\Logging" % clsid) comtypes/server/inprocserver.py:126: _debug("DllGetClassObject(clsid=%s, iid=%s)", clsid, iid) comtypes/server/inprocserver.py:135: _debug("DllGetClassObject() -> %s", result) comtypes/server/localserver.py:62: _debug("ClassFactory.CreateInstance(%s)", riid[0]) comtypes/server/localserver.py:65: _debug("CreateInstance() -> %s", result) comtypes/server/register.py:100: 'DeleteKey( %s\\CLSID\\%s\\Logging"' comtypes/server/register.py:103: hkey = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, r"CLSID\%s" % clsid) comtypes/server/register.py:115: 'CreateKey( %s\\CLSID\\%s\\Logging"' comtypes/server/register.py:118: hkey = winreg.CreateKey(winreg.HKEY_CLASSES_ROOT, r"CLSID\%s\Logging" % clsid) comtypes/server/register.py:123: _debug("SetValueEx(levels, %s)" % levels) comtypes/server/register.py:126: _debug("SetValueEx(format, %s)" % format) comtypes/server/register.py:152: _debug("Registering %s", cls) comtypes/server/register.py:154: _debug("[%s\\%s]", _explain(hkey), subkey) comtypes/server/register.py:155: _debug('%s="%s"', valuename or "@", value) comtypes/server/register.py:163: _debug("LoadTypeLibEx(%s, REGKIND_REGISTER)", dll) comtypes/server/register.py:172: _debug("LoadTypeLibEx(%s, REGKIND_REGISTER)", path) comtypes/server/register.py:192: _debug("Unregister %s", cls) comtypes/server/register.py:196: _debug("SHDeleteKey %s\\%s", _explain(hkey), subkey) comtypes/server/register.py:199: _debug("DeleteKey %s\\%s", _explain(hkey), subkey) comtypes/server/register.py:207: _debug("UnRegisterTypeLib(%s, %s, %s)", *tlib) comtypes/server/register.py:233: return "%s.%s" % (modname, cls.__name__) comtypes/server/register.py:281: append(HKCR, "CLSID\\%s" % reg_clsid, "", reg_desc) comtypes/server/register.py:286: append(HKCR, "CLSID\\%s\\ProgID" % reg_clsid, "", reg_progid) # 1 comtypes/server/register.py:291: append(HKCR, "%s\\CLSID" % reg_progid, "", reg_clsid) # 3 comtypes/server/register.py:297: "CLSID\\%s\\VersionIndependentProgID" % reg_clsid, # 1a comtypes/server/register.py:303: append(HKCR, "%s\\CurVer" % reg_novers_progid, "", reg_progid) # comtypes/server/register.py:304: append(HKCR, "%s\\CLSID" % reg_novers_progid, "", reg_clsid) # 3a comtypes/server/register.py:313: exe = '"%s"' % exe comtypes/server/register.py:316: exe = "%s -O" % exe comtypes/server/register.py:319: script = '"%s"' % script comtypes/server/register.py:322: "CLSID\\%s\\LocalServer32" % reg_clsid, comtypes/server/register.py:324: "%s %s" % (exe, script), comtypes/server/register.py:327: append(HKCR, "CLSID\\%s\\LocalServer32" % reg_clsid, "", "%s" % exe) comtypes/server/register.py:336: HKCR, "CLSID\\%s\\InprocServer32" % reg_clsid, "", self._get_serverdll() comtypes/server/register.py:345: "CLSID\\%s\\InprocServer32" % reg_clsid, comtypes/server/register.py:351: "CLSID\\%s\\InprocServer32" % reg_clsid, comtypes/server/register.py:360: "CLSID\\%s\\InprocServer32" % reg_clsid, comtypes/server/register.py:367: append(HKCR, "CLSID\\%s\\Typelib" % reg_clsid, "", reg_tlib[0]) comtypes/server/register.py:385: """Usage: %s [-regserver] [-unregserver] [-nodebug] [-f logformat] [-l loggername=level]""" comtypes/server/w_getopt.py:32: raise GetoptError("option '%s' requires an argument" % args[0]) comtypes/server/w_getopt.py:37: raise GetoptError("invalid option '%s'" % args[0]) comtypes/test/__init__.py:67: msg = "Use of the `%s' resource not enabled" % resource comtypes/test/__init__.py:84: yield "%s.%s" % (package.__name__, os.path.splitext(fnm)[0]) comtypes/test/__init__.py:97: print("Skipped %s: %s" % (modname, detail), file=sys.stderr) comtypes/test/__init__.py:101: "Warning: could not import %s: %s" % (modname, detail), file=sys.stderr comtypes/test/__init__.py:152: print("%s leaks:\n\t" % testcase, refcounts) comtypes/test/__init__.py:154: print("%s: ok." % testcase) comtypes/test/__init__.py:174: "Ran %d test%s in %.3fs (%s module%s skipped)" comtypes/test/__init__.py:183: self.stream.writeln("Unavailable resources: %s" % ", ".join(requested)) comtypes/test/__init__.py:186: "Ran %d test%s in %.3fs" % (run, run != 1 and "s" or "", timeTaken) comtypes/test/__init__.py:193: self.stream.write("failures=%d" % failed) comtypes/test/__init__.py:197: self.stream.write("errors=%d" % errored) comtypes/test/test_BSTR.py:14: self.assertFalse(bytes > limit, "Leaks %d bytes" % bytes) comtypes/test/test_avmc.py:40: self.assertFalse(bytes > limit, "Leaks %d bytes" % bytes) comtypes/test/test_casesensitivity.py:35: name in iem.IWebBrowserApp.__map_case__, "%s missing" % name comtypes/test/test_casesensitivity.py:37: self.assertTrue(name in iem.IWebBrowser2.__map_case__, "%s missing" % name) comtypes/test/test_casesensitivity.py:40: self.assertTrue(name in iem.IWebBrowser2.__map_case__, "%s missing" % name) comtypes/test/test_collections.py:77: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_collections.py:90: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_collections.py:105: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_comserver.py:29: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_comserver.py:219: ... print("EvalStarted: %s" % what) comtypes/test/test_comserver.py:222: ... print("EvalCompleted: %s = %s" % (what, result.value)) comtypes/test/test_createwrappers.py:60: test.__doc__ = "test GetModule(%r)" % fname comtypes/test/test_createwrappers.py:61: setattr(Test, "test_%d" % number, test) comtypes/test/test_dispinterface.py:132: errcode = os.system("cscript -nologo %s" % jscript) comtypes/test/test_excel.py:84: val = "Hi %d" % i comtypes/test/test_excel.py:89: val = "Hi %d" % i comtypes/test/test_outparam.py:49: print("malloc'd 0x%x, %d bytes" % (mem, size)) comtypes/test/test_safearray.py:54: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_safearray.py:67: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_safearray.py:112: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_safearray.py:122: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_safearray.py:247: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_sapi.py:26: self.assertTrue(filesize > 100, "filesize only %d bytes" % filesize) comtypes/test/test_server.py:33: %s {""" comtypes/test/test_server.py:50: r"midl /nologo %s /tlb %s" % (idl_path, tlb_path) comtypes/test/test_urlhistory.py:37: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_variant.py:212: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_variant.py:285: func = eval("lambda: %s" % msg, locals) comtypes/test/test_variant.py:359: "Running benchmark with comtypes %s/Python %s ..." comtypes/test/test_word.py:60: wrange.InsertAfter("Hello from comtypes %d\n" % i) comtypes/tools/codegenerator/codegenerator.py:133: " %r)))" % path comtypes/tools/codegenerator/codegenerator.py:188: logger.debug('filename: "%s": tlib_mtime: %s', filename, tlib_mtime) comtypes/tools/codegenerator/codegenerator.py:221: print("_check_version(%r, %f)" % (version, tlib_mtime), file=output) comtypes/tools/codegenerator/codegenerator.py:296: return '%s"""%s"""' % (indent, repled) comtypes/tools/codegenerator/codegenerator.py:350: print("# %s %s" % head.struct.location, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:365: "class %s(%s):" % (head.struct.name, ", ".join(basenames)), comtypes/tools/codegenerator/codegenerator.py:400: print("class %s(_com_interface):" % head.struct.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:411: print("class %s(Structure):" % head.struct.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:414: " _recordinfo_ = %r" % (head.struct._recordinfo_,), comtypes/tools/codegenerator/codegenerator.py:428: print("class %s(Union):" % head.struct.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:465: print("%s._pack_ = %s" % (body.struct.name, pack), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:470: message = "Structure %s: %s" % (body.struct.name, details) comtypes/tools/codegenerator/codegenerator.py:472: print("# WARNING: %s" % details, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:485: print("%s._fields_ = [" % body.struct.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:487: print(" # %s %s" % body.struct.location, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:493: fieldname = "_%d" % unnamed_index comtypes/tools/codegenerator/codegenerator.py:498: " # Unnamed field renamed to '%s'" % fieldname, comtypes/tools/codegenerator/codegenerator.py:505: " ('%s', %s)," % (fieldname, self._to_type_name(f.typ)), comtypes/tools/codegenerator/codegenerator.py:510: " ('%s', %s, %s)," comtypes/tools/codegenerator/codegenerator.py:520: "# The size and alignment check for %s is skipped." comtypes/tools/codegenerator/codegenerator.py:527: "assert sizeof(%s) == %s, sizeof(%s)" comtypes/tools/codegenerator/codegenerator.py:533: "assert alignment(%s) == %s, alignment(%s)" comtypes/tools/codegenerator/codegenerator.py:545: print("%s._methods_ = [" % body.struct.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:547: print("# %s %s" % body.struct.location, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:551: print(" # %s %s" % m.location, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:556: " %s,\n" comtypes/tools/codegenerator/codegenerator.py:557: " '%s',\n" comtypes/tools/codegenerator/codegenerator.py:564: " ([], %s),\n" % self._to_type_name(a), file=self.stream comtypes/tools/codegenerator/codegenerator.py:592: print(" name = %r" % lib.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:595: " _reg_typelib_ = (%r, %r, %r)" % (lib.guid, lib.major, lib.minor), comtypes/tools/codegenerator/codegenerator.py:611: "%s = %r # Constant %s" % (tp.name, tp.value, self._to_type_name(tp.typ)), comtypes/tools/codegenerator/codegenerator.py:653: print("class %s(CoClass):" % coclass.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:656: print(" _reg_clsid_ = GUID(%r)" % coclass.clsid, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:657: print(" _idlflags_ = %s" % coclass.idlflags, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:661: # >> self.stream, "POINTER(%s).__ctypes_from_outparam__ = wrap" % coclass.name comtypes/tools/codegenerator/codegenerator.py:666: " _reg_typelib_ = (%r, %s, %s)" % (str(libid), wMajor, wMinor), comtypes/tools/codegenerator/codegenerator.py:681: "%s._com_interfaces_ = [%s]" % (coclass.name, ", ".join(implemented)), comtypes/tools/codegenerator/codegenerator.py:687: "%s._outgoing_interfaces_ = [%s]" % (coclass.name, ", ".join(sources)), comtypes/tools/codegenerator/codegenerator.py:776: print("class %s(%s):" % (head.itf.name, basename), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:781: print(" _iid_ = GUID(%r)" % head.itf.iid, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:782: print(" _idlflags_ = %s" % head.itf.idlflags, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:829: print("%s._methods_ = [" % body.itf.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:842: print("# code template for %s implementation" % body.itf.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:843: print("# class %s_Impl(object):" % body.itf.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:865: "# def %s(%s):" % (name, ", ".join(["self"] + inargs)), comtypes/tools/codegenerator/codegenerator.py:868: print("# %r" % (doc or "-no docstring-"), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:869: print("# #return %s" % (", ".join(outargs)), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:873: "# def %s(%s):" % (name, ", ".join(["self"] + inargs)), comtypes/tools/codegenerator/codegenerator.py:876: print("# %r" % (doc or "-no docstring-"), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:877: print("# #return %s" % (", ".join(outargs)), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:880: "# def _set(%s):" % ", ".join(["self"] + inargs + outargs), comtypes/tools/codegenerator/codegenerator.py:883: print("# %r" % (doc or "-no docstring-"), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:885: "# %s = property(fset = _set, doc = _set.__doc__)" % name, comtypes/tools/codegenerator/codegenerator.py:890: "# def _get(%s):" % ", ".join(["self"] + inargs), comtypes/tools/codegenerator/codegenerator.py:893: print("# %r" % (doc or "-no docstring-"), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:894: print("# #return %s" % (", ".join(outargs)), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:896: "# def _set(%s):" % ", ".join(["self"] + inargs + outargs), comtypes/tools/codegenerator/codegenerator.py:899: print("# %r" % (doc or "-no docstring-"), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:901: "# %s = property(_get, _set, doc = _set.__doc__)" % name, comtypes/tools/codegenerator/codegenerator.py:924: print("class %s(%s):" % (head.itf.name, basename), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:928: print(" _iid_ = GUID(%r)" % head.itf.iid, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:929: print(" _idlflags_ = %s" % head.itf.idlflags, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:958: print("%s._disp_methods_ = [" % body.itf.name, file=self.stream) comtypes/tools/codegenerator/helpers.py:25: return "dispid(%s)" % self.memid comtypes/tools/codegenerator/helpers.py:33: return "helpstring(%r)" % self.text comtypes/tools/codegenerator/helpers.py:302: return "_midlSAFEARRAY(%s)" % self(t.typ) comtypes/tools/codegenerator/helpers.py:304: # return "%s._com_interfaces_[0]" % t.name comtypes/tools/codegenerator/helpers.py:309: return "%s%s%s" % ("POINTER(" * pcnt, self(_t), ")" * pcnt) comtypes/tools/codegenerator/helpers.py:311: return "%s * %s" % (self(t.typ), int(t.max) + 1) comtypes/tools/codegenerator/helpers.py:315: return "WINFUNCTYPE(%s)" % ", ".join(args) comtypes/tools/codegenerator/helpers.py:317: return "CFUNCTYPE(%s)" % ", ".join(args) comtypes/tools/codegenerator/helpers.py:320: return "%s" % self(t.typ) comtypes/tools/codegenerator/helpers.py:337: return "%s.%s" % (modname, t.symbol_name) comtypes/tools/codegenerator/packing.py:28: raise PackingError("field %s offset (%s/%s)" % (f.name, size, f.offset)) comtypes/tools/codegenerator/packing.py:34: raise PackingError("total alignment (%s/%s)" % (total_align, struct.align)) comtypes/tools/codegenerator/packing.py:41: raise PackingError("total size (%s/%s)" % (size, struct.size)) comtypes/tools/codegenerator/packing.py:58: raise PackingError("PACKING FAILED: %s" % details) comtypes/tools/tlbparser.py:240: raise ValueError("calling convention %d" % fd.callconv) comtypes/tools/typedesc.py:23: return "" % ( comtypes/typeinfo.py:435: raise NameError("Name %s not found" % name) comtypes/typeinfo.py:683: return "TLIBATTR(GUID=%s, Version=%s.%s, LCID=%s, FLags=0x%x)" % ( comtypes/typeinfo.py:718: return "TYPEATTR(GUID=%s, typekind=%s, funcs=%s, vars=%s, impltypes=%s)" % ( comtypes/viewobject.py:64: return "" % ( docs/source/conf.py:63:#today_fmt = '%B %d, %Y' docs/source/conf.py:127:#html_last_updated_fmt = '%b %d, %Y' setup.py:62: "Testing package %s %s\n" % (name, (sys.version, sys.platform, os.name)) source/CppTestSrv/OUTPROC.CPP:46: TEXT("%s failed with error %d: %s"), source/CppTestSrv/REGISTRY.CPP:127: L"%s%s%s", source/CppTestSrv/UTIL.CPP:48: sprintf(buf, "%s: \t%s", szLabel, szText) ; source/CppTestSrv/UTIL.CPP:78: sprintf(buf, "Error (%x): %s", hr, psz) ; test_pip_install.py:26: filename_for_upload = 'comtypes-%s.zip' % read_version() ```
junkmd commented 6 hours ago

@newwingbird

Thank you for your investigation.

Please note that the grep results mentioned above include items like logger.debug(...) and _debug(...), which fall outside the scope of this issue.

Happy contributing!

newwingbird commented 6 hours ago

@junkmd Thank you for your support.

I investigated by git grep -n '%[sdxXorfFeEgGc]' | grep -v 'logger\.debug' | grep -v '_debug' I found the reduction of the applicable code . I will try this .

Result ``` admin/svndumpfilter2:183: self.prop = self.prop + "D %d" % len(key) + "\n" + key + "\n" admin/svndumpfilter2:185: self.prop = self.prop + "K %d" % len(key) + "\n" + key + "\n" admin/svndumpfilter2:186: self.prop = self.prop + "V %d" % len(val) + "\n" + val + "\n" admin/svndumpfilter2:290: treecmd = "svnlook tree -r%d %s %s" % \ admin/svndumpfilter2:312: props = os.popen("svnlook pl -r%d %s %s" % \ admin/svndumpfilter2:319: propf = os.popen("svnlook pg -r%d %s %s %s" % \ admin/svndumpfilter2:329: f = os.popen("svnlook cat -r%d %s %s" % \ comtypes/_comobject.py:79: "Expected comtypes.COMERROR or WindowsError instance, got %s" comtypes/_comobject.py:104: "Exception in %s.%s implementation:", comtypes/_comobject.py:111: _warning("Unimplemented method %s.%s called", interface.__name__, mthname) comtypes/_comobject.py:115: "Exception in %s.%s implementation:", comtypes/_comobject.py:181: msg = "Method should have returned a %s-tuple" % args_out comtypes/_comobject.py:191: "Exception in %s.%s implementation:", comtypes/_comobject.py:201: msg = "%s: %s" % (source, descr) comtypes/_comobject.py:206: "Exception in %s.%s implementation:", comtypes/_comobject.py:214: _warning("Unimplemented method %s.%s called", interface.__name__, mthname) comtypes/_comobject.py:218: "Exception in %s.%s implementation:", comtypes/_comobject.py:254: fq_name = "%s_%s" % (interface.__name__, mthname) comtypes/_comobject.py:309: Vtbl.__name__ = "Vtbl_%s" % itf.__name__ comtypes/_memberspec.py:67: # msg = ("'optional' only allowed for VARIANT and VARIANT*, not for %s" % typ.__name__) comtypes/_memberspec.py:179: name = "_get_%s" % methodname comtypes/_memberspec.py:181: name = "_set_%s" % methodname comtypes/_memberspec.py:183: name = "_setref_%s" % methodname comtypes/_memberspec.py:385: prop = named_property("%s.%s" % (self._cls_name, name), fget, fset, doc) comtypes/_memberspec.py:608: return "" % (self.name, id(self)) comtypes/_memberspec.py:612: msg = "%r is not iterable" % self.name comtypes/_memberspec.py:633: return "" % (self.name, id(self)) comtypes/_post_coinit/_cominterface_meta_patcher.py:125: msg = "%r object does not support item assignment" comtypes/automation.py:212: return "VARIANT(vt=0x%x, byref(%r))" % (self.vt, self[0]) comtypes/automation.py:219: return "VARIANT(vt=0x%x, %r)" % (self.vt, self.value) comtypes/automation.py:428: raise TypeError("Cannot put %r in VARIANT" % value) comtypes/automation.py:524: raise NotImplementedError("typecode %d = 0x%x)" % (vt, vt)) comtypes/automation.py:714: return "" % ( comtypes/automation.py:920: ("TypeError: Parameter %s" % (argerr.value + 1), args), comtypes/client/__init__.py:265: "CoCreateInstance(%s, clsctx=%s, interface=%s)", clsid, clsctx, interface comtypes/client/__init__.py:270: "CoCreateInstanceEx(%s, clsctx=%s, interface=%s, machine=%s,\ comtypes/client/__init__.py:271: pServerInfo=%s)", comtypes/client/_code_cache.py:51: version_str = "%d%d" % sys.version_info[:2] comtypes/client/_code_cache.py:54: subdir = r"Python\Python%s\comtypes_cache" % version_str comtypes/client/_code_cache.py:61: subdir = r"comtypes_cache\%s-%s" % (base, version_str) comtypes/client/_code_cache.py:67: subdir = r"comtypes_cache\%s-%s" % (base, version_str) comtypes/client/_code_cache.py:72: logger.info("Creating writeable comtypes cache directory: '%s'", gen_dir) comtypes/client/_code_cache.py:76: logger.info("Using writeable comtypes cache directory: '%s'", result) comtypes/client/_code_cache.py:102: logger.info("Imported existing %s", comtypes.gen) comtypes/client/_code_cache.py:111: logger.info("Created comtypes.gen directory: '%s'", comtypes_path) comtypes/client/_code_cache.py:114: logger.info("Writing __init__.py file: '%s'", comtypes_init) comtypes/client/_code_cache.py:119: logger.info("Creating comtypes.gen package failed: %s", details) comtypes/client/_constants.py:121: # print("# Fixing keyword as VAR_CONST for %s" % name) comtypes/client/_events.py:230: print("Event %s(%s)" % (name, ", ".join([repr(a) for a in args]))) comtypes/client/_generate.py:117: logger.info("GetModule(%s): could not resolve to a filename", tlib) comtypes/client/_generate.py:143: winreg.HKEY_CLASSES_ROOT, r"CLSID\%s\TypeLib" % clsid comtypes/client/_generate.py:147: winreg.HKEY_CLASSES_ROOT, r"CLSID\%s\Version" % clsid comtypes/client/_generate.py:155: with winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, r"TypeLib\%s" % libid) as key: comtypes/client/_generate.py:164: raise TypeError("'%r' is not supported type for loading typelib" % obj) comtypes/client/_generate.py:172: logger.info("Could not import %s: %s", friendly_name, details) comtypes/client/_generate.py:182: logger.info("Could not import %s: %s", name, details) comtypes/client/_generate.py:235: logger.info("# Generating %s", self.wrapper_name) comtypes/client/_generate.py:240: logger.info("# Generating %s", self.friendly_name) comtypes/client/lazybind.py:70: msg = "%r is not iterable" % self.disp comtypes/client/lazybind.py:154: raise RuntimeError("funckind %d not yet implemented" % descr.funckind) comtypes/errorinfo.py:106: text = "%s: %s (%s, line %d)" % (typ, value, name, line) comtypes/errorinfo.py:108: text = "%s: %s" % (typ, value) comtypes/server/connectionpoints.py:70: "_call_sinks(%s, %s, *%s, **%s) failed; removing connection", comtypes/server/connectionpoints.py:83: "_call_sinks(%s, %s, *%s, **%s)", comtypes/server/connectionpoints.py:99: "_call_sinks(%s, %s, *%s, **%s) failed; removing connection", comtypes/server/connectionpoints.py:109: "_call_sinks(%s, %s, *%s, **%s)", comtypes/server/inprocserver.py:47: key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, "CLSID\\%s\\InprocServer32" % clsid) comtypes/server/inprocserver.py:84: hkey = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, r"CLSID\%s\Logging" % clsid) comtypes/server/register.py:100: 'DeleteKey( %s\\CLSID\\%s\\Logging"' comtypes/server/register.py:103: hkey = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, r"CLSID\%s" % clsid) comtypes/server/register.py:115: 'CreateKey( %s\\CLSID\\%s\\Logging"' comtypes/server/register.py:118: hkey = winreg.CreateKey(winreg.HKEY_CLASSES_ROOT, r"CLSID\%s\Logging" % clsid) comtypes/server/register.py:233: return "%s.%s" % (modname, cls.__name__) comtypes/server/register.py:281: append(HKCR, "CLSID\\%s" % reg_clsid, "", reg_desc) comtypes/server/register.py:286: append(HKCR, "CLSID\\%s\\ProgID" % reg_clsid, "", reg_progid) # 1 comtypes/server/register.py:291: append(HKCR, "%s\\CLSID" % reg_progid, "", reg_clsid) # 3 comtypes/server/register.py:297: "CLSID\\%s\\VersionIndependentProgID" % reg_clsid, # 1a comtypes/server/register.py:303: append(HKCR, "%s\\CurVer" % reg_novers_progid, "", reg_progid) # comtypes/server/register.py:304: append(HKCR, "%s\\CLSID" % reg_novers_progid, "", reg_clsid) # 3a comtypes/server/register.py:313: exe = '"%s"' % exe comtypes/server/register.py:316: exe = "%s -O" % exe comtypes/server/register.py:319: script = '"%s"' % script comtypes/server/register.py:322: "CLSID\\%s\\LocalServer32" % reg_clsid, comtypes/server/register.py:324: "%s %s" % (exe, script), comtypes/server/register.py:327: append(HKCR, "CLSID\\%s\\LocalServer32" % reg_clsid, "", "%s" % exe) comtypes/server/register.py:336: HKCR, "CLSID\\%s\\InprocServer32" % reg_clsid, "", self._get_serverdll() comtypes/server/register.py:345: "CLSID\\%s\\InprocServer32" % reg_clsid, comtypes/server/register.py:351: "CLSID\\%s\\InprocServer32" % reg_clsid, comtypes/server/register.py:360: "CLSID\\%s\\InprocServer32" % reg_clsid, comtypes/server/register.py:367: append(HKCR, "CLSID\\%s\\Typelib" % reg_clsid, "", reg_tlib[0]) comtypes/server/register.py:385: """Usage: %s [-regserver] [-unregserver] [-nodebug] [-f logformat] [-l loggername=level]""" comtypes/server/w_getopt.py:32: raise GetoptError("option '%s' requires an argument" % args[0]) comtypes/server/w_getopt.py:37: raise GetoptError("invalid option '%s'" % args[0]) comtypes/test/__init__.py:67: msg = "Use of the `%s' resource not enabled" % resource comtypes/test/__init__.py:84: yield "%s.%s" % (package.__name__, os.path.splitext(fnm)[0]) comtypes/test/__init__.py:97: print("Skipped %s: %s" % (modname, detail), file=sys.stderr) comtypes/test/__init__.py:101: "Warning: could not import %s: %s" % (modname, detail), file=sys.stderr comtypes/test/__init__.py:152: print("%s leaks:\n\t" % testcase, refcounts) comtypes/test/__init__.py:154: print("%s: ok." % testcase) comtypes/test/__init__.py:174: "Ran %d test%s in %.3fs (%s module%s skipped)" comtypes/test/__init__.py:183: self.stream.writeln("Unavailable resources: %s" % ", ".join(requested)) comtypes/test/__init__.py:186: "Ran %d test%s in %.3fs" % (run, run != 1 and "s" or "", timeTaken) comtypes/test/__init__.py:193: self.stream.write("failures=%d" % failed) comtypes/test/__init__.py:197: self.stream.write("errors=%d" % errored) comtypes/test/test_BSTR.py:14: self.assertFalse(bytes > limit, "Leaks %d bytes" % bytes) comtypes/test/test_avmc.py:40: self.assertFalse(bytes > limit, "Leaks %d bytes" % bytes) comtypes/test/test_casesensitivity.py:35: name in iem.IWebBrowserApp.__map_case__, "%s missing" % name comtypes/test/test_casesensitivity.py:37: self.assertTrue(name in iem.IWebBrowser2.__map_case__, "%s missing" % name) comtypes/test/test_casesensitivity.py:40: self.assertTrue(name in iem.IWebBrowser2.__map_case__, "%s missing" % name) comtypes/test/test_collections.py:77: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_collections.py:90: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_collections.py:105: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_comserver.py:29: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_comserver.py:219: ... print("EvalStarted: %s" % what) comtypes/test/test_comserver.py:222: ... print("EvalCompleted: %s = %s" % (what, result.value)) comtypes/test/test_createwrappers.py:60: test.__doc__ = "test GetModule(%r)" % fname comtypes/test/test_createwrappers.py:61: setattr(Test, "test_%d" % number, test) comtypes/test/test_dispinterface.py:132: errcode = os.system("cscript -nologo %s" % jscript) comtypes/test/test_excel.py:84: val = "Hi %d" % i comtypes/test/test_excel.py:89: val = "Hi %d" % i comtypes/test/test_outparam.py:49: print("malloc'd 0x%x, %d bytes" % (mem, size)) comtypes/test/test_safearray.py:54: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_safearray.py:67: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_safearray.py:112: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_safearray.py:122: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_safearray.py:247: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_sapi.py:26: self.assertTrue(filesize > 100, "filesize only %d bytes" % filesize) comtypes/test/test_server.py:33: %s {""" comtypes/test/test_server.py:50: r"midl /nologo %s /tlb %s" % (idl_path, tlb_path) comtypes/test/test_urlhistory.py:37: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_variant.py:212: self.assertFalse(bytes, "Leaks %d bytes" % bytes) comtypes/test/test_variant.py:285: func = eval("lambda: %s" % msg, locals) comtypes/test/test_variant.py:359: "Running benchmark with comtypes %s/Python %s ..." comtypes/test/test_word.py:60: wrange.InsertAfter("Hello from comtypes %d\n" % i) comtypes/tools/codegenerator/codegenerator.py:133: " %r)))" % path comtypes/tools/codegenerator/codegenerator.py:221: print("_check_version(%r, %f)" % (version, tlib_mtime), file=output) comtypes/tools/codegenerator/codegenerator.py:296: return '%s"""%s"""' % (indent, repled) comtypes/tools/codegenerator/codegenerator.py:350: print("# %s %s" % head.struct.location, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:365: "class %s(%s):" % (head.struct.name, ", ".join(basenames)), comtypes/tools/codegenerator/codegenerator.py:400: print("class %s(_com_interface):" % head.struct.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:411: print("class %s(Structure):" % head.struct.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:414: " _recordinfo_ = %r" % (head.struct._recordinfo_,), comtypes/tools/codegenerator/codegenerator.py:428: print("class %s(Union):" % head.struct.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:465: print("%s._pack_ = %s" % (body.struct.name, pack), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:470: message = "Structure %s: %s" % (body.struct.name, details) comtypes/tools/codegenerator/codegenerator.py:472: print("# WARNING: %s" % details, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:485: print("%s._fields_ = [" % body.struct.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:487: print(" # %s %s" % body.struct.location, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:493: fieldname = "_%d" % unnamed_index comtypes/tools/codegenerator/codegenerator.py:498: " # Unnamed field renamed to '%s'" % fieldname, comtypes/tools/codegenerator/codegenerator.py:505: " ('%s', %s)," % (fieldname, self._to_type_name(f.typ)), comtypes/tools/codegenerator/codegenerator.py:510: " ('%s', %s, %s)," comtypes/tools/codegenerator/codegenerator.py:520: "# The size and alignment check for %s is skipped." comtypes/tools/codegenerator/codegenerator.py:527: "assert sizeof(%s) == %s, sizeof(%s)" comtypes/tools/codegenerator/codegenerator.py:533: "assert alignment(%s) == %s, alignment(%s)" comtypes/tools/codegenerator/codegenerator.py:545: print("%s._methods_ = [" % body.struct.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:547: print("# %s %s" % body.struct.location, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:551: print(" # %s %s" % m.location, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:556: " %s,\n" comtypes/tools/codegenerator/codegenerator.py:557: " '%s',\n" comtypes/tools/codegenerator/codegenerator.py:564: " ([], %s),\n" % self._to_type_name(a), file=self.stream comtypes/tools/codegenerator/codegenerator.py:592: print(" name = %r" % lib.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:595: " _reg_typelib_ = (%r, %r, %r)" % (lib.guid, lib.major, lib.minor), comtypes/tools/codegenerator/codegenerator.py:611: "%s = %r # Constant %s" % (tp.name, tp.value, self._to_type_name(tp.typ)), comtypes/tools/codegenerator/codegenerator.py:653: print("class %s(CoClass):" % coclass.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:656: print(" _reg_clsid_ = GUID(%r)" % coclass.clsid, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:657: print(" _idlflags_ = %s" % coclass.idlflags, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:661: # >> self.stream, "POINTER(%s).__ctypes_from_outparam__ = wrap" % coclass.name comtypes/tools/codegenerator/codegenerator.py:666: " _reg_typelib_ = (%r, %s, %s)" % (str(libid), wMajor, wMinor), comtypes/tools/codegenerator/codegenerator.py:681: "%s._com_interfaces_ = [%s]" % (coclass.name, ", ".join(implemented)), comtypes/tools/codegenerator/codegenerator.py:687: "%s._outgoing_interfaces_ = [%s]" % (coclass.name, ", ".join(sources)), comtypes/tools/codegenerator/codegenerator.py:776: print("class %s(%s):" % (head.itf.name, basename), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:781: print(" _iid_ = GUID(%r)" % head.itf.iid, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:782: print(" _idlflags_ = %s" % head.itf.idlflags, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:829: print("%s._methods_ = [" % body.itf.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:842: print("# code template for %s implementation" % body.itf.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:843: print("# class %s_Impl(object):" % body.itf.name, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:865: "# def %s(%s):" % (name, ", ".join(["self"] + inargs)), comtypes/tools/codegenerator/codegenerator.py:868: print("# %r" % (doc or "-no docstring-"), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:869: print("# #return %s" % (", ".join(outargs)), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:873: "# def %s(%s):" % (name, ", ".join(["self"] + inargs)), comtypes/tools/codegenerator/codegenerator.py:876: print("# %r" % (doc or "-no docstring-"), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:877: print("# #return %s" % (", ".join(outargs)), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:880: "# def _set(%s):" % ", ".join(["self"] + inargs + outargs), comtypes/tools/codegenerator/codegenerator.py:883: print("# %r" % (doc or "-no docstring-"), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:885: "# %s = property(fset = _set, doc = _set.__doc__)" % name, comtypes/tools/codegenerator/codegenerator.py:890: "# def _get(%s):" % ", ".join(["self"] + inargs), comtypes/tools/codegenerator/codegenerator.py:893: print("# %r" % (doc or "-no docstring-"), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:894: print("# #return %s" % (", ".join(outargs)), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:896: "# def _set(%s):" % ", ".join(["self"] + inargs + outargs), comtypes/tools/codegenerator/codegenerator.py:899: print("# %r" % (doc or "-no docstring-"), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:901: "# %s = property(_get, _set, doc = _set.__doc__)" % name, comtypes/tools/codegenerator/codegenerator.py:924: print("class %s(%s):" % (head.itf.name, basename), file=self.stream) comtypes/tools/codegenerator/codegenerator.py:928: print(" _iid_ = GUID(%r)" % head.itf.iid, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:929: print(" _idlflags_ = %s" % head.itf.idlflags, file=self.stream) comtypes/tools/codegenerator/codegenerator.py:958: print("%s._disp_methods_ = [" % body.itf.name, file=self.stream) comtypes/tools/codegenerator/helpers.py:25: return "dispid(%s)" % self.memid comtypes/tools/codegenerator/helpers.py:33: return "helpstring(%r)" % self.text comtypes/tools/codegenerator/helpers.py:302: return "_midlSAFEARRAY(%s)" % self(t.typ) comtypes/tools/codegenerator/helpers.py:304: # return "%s._com_interfaces_[0]" % t.name comtypes/tools/codegenerator/helpers.py:309: return "%s%s%s" % ("POINTER(" * pcnt, self(_t), ")" * pcnt) comtypes/tools/codegenerator/helpers.py:311: return "%s * %s" % (self(t.typ), int(t.max) + 1) comtypes/tools/codegenerator/helpers.py:315: return "WINFUNCTYPE(%s)" % ", ".join(args) comtypes/tools/codegenerator/helpers.py:317: return "CFUNCTYPE(%s)" % ", ".join(args) comtypes/tools/codegenerator/helpers.py:320: return "%s" % self(t.typ) comtypes/tools/codegenerator/helpers.py:337: return "%s.%s" % (modname, t.symbol_name) comtypes/tools/codegenerator/packing.py:28: raise PackingError("field %s offset (%s/%s)" % (f.name, size, f.offset)) comtypes/tools/codegenerator/packing.py:34: raise PackingError("total alignment (%s/%s)" % (total_align, struct.align)) comtypes/tools/codegenerator/packing.py:41: raise PackingError("total size (%s/%s)" % (size, struct.size)) comtypes/tools/codegenerator/packing.py:58: raise PackingError("PACKING FAILED: %s" % details) comtypes/tools/tlbparser.py:240: raise ValueError("calling convention %d" % fd.callconv) comtypes/tools/typedesc.py:23: return "" % ( comtypes/typeinfo.py:435: raise NameError("Name %s not found" % name) comtypes/typeinfo.py:683: return "TLIBATTR(GUID=%s, Version=%s.%s, LCID=%s, FLags=0x%x)" % ( comtypes/typeinfo.py:718: return "TYPEATTR(GUID=%s, typekind=%s, funcs=%s, vars=%s, impltypes=%s)" % ( comtypes/viewobject.py:64: return "" % ( docs/source/conf.py:63:#today_fmt = '%B %d, %Y' docs/source/conf.py:127:#html_last_updated_fmt = '%b %d, %Y' setup.py:62: "Testing package %s %s\n" % (name, (sys.version, sys.platform, os.name)) source/CppTestSrv/OUTPROC.CPP:46: TEXT("%s failed with error %d: %s"), source/CppTestSrv/REGISTRY.CPP:127: L"%s%s%s", source/CppTestSrv/UTIL.CPP:48: sprintf(buf, "%s: \t%s", szLabel, szText) ; source/CppTestSrv/UTIL.CPP:78: sprintf(buf, "Error (%x): %s", hr, psz) ; test_pip_install.py:26: filename_for_upload = 'comtypes-%s.zip' % read_version() ```
junkmd commented 6 hours ago

Hi @newwingbird,

Thanks for your quick response.

I noticed that _debug, _warning, logger.info, and .CPP files are included.

newwingbird commented 5 hours ago

@junkmd

Okay, In addition, _error too? This issue's scope is only inside print and string literal ?

junkmd commented 5 hours ago

@newwingbird

Okay, In addition, _error too?

I might have missed it, but if _error exists, it would similarly fall outside the scope of this issue.

This issue's scope is only inside print and string literal ?

That's right.