Skip to content

pywin32: Complete modules using stubgen & stubtest #8866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 7, 2022
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
119 changes: 72 additions & 47 deletions stubs/pywin32/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,50 +1,75 @@
# Not available at runtime. Contains type definitions that are otherwise not exposed
_win32typing
win32comext.mapi.exchdapi
win32.winxptheme
win32.wincerapi

# incomplete
pythoncom.*
win32com(ext)?.mapi._exchdapi
win32._wincerapi
# PyWin tool / debugger
pythonwin.pywin.*
win32.lib.pywintypes.*
win32.lib.ntsecuritycon.*
win32.lib.sspicon.*
win32.lib.win2kras.*
win32.lib.win32con.*
win32.lib.win32cryptcon.*
win32.lib.win32inetcon.*
win32.lib.win32netcon.*
win32.lib.winioctlcon.*
win32.win32pdh.*
win32.win32ras.*
win32.win32wnet.*
win32comext.adsi.*
win32comext.mapi.exchange.*
win32comext.shell.shell.*
win32comext.directsound.directsound.*

win32comext.axdebug.axdebug
win32comext.internet.internet
win32comext.adsi.adsicon
win32comext.axdebug.adb
win32comext.axdebug.codecontainer
win32comext.axdebug.contexts
win32comext.axdebug.debugger
win32comext.axdebug.documents
win32comext.axdebug.dump
win32comext.axdebug.expressions
win32comext.axdebug.gateways
win32comext.axdebug.stackframe
win32comext.axdebug.util
win32comext.axscript.asputil
win32comext.axscript.client.*
win32comext.axscript.server.*
win32comext.directsound.test.*
win32comext.ifilter.ifiltercon
win32comext.internet.inetcon
win32comext.mapi.emsabtags
win32comext.mapi.mapitags
win32comext.mapi.mapiutil
win32comext.propsys.pscon
win32comext.shell.shellcon
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
win32com.client.dynamic.*
win32com.client.gencache
win32com.client.genpy
win32com.client.makepy
win32com.client.selecttlb
win32com.client.util
win32com.makegw.*
# COM object servers scripts
win32com.server.factory
win32com.server.localserver
win32com.server.register
win32com.servers.*
# Active X Scripts
win32com(ext)?.axscript.client.framework
win32com(ext)?.axscript.client.pyscript_rexec
# Necessary for mypy to not fail
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
win32.lib.win32gui_struct
win32com.demos.*
win32com.servers.test_pycomtest
win32com.test.*
win32com(ext)?.axdebug.codecontainer
win32com(ext)?.axdebug.dump
win32com(ext)?.axdebug.debugger
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.win32gui.PyMakeBuffer
# Also a script
win32.lib.regcheck
# 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 '...'
win32com(ext)?.axdebug.contexts
win32com(ext)?.axdebug.debugger
win32com(ext)?.axdebug.documents
win32com(ext)?.axdebug.expressions
win32com(ext)?.axdebug.stackframe
win32com(ext)?.axscript.client.debug
1 change: 0 additions & 1 deletion stubs/pywin32/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
version = "304.*"

[tool.stubtest]
# The library only works on Windows; we currently only run stubtest on Ubuntu for third-party stubs in CI.
# See #8660
Expand Down
112 changes: 101 additions & 11 deletions stubs/pywin32/_win32typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,99 @@
from _typeshed import Incomplete
from typing_extensions import final

class PyDSCAPSType: ...
class PyDSCBCAPSType: ...
class PyDSCCAPSType: ...
class PyNCB: ...
class ArgNotFound: ...
class PyOleEmpty: ...
class PyOleMissing: ...
class PyOleNothing: ...

class PyDSCAPSType:
@property
def dwFlags(self): ...
@property
def dwFreeHw3DAllBuffers(self): ...
@property
def dwFreeHw3DStaticBuffers(self): ...
@property
def dwFreeHw3DStreamingBuffers(self): ...
@property
def dwFreeHwMemBytes(self): ...
@property
def dwFreeHwMixingAllBuffers(self): ...
@property
def dwFreeHwMixingStaticBuffers(self): ...
@property
def dwFreeHwMixingStreamingBuffers(self): ...
@property
def dwMaxContigFreeHwMemBytes(self): ...
@property
def dwMaxHw3DAllBuffers(self): ...
@property
def dwMaxHw3DStaticBuffers(self): ...
@property
def dwMaxHw3DStreamingBuffers(self): ...
@property
def dwMaxHwMixingAllBuffers(self): ...
@property
def dwMaxHwMixingStaticBuffers(self): ...
@property
def dwMaxHwMixingStreamingBuffers(self): ...
@property
def dwMaxSecondarySampleRate(self): ...
@property
def dwMinSecondarySampleRate(self): ...
@property
def dwPlayCpuOverheadSwBuffers(self): ...
@property
def dwPrimaryBuffers(self): ...
@property
def dwTotalHwMemBytes(self): ...
@property
def dwUnlockTransferRateHwBuffers(self): ...

class PyDSCBCAPSType:
@property
def dwBufferBytes(self): ...
@property
def dwFlags(self): ...

class PyDSCCAPSType:
@property
def dwChannels(self): ...
@property
def dwFlags(self): ...
@property
def dwFormats(self): ...

@final
class PyNCB:
@property
def Bufflen(self): ...
@property
def Callname(self): ...
@property
def Cmd_cplt(self): ...
@property
def Command(self): ...
@property
def Event(self): ...
@property
def Lana_num(self): ...
@property
def Lsn(self): ...
@property
def Name(self): ...
@property
def Num(self): ...
@property
def Post(self): ...
def Reset(self, *args, **kwargs): ... # incomplete
@property
def Retcode(self): ...
@property
def Rto(self): ...
@property
def Sto(self): ...

class COMMTIMEOUTS: ...
class CopyProgressRoutine: ...

Expand Down Expand Up @@ -1080,6 +1169,7 @@ class PyLUID_AND_ATTRIBUTES: ...
class PyLsaLogon_HANDLE: ...
class PyMSG: ...

@final
class PyNETRESOURCE:
@property
def dwScope(self) -> int: ...
Expand All @@ -1090,13 +1180,13 @@ class PyNETRESOURCE:
@property
def dwUsage(self) -> int: ...
@property
def localName(self) -> str: ...
def lpComment(self): ...
@property
def remoteName(self) -> str: ...
def lpLocalName(self): ...
@property
def comment(self) -> str: ...
def lpProvider(self): ...
@property
def provider(self) -> str: ...
def lpRemoteName(self): ...

class PyNET_VALIDATE_AUTHENTICATION_INPUT_ARG: ...
class PyNET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG: ...
Expand Down Expand Up @@ -2617,11 +2707,11 @@ class PyDSBCAPS:
@property
def dwFlags(self) -> int: ...
@property
def nChannels(self) -> int: ...
@property
def dwUnlockTransferRate(self) -> int: ...
@property
def nAvgBytesPerSec(self) -> int: ...
def dwBufferBytes(self): ...
@property
def dwPlayCpuOverhead(self): ...

class PyDSBUFFERDESC:
@property
Expand Down
1 change: 1 addition & 0 deletions stubs/pywin32/afxres.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from win32.lib.afxres import *
1 change: 1 addition & 0 deletions stubs/pywin32/commctrl.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from win32.lib.commctrl import *
1 change: 1 addition & 0 deletions stubs/pywin32/dde.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from pythonwin.dde import *
11 changes: 11 additions & 0 deletions stubs/pywin32/isapi/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from _typeshed import Incomplete

class ISAPIError(Exception):
errno: Incomplete
strerror: Incomplete
funcname: Incomplete
def __init__(self, errno, strerror: Incomplete | None = ..., funcname: Incomplete | None = ...) -> None: ...

class FilterError(ISAPIError): ...
class ExtensionError(ISAPIError): ...
class InternalReloadException(Exception): ...
86 changes: 86 additions & 0 deletions stubs/pywin32/isapi/isapicon.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
from _typeshed import Incomplete

HTTP_CONTINUE: int
HTTP_SWITCHING_PROTOCOLS: int
HTTP_PROCESSING: int
HTTP_OK: int
HTTP_CREATED: int
HTTP_ACCEPTED: int
HTTP_NON_AUTHORITATIVE: int
HTTP_NO_CONTENT: int
HTTP_RESET_CONTENT: int
HTTP_PARTIAL_CONTENT: int
HTTP_MULTI_STATUS: int
HTTP_MULTIPLE_CHOICES: int
HTTP_MOVED_PERMANENTLY: int
HTTP_MOVED_TEMPORARILY: int
HTTP_SEE_OTHER: int
HTTP_NOT_MODIFIED: int
HTTP_USE_PROXY: int
HTTP_TEMPORARY_REDIRECT: int
HTTP_BAD_REQUEST: int
HTTP_UNAUTHORIZED: int
HTTP_PAYMENT_REQUIRED: int
HTTP_FORBIDDEN: int
HTTP_NOT_FOUND: int
HTTP_METHOD_NOT_ALLOWED: int
HTTP_NOT_ACCEPTABLE: int
HTTP_PROXY_AUTHENTICATION_REQUIRED: int
HTTP_REQUEST_TIME_OUT: int
HTTP_CONFLICT: int
HTTP_GONE: int
HTTP_LENGTH_REQUIRED: int
HTTP_PRECONDITION_FAILED: int
HTTP_REQUEST_ENTITY_TOO_LARGE: int
HTTP_REQUEST_URI_TOO_LARGE: int
HTTP_UNSUPPORTED_MEDIA_TYPE: int
HTTP_RANGE_NOT_SATISFIABLE: int
HTTP_EXPECTATION_FAILED: int
HTTP_UNPROCESSABLE_ENTITY: int
HTTP_INTERNAL_SERVER_ERROR: int
HTTP_NOT_IMPLEMENTED: int
HTTP_BAD_GATEWAY: int
HTTP_SERVICE_UNAVAILABLE: int
HTTP_GATEWAY_TIME_OUT: int
HTTP_VERSION_NOT_SUPPORTED: int
HTTP_VARIANT_ALSO_VARIES: int
HSE_STATUS_SUCCESS: int
HSE_STATUS_SUCCESS_AND_KEEP_CONN: int
HSE_STATUS_PENDING: int
HSE_STATUS_ERROR: int
SF_NOTIFY_SECURE_PORT: int
SF_NOTIFY_NONSECURE_PORT: int
SF_NOTIFY_READ_RAW_DATA: int
SF_NOTIFY_PREPROC_HEADERS: int
SF_NOTIFY_AUTHENTICATION: int
SF_NOTIFY_URL_MAP: int
SF_NOTIFY_ACCESS_DENIED: int
SF_NOTIFY_SEND_RESPONSE: int
SF_NOTIFY_SEND_RAW_DATA: int
SF_NOTIFY_LOG: int
SF_NOTIFY_END_OF_REQUEST: int
SF_NOTIFY_END_OF_NET_SESSION: int
SF_NOTIFY_ORDER_HIGH: int
SF_NOTIFY_ORDER_MEDIUM: int
SF_NOTIFY_ORDER_LOW: int
SF_NOTIFY_ORDER_DEFAULT: int
SF_NOTIFY_ORDER_MASK: Incomplete
SF_STATUS_REQ_FINISHED: int
SF_STATUS_REQ_FINISHED_KEEP_CONN: Incomplete
SF_STATUS_REQ_NEXT_NOTIFICATION: Incomplete
SF_STATUS_REQ_HANDLED_NOTIFICATION: Incomplete
SF_STATUS_REQ_ERROR: Incomplete
SF_STATUS_REQ_READ_NEXT: Incomplete
HSE_IO_SYNC: int
HSE_IO_ASYNC: int
HSE_IO_DISCONNECT_AFTER_SEND: int
HSE_IO_SEND_HEADERS: int
HSE_IO_NODELAY: int
HSE_IO_FINAL_SEND: int
HSE_IO_CACHE_RESPONSE: int
HSE_EXEC_URL_NO_HEADERS: int
HSE_EXEC_URL_IGNORE_CURRENT_INTERCEPTOR: int
HSE_EXEC_URL_IGNORE_VALIDATION_AND_RANGE: int
HSE_EXEC_URL_DISABLE_CUSTOM_ERROR: int
HSE_EXEC_URL_SSI_CMD: int
HSE_EXEC_URL_HTTP_CACHE_ELIGIBLE: int
12 changes: 12 additions & 0 deletions stubs/pywin32/isapi/simple.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from _typeshed import Incomplete

class SimpleExtension:
def GetExtensionVersion(self, vi) -> None: ...
def HttpExtensionProc(self, control_block) -> None: ...
def TerminateExtension(self, status) -> None: ...

class SimpleFilter:
filter_flags: Incomplete
def GetFilterVersion(self, fv) -> None: ...
def HttpFilterProc(self, fc) -> None: ...
def TerminateFilter(self, status) -> None: ...
Loading