diff --git a/stubs/pywin32/@tests/stubtest_allowlist.txt b/stubs/pywin32/@tests/stubtest_allowlist.txt index 20fe05108..84543ae7e 100644 --- a/stubs/pywin32/@tests/stubtest_allowlist.txt +++ b/stubs/pywin32/@tests/stubtest_allowlist.txt @@ -2,15 +2,17 @@ _win32typing win32com(ext)?.mapi._exchdapi win32._wincerapi + # PyWin tool / debugger pythonwin.pywin.* win32com.client.combrowse win32com.client.tlbrowse + # Utilities to generate python bindings win32com.client.build win32com.client.CLSIDToClass win32com.client.connect -# Necessary for mypy to not throw AssertionError +# "dynamic.CDipatch" is necessary for mypy to not throw AssertionError win32com.client.dynamic.* win32com.client.gencache win32com.client.genpy @@ -18,6 +20,8 @@ win32com.client.makepy win32com.client.selecttlb win32com.client.util win32com.makegw.* +(win32.lib.)?pywintypes.__import_pywin32_system_module__ + # COM object servers scripts win32com.server.factory win32com.server.localserver @@ -26,50 +30,40 @@ win32com.servers.* # Active X Scripts win32com(ext)?.axscript.client.framework win32com(ext)?.axscript.client.pyscript_rexec -# Necessary for mypy to not fail +# "pyscript.pyi" is necessary for mypy to not fail due to missing stub win32com(ext)?.axscript.client.pyscript.* win32com(ext)?.axscript.client.scriptdispatch # Other scripts isapi.install -win32.scripts.* -win32.lib.netbios -win32.lib.sspi -win32.lib.win32pdhutil -win32.lib.win32rcparser -win32.lib.win32serviceutil -win32.lib.win32traceutil -win32.lib.verstamp + # Demos, tests and debugging -win32.lib.pywin32_testutil -win32.lib.rasutil win32com.demos.* win32com.servers.test_pycomtest win32com.test.* win32com(ext)?.axdebug.codecontainer win32com(ext)?.axdebug.dump win32com(ext)?.axdebug.debugger +win32com(ext)?.axscript.client.debug win32com(ext)?.axscript.client.pydumper win32com(ext)?.directsound.test.* + # Deprecated and obsolete pythoncom.MakeIID pythoncom.MakeTime -win32.lib.dbi -win32.lib.win32pdhquery.Query.addperfcounter +(win32.lib.)?win32pdhquery.Query.addperfcounter # Deprecated and makes a buffer of random junk. Use something like `b"\x00" * bufferSize` instead -win32.win32gui.PyMakeBuffer -# Also a script -win32.lib.regcheck +(win32.)?win(32|xp)gui.PyMakeBuffer + # failed to import, ImportError: DLL load failed while importing axdebug: The specified module could not be found. -# https://github.com/python/mypy/issues/13822 win32com.axdebug.axdebug -win32com(ext)?.axdebug.adb win32com(ext)?.axdebug.codecontainer -# failed to import, SystemError: CoInternetCreateSecurityManager() method: bad call flags -win32com(ext)?.internet.internet -# failed to import, ModuleNotFoundError: No module named '...' +# failed to import, ModuleNotFoundError: No module named 'gateways' win32com(ext)?.axdebug.contexts -win32com(ext)?.axdebug.debugger +# failed to import, ModuleNotFoundError: No module named 'axdebug' +win32com(ext)?.axdebug.adb win32com(ext)?.axdebug.documents win32com(ext)?.axdebug.expressions +# failed to import, ModuleNotFoundError: No module named 'expressions' win32com(ext)?.axdebug.stackframe -win32com(ext)?.axscript.client.debug +# failed to import, SystemError: CoInternetCreateSecurityManager() method: bad call flags +win32com(ext)?.internet.internet diff --git a/stubs/pywin32/METADATA.toml b/stubs/pywin32/METADATA.toml index 667c0adc0..065ecdef0 100644 --- a/stubs/pywin32/METADATA.toml +++ b/stubs/pywin32/METADATA.toml @@ -1,9 +1,6 @@ version = "304.*" [tool.stubtest] +ignore_missing_stub = false # The library only works on Windows; we currently only run stubtest on Ubuntu for third-party stubs in CI. # See #8660 skip = true -# This crashes stubtest. It should be fixed in next mypy update -# (keeping it since we currently skip the stub anyway) -# https://github.com/python/mypy/issues/13822 -ignore_missing_stub = false diff --git a/stubs/pywin32/pythoncom.pyi b/stubs/pywin32/pythoncom.pyi index 690581bed..a46f55b0f 100644 --- a/stubs/pywin32/pythoncom.pyi +++ b/stubs/pywin32/pythoncom.pyi @@ -9,6 +9,8 @@ from win32.lib.pywintypes import com_error as com_error error: TypeAlias = com_error # noqa: Y042 +class internal_error(Exception): ... + def CoCreateFreeThreadedMarshaler(unk: _win32typing.PyIUnknown) -> _win32typing.PyIUnknown: ... def CoCreateInstanceEx( clsid: _win32typing.PyIID, @@ -133,6 +135,8 @@ def CoGetCancelObject(riid: _win32typing.PyIID, ThreadID: int = ...) -> _win32ty def CoSetCancelObject(Unk: _win32typing.PyIUnknown) -> None: ... def CoEnableCallCancellation() -> None: ... def CoDisableCallCancellation() -> None: ... +def CreateURLMonikerEx(*args, **kwargs): ... # incomplete +def new(__iid: _win32typing.PyIID | str): ... ACTIVEOBJECT_STRONG: int ACTIVEOBJECT_WEAK: int @@ -154,8 +158,6 @@ COINIT_SPEED_OVER_MEMORY: int COWAIT_ALERTABLE: int COWAIT_WAITALL: int -def CreateURLMonikerEx(*args, **kwargs): ... # incomplete - DATADIR_GET: int DATADIR_SET: int DESCKIND_FUNCDESC: int diff --git a/stubs/pywin32/win32/lib/pywintypes.pyi b/stubs/pywin32/win32/lib/pywintypes.pyi index 2327c1029..bf2320d5f 100644 --- a/stubs/pywin32/win32/lib/pywintypes.pyi +++ b/stubs/pywin32/win32/lib/pywintypes.pyi @@ -1,6 +1,7 @@ # Can't generate with stubgen because: # "KeyError: 'pywintypes'" from _typeshed import Incomplete +from datetime import datetime from typing_extensions import Literal import _win32typing @@ -8,6 +9,9 @@ import _win32typing class error(Exception): ... class com_error(Exception): ... +class TimeType(datetime): + Format = datetime.strftime + def DosDateTimeToTime() -> _win32typing.PyTime: ... def Unicode() -> str: ... def UnicodeFromRaw(_str: str) -> str: ... @@ -23,8 +27,8 @@ def SECURITY_DESCRIPTOR() -> _win32typing.PySECURITY_DESCRIPTOR: ... def HANDLE() -> int: ... def HKEY() -> _win32typing.PyHKEY: ... def WAVEFORMATEX() -> _win32typing.PyWAVEFORMATEX: ... +def TimeStamp(*args, **kwargs): ... # incomplete FALSE: Literal[False] TRUE: Literal[True] - -def TimeStamp(*args, **kwargs): ... # incomplete +WAVE_FORMAT_PCM: int diff --git a/stubs/pywin32/win32/winxpgui.pyi b/stubs/pywin32/win32/winxpgui.pyi index 3b2b41ae5..363045bfb 100644 --- a/stubs/pywin32/win32/winxpgui.pyi +++ b/stubs/pywin32/win32/winxpgui.pyi @@ -1 +1,6 @@ from win32.win32gui import * + +def GetConsoleWindow() -> int: ... + +# Actually returns a list of int|tuple, but lists don't support positional types +def GetWindowRgnBox(__hWnd: int) -> tuple[int, tuple[int, int, int, int]]: ...