Skip to content

Commit 0ac98f6

Browse files
authored
Update pywin32 to mypy 0.990 (#9124)
1 parent a74acc8 commit 0ac98f6

File tree

5 files changed

+34
-32
lines changed

5 files changed

+34
-32
lines changed

stubs/pywin32/@tests/stubtest_allowlist.txt

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,26 @@
22
_win32typing
33
win32com(ext)?.mapi._exchdapi
44
win32._wincerapi
5+
56
# PyWin tool / debugger
67
pythonwin.pywin.*
78
win32com.client.combrowse
89
win32com.client.tlbrowse
10+
911
# Utilities to generate python bindings
1012
win32com.client.build
1113
win32com.client.CLSIDToClass
1214
win32com.client.connect
13-
# Necessary for mypy to not throw AssertionError
15+
# "dynamic.CDipatch" is necessary for mypy to not throw AssertionError
1416
win32com.client.dynamic.*
1517
win32com.client.gencache
1618
win32com.client.genpy
1719
win32com.client.makepy
1820
win32com.client.selecttlb
1921
win32com.client.util
2022
win32com.makegw.*
23+
(win32.lib.)?pywintypes.__import_pywin32_system_module__
24+
2125
# COM object servers scripts
2226
win32com.server.factory
2327
win32com.server.localserver
@@ -26,50 +30,40 @@ win32com.servers.*
2630
# Active X Scripts
2731
win32com(ext)?.axscript.client.framework
2832
win32com(ext)?.axscript.client.pyscript_rexec
29-
# Necessary for mypy to not fail
33+
# "pyscript.pyi" is necessary for mypy to not fail due to missing stub
3034
win32com(ext)?.axscript.client.pyscript.*
3135
win32com(ext)?.axscript.client.scriptdispatch
3236
# Other scripts
3337
isapi.install
34-
win32.scripts.*
35-
win32.lib.netbios
36-
win32.lib.sspi
37-
win32.lib.win32pdhutil
38-
win32.lib.win32rcparser
39-
win32.lib.win32serviceutil
40-
win32.lib.win32traceutil
41-
win32.lib.verstamp
38+
4239
# Demos, tests and debugging
43-
win32.lib.pywin32_testutil
44-
win32.lib.rasutil
4540
win32com.demos.*
4641
win32com.servers.test_pycomtest
4742
win32com.test.*
4843
win32com(ext)?.axdebug.codecontainer
4944
win32com(ext)?.axdebug.dump
5045
win32com(ext)?.axdebug.debugger
46+
win32com(ext)?.axscript.client.debug
5147
win32com(ext)?.axscript.client.pydumper
5248
win32com(ext)?.directsound.test.*
49+
5350
# Deprecated and obsolete
5451
pythoncom.MakeIID
5552
pythoncom.MakeTime
56-
win32.lib.dbi
57-
win32.lib.win32pdhquery.Query.addperfcounter
53+
(win32.lib.)?win32pdhquery.Query.addperfcounter
5854
# Deprecated and makes a buffer of random junk. Use something like `b"\x00" * bufferSize` instead
59-
win32.win32gui.PyMakeBuffer
60-
# Also a script
61-
win32.lib.regcheck
55+
(win32.)?win(32|xp)gui.PyMakeBuffer
56+
6257
# failed to import, ImportError: DLL load failed while importing axdebug: The specified module could not be found.
63-
# https://github.com/python/mypy/issues/13822
6458
win32com.axdebug.axdebug
65-
win32com(ext)?.axdebug.adb
6659
win32com(ext)?.axdebug.codecontainer
67-
# failed to import, SystemError: CoInternetCreateSecurityManager() method: bad call flags
68-
win32com(ext)?.internet.internet
69-
# failed to import, ModuleNotFoundError: No module named '...'
60+
# failed to import, ModuleNotFoundError: No module named 'gateways'
7061
win32com(ext)?.axdebug.contexts
71-
win32com(ext)?.axdebug.debugger
62+
# failed to import, ModuleNotFoundError: No module named 'axdebug'
63+
win32com(ext)?.axdebug.adb
7264
win32com(ext)?.axdebug.documents
7365
win32com(ext)?.axdebug.expressions
66+
# failed to import, ModuleNotFoundError: No module named 'expressions'
7467
win32com(ext)?.axdebug.stackframe
75-
win32com(ext)?.axscript.client.debug
68+
# failed to import, SystemError: CoInternetCreateSecurityManager() method: bad call flags
69+
win32com(ext)?.internet.internet

stubs/pywin32/METADATA.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
version = "304.*"
22
[tool.stubtest]
3+
ignore_missing_stub = false
34
# The library only works on Windows; we currently only run stubtest on Ubuntu for third-party stubs in CI.
45
# See #8660
56
skip = true
6-
# This crashes stubtest. It should be fixed in next mypy update
7-
# (keeping it since we currently skip the stub anyway)
8-
# https://github.com/python/mypy/issues/13822
9-
ignore_missing_stub = false

stubs/pywin32/pythoncom.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ from win32.lib.pywintypes import com_error as com_error
99

1010
error: TypeAlias = com_error # noqa: Y042
1111

12+
class internal_error(Exception): ...
13+
1214
def CoCreateFreeThreadedMarshaler(unk: _win32typing.PyIUnknown) -> _win32typing.PyIUnknown: ...
1315
def CoCreateInstanceEx(
1416
clsid: _win32typing.PyIID,
@@ -133,6 +135,8 @@ def CoGetCancelObject(riid: _win32typing.PyIID, ThreadID: int = ...) -> _win32ty
133135
def CoSetCancelObject(Unk: _win32typing.PyIUnknown) -> None: ...
134136
def CoEnableCallCancellation() -> None: ...
135137
def CoDisableCallCancellation() -> None: ...
138+
def CreateURLMonikerEx(*args, **kwargs): ... # incomplete
139+
def new(__iid: _win32typing.PyIID | str): ...
136140

137141
ACTIVEOBJECT_STRONG: int
138142
ACTIVEOBJECT_WEAK: int
@@ -154,8 +158,6 @@ COINIT_SPEED_OVER_MEMORY: int
154158
COWAIT_ALERTABLE: int
155159
COWAIT_WAITALL: int
156160

157-
def CreateURLMonikerEx(*args, **kwargs): ... # incomplete
158-
159161
DATADIR_GET: int
160162
DATADIR_SET: int
161163
DESCKIND_FUNCDESC: int

stubs/pywin32/win32/lib/pywintypes.pyi

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
# Can't generate with stubgen because:
22
# "KeyError: 'pywintypes'"
33
from _typeshed import Incomplete
4+
from datetime import datetime
45
from typing_extensions import Literal
56

67
import _win32typing
78

89
class error(Exception): ...
910
class com_error(Exception): ...
1011

12+
class TimeType(datetime):
13+
Format = datetime.strftime
14+
1115
def DosDateTimeToTime() -> _win32typing.PyTime: ...
1216
def Unicode() -> str: ...
1317
def UnicodeFromRaw(_str: str) -> str: ...
@@ -23,8 +27,8 @@ def SECURITY_DESCRIPTOR() -> _win32typing.PySECURITY_DESCRIPTOR: ...
2327
def HANDLE() -> int: ...
2428
def HKEY() -> _win32typing.PyHKEY: ...
2529
def WAVEFORMATEX() -> _win32typing.PyWAVEFORMATEX: ...
30+
def TimeStamp(*args, **kwargs): ... # incomplete
2631

2732
FALSE: Literal[False]
2833
TRUE: Literal[True]
29-
30-
def TimeStamp(*args, **kwargs): ... # incomplete
34+
WAVE_FORMAT_PCM: int

stubs/pywin32/win32/winxpgui.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
from win32.win32gui import *
2+
3+
def GetConsoleWindow() -> int: ...
4+
5+
# Actually returns a list of int|tuple, but lists don't support positional types
6+
def GetWindowRgnBox(__hWnd: int) -> tuple[int, tuple[int, int, int, int]]: ...

0 commit comments

Comments
 (0)