Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 18 additions & 24 deletions stubs/pywin32/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@
_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
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
Expand All @@ -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
5 changes: 1 addition & 4 deletions stubs/pywin32/METADATA.toml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions stubs/pywin32/pythoncom.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 6 additions & 2 deletions stubs/pywin32/win32/lib/pywintypes.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# Can't generate with stubgen because:
# "KeyError: 'pywintypes'"
from _typeshed import Incomplete
from datetime import datetime
from typing_extensions import Literal

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: ...
Expand All @@ -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
5 changes: 5 additions & 0 deletions stubs/pywin32/win32/winxpgui.pyi
Original file line number Diff line number Diff line change
@@ -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]]: ...