diff --git a/stubs/pywin32/@tests/stubtest_allowlist_win32.txt b/stubs/pywin32/@tests/stubtest_allowlist_win32.txt index 071d21fa2..03027c5f2 100644 --- a/stubs/pywin32/@tests/stubtest_allowlist_win32.txt +++ b/stubs/pywin32/@tests/stubtest_allowlist_win32.txt @@ -9,12 +9,12 @@ win32com.client.combrowse win32com.client.tlbrowse # Utilities to generate python bindings -win32com.client.build +win32com.client.build.* win32com.client.CLSIDToClass win32com.client.connect # "dynamic.CDipatch" is necessary for mypy to not throw AssertionError win32com.client.dynamic.* -win32com.client.gencache +win32com.client.gencache.* win32com.client.genpy win32com.client.makepy win32com.client.selecttlb diff --git a/stubs/pywin32/_win32typing.pyi b/stubs/pywin32/_win32typing.pyi index cdfc27926..e5b43e94b 100644 --- a/stubs/pywin32/_win32typing.pyi +++ b/stubs/pywin32/_win32typing.pyi @@ -1,6 +1,8 @@ # Not available at runtime. Contains type definitions that are otherwise not exposed and not part of a specific module. -from _typeshed import Incomplete -from typing_extensions import final +from _typeshed import Incomplete, Self +from collections.abc import Iterable +from typing import overload +from typing_extensions import Literal, final class ArgNotFound: ... class PyOleEmpty: ... @@ -162,13 +164,16 @@ class PRINTER_DEFAULTS: class PyACL: def Initialize(self) -> None: ... def IsValid(self) -> bool: ... - def AddAccessAllowedAce(self, revision, access, sid: PySID, access1, sid1) -> None: ... - def AddAccessAllowedAceEx(self, revision, aceflags, access, sid: PySID) -> None: ... + @overload + def AddAccessAllowedAce(self, __access: int, __sid: PySID) -> None: ... + @overload + def AddAccessAllowedAce(self, __revision: int, __access: int, __sid: PySID) -> None: ... + def AddAccessAllowedAceEx(self, __revision: int, __aceflags: int, __access: int, __sid: PySID) -> None: ... def AddAccessAllowedObjectAce( self, AceRevision, AceFlags, AccessMask, ObjectTypeGuid: PyIID, InheritedObjectTypeGuid: PyIID, sid: PySID ) -> None: ... - def AddAccessDeniedAce(self, revision, access, sid: PySID, access1, sid1) -> None: ... - def AddAccessDeniedAceEx(self, revision, aceflags, access, sid: PySID) -> None: ... + def AddAccessDeniedAce(self, __revision: int, __access: int, __sid: PySID, __access1: int, __sid1: PySID) -> None: ... + def AddAccessDeniedAceEx(self, __revision: int, __aceflags: int, __access: int, __sid: PySID) -> None: ... def AddMandatoryAce(self, AceRevision, AceFlags, MandatoryPolicy, LabelSid: PySID) -> None: ... def AddAuditAccessAce(self, dwAceRevision, dwAccessMask, sid: PySID, bAuditSuccess, bAuditFailure) -> None: ... def AddAuditAccessAceEx(self, dwAceRevision, AceFlags, dwAccessMask, sid: PySID, bAuditSuccess, bAuditFailure) -> None: ... @@ -185,11 +190,13 @@ class PyACL: ) -> None: ... def GetAclSize(self): ... def GetAclRevision(self): ... - def GetAceCount(self): ... - def GetAce(self, index): ... - def DeleteAce(self, index) -> None: ... - def GetEffectiveRightsFromAcl(self, trustee: PyTRUSTEE): ... + def GetAceCount(self) -> int: ... + def GetAce(self, __index: int) -> tuple[tuple[int, int], int, PySID]: ... + def DeleteAce(self, __index: int) -> None: ... + def GetEffectiveRightsFromAcl(self, __trustee: PyTRUSTEE | dict[str, int | PySID]) -> int: ... def GetAuditedPermissionsFromAcl(self, trustee: PyTRUSTEE) -> tuple[Incomplete, Incomplete]: ... + def SetEntriesInAcl(self, __obexpl_list: tuple[dict[str, int | dict[str, int | PySID]], ...]) -> PyACL: ... + def GetExplicitEntriesFromAcl(self) -> tuple[dict[str, int | dict[str, int | PySID]]] | None: ... class PyBITMAP: @property @@ -546,7 +553,7 @@ class PyConsoleScreenBuffer: def ReadConsole(self, NumberOfCharsToRead): ... def WriteConsole(self, Buffer): ... def FlushConsoleInputBuffer(self) -> None: ... - def SetConsoleTextAttribute(self, Attributes) -> None: ... + def SetConsoleTextAttribute(self, __Attributes: int) -> None: ... def SetConsoleCursorPosition(self, CursorPosition: PyCOORD) -> None: ... def SetConsoleScreenBufferSize(self, Size: PyCOORD) -> None: ... def SetConsoleWindowInfo(self, Absolute, ConsoleWindow: PySMALL_RECT) -> None: ... @@ -566,7 +573,7 @@ class PyConsoleScreenBuffer: def SetConsoleFont(self, Font) -> None: ... def SetStdHandle(self, StdHandle) -> None: ... def SetConsoleDisplayMode(self, Flags, NewScreenBufferDimensions: PyCOORD) -> None: ... - def WriteConsoleInput(self, Buffer: tuple[PyINPUT_RECORD, ...]): ... + def WriteConsoleInput(self, __Buffer: Iterable[PyINPUT_RECORD]): ... def ReadConsoleInput(self, Length) -> tuple[PyINPUT_RECORD, ...]: ... def PeekConsoleInput(self, Length) -> tuple[PyINPUT_RECORD, ...]: ... def GetNumberOfConsoleInputEvents(self): ... @@ -864,7 +871,7 @@ class PyEventLogRecord: @property def StringInserts(self) -> tuple[str, ...]: ... @property - def Sid(self) -> PySID: ... + def Sid(self) -> PySID | None: ... @property def Data(self) -> str: ... @property @@ -916,7 +923,7 @@ class PyHANDLE: def handle(self) -> int: ... def Close(self) -> None: ... def close(self) -> None: ... - def Detach(self): ... + def Detach(self: Self) -> Self: ... @final class PyHDESK: @@ -1049,7 +1056,10 @@ class PyHH_WINTYPE: def urlJump2(self) -> str: ... class PyHINTERNET: ... -class PyHKEY: ... + +class PyHKEY: + def Close(self): ... + class PyHTHEME: ... @final @@ -1060,36 +1070,25 @@ class PyHWINSTA: def Detach(self, *args, **kwargs): ... # incomplete class PyICONINFO: ... + +@final class PyIID: ... @final class PyINPUT_RECORD: - @property - def EventType(self): ... - @property - def KeyDown(self): ... - @property - def RepeatCount(self): ... - @property - def VirtualKeyCode(self): ... - @property - def VirtualScanCode(self): ... - @property - def Char(self) -> str: ... - @property - def ControlKeyState(self): ... - @property - def ButtonState(self): ... - @property - def EventFlags(self): ... - @property - def MousePosition(self) -> PyCOORD: ... - @property - def Size(self) -> PyCOORD: ... - @property - def SetFocus(self): ... - @property - def CommandId(self): ... + EventType: int + KeyDown: int | bool + RepeatCount: int + VirtualKeyCode: int + VirtualScanCode: Incomplete + Char: str + ControlKeyState: int + ButtonState: int + EventFlags: int + MousePosition: PyCOORD + Size: PyCOORD + SetFocus: Incomplete + CommandId: Incomplete class PyLOCALGROUP_INFO_0: @property @@ -1206,20 +1205,13 @@ class PyNMHDR: class PyNOTIFYICONDATA: ... class PyOVERLAPPED: - @property - def Offset(self) -> int: ... - @property - def OffsetHigh(self) -> int: ... - @property - def object(self): ... - @property - def dword(self): ... - @property - def hEvent(self) -> int: ... - @property - def Internal(self) -> int: ... - @property - def InternalHigh(self) -> int: ... + Offset: int + OffsetHigh: int + object: object + dword: int + hEvent: int + Internal: int + InternalHigh: int class PyOVERLAPPEDReadBuffer: ... @@ -1276,10 +1268,8 @@ class PySCROLLINFO: ... class PySC_HANDLE: ... class PySECURITY_ATTRIBUTES: - @property - def bInheritHandle(self): ... - @property - def SECURITY_DESCRIPTOR(self) -> PySECURITY_DESCRIPTOR: ... + bInheritHandle: int + SECURITY_DESCRIPTOR: PySECURITY_DESCRIPTOR class PySECURITY_DESCRIPTOR: def Initialize(self) -> None: ... @@ -1287,13 +1277,14 @@ class PySECURITY_DESCRIPTOR: def GetSecurityDescriptorDacl(self) -> PyACL: ... def GetSecurityDescriptorSacl(self) -> PyACL: ... def GetSecurityDescriptorControl(self) -> tuple[Incomplete, Incomplete]: ... - def SetSecurityDescriptorOwner(self, sid: PySID, bOwnerDefaulted) -> None: ... + def SetSecurityDescriptorOwner(self, __sid: PySID, __bOwnerDefaulted: int | bool) -> None: ... def SetSecurityDescriptorGroup(self, sid: PySID, bOwnerDefaulted): ... + def SetSecurityDescriptorDacl(self, __bSaclPresent: int | bool, __SACL: PyACL, __bSaclDefaulted: int | bool) -> None: ... def SetSecurityDescriptorSacl(self, bSaclPresent, SACL: PyACL, bSaclDefaulted) -> None: ... + def SetSecurityDescriptorControl(self, ControlBitsOfInterest, ControlBitsToSet) -> None: ... def IsValid(self) -> bool: ... def GetLength(self) -> None: ... def IsSelfRelative(self) -> bool: ... - def SetSecurityDescriptorControl(self, ControlBitsOfInterest, ControlBitsToSet) -> None: ... class PySERVER_INFO_100: @property @@ -1661,34 +1652,20 @@ class PySMALL_RECT: def Bottom(self): ... class PySTARTUPINFO: - @property - def dwX(self) -> int: ... - @property - def dwY(self) -> int: ... - @property - def dwXSize(self) -> int: ... - @property - def dwYSize(self) -> int: ... - @property - def dwXCountChars(self) -> int: ... - @property - def dwYCountChars(self) -> int: ... - @property - def dwFillAttribute(self) -> int: ... - @property - def dwFlags(self) -> int: ... - @property - def wShowWindow(self) -> int: ... - @property - def hStdInput(self) -> int: ... - @property - def hStdOutput(self) -> int: ... - @property - def hStdError(self) -> int: ... - @property - def lpDesktop(self) -> str: ... - @property - def lpTitle(self) -> str: ... + dwX: int + dwY: int + dwXSize: int + dwYSize: int + dwXCountChars: int + dwYCountChars: int + dwFillAttribute: int + dwFlags: int + wShowWindow: int + hStdInput: int + hStdOutput: int + hStdError: int + lpDesktop: str + lpTitle: str class PySecBuffer: @property @@ -1703,6 +1680,7 @@ class PySecBuffer: class PySecBufferDesc: Version: Incomplete + Buffer: Incomplete def append(self, buffer) -> None: ... class PyTOKEN_GROUPS: ... @@ -1722,17 +1700,18 @@ class PyTRIVERTEX: @property def Alpha(self): ... +# Properties Multiple* are ignored class PyTRUSTEE: @property - def TrusteeForm(self): ... + def TrusteeForm(self) -> int: ... @property - def TrusteeType(self): ... + def TrusteeType(self) -> int: ... @property - def Identifier(self): ... + def Identifier(self) -> PySID: ... @property - def MultipleTrustee(self): ... + def MultipleTrustee(self) -> None: ... @property - def MultipleTrusteeOperation(self): ... + def MultipleTrusteeOperation(self) -> Literal[0]: ... class PyTS_HANDLE: ... @@ -2459,7 +2438,9 @@ class SERVICE_FAILURE_ACTIONS: @property def Actions(self): ... -class SERVICE_STATUS: ... +class SERVICE_STATUS: + def __getitem__(self, __i: int) -> int: ... + class TRACKMOUSEEVENT: ... class ULARGE_INTEGER: ... class WIN32_FIND_DATA: ... @@ -3389,6 +3370,7 @@ class PyIDirectorySearch: def GetColumn(self, handle, name: str) -> tuple[Incomplete, Incomplete, Incomplete]: ... def GetNextColumnName(self) -> None: ... +@final class PyIDispatch: def Invoke(self, dispid, lcid, flags, bResultWanted, arg: tuple[Incomplete, ...]): ... def InvokeTypes( @@ -4679,6 +4661,7 @@ class PyIUniformResourceLocator: def SetURL(self, URL, InFlags: int = ...) -> None: ... def InvokeCommand(self, Verb, Flags: int = ..., hwndParent: int = ...): ... +@final class PyIUnknown: def QueryInterface(self, iid, useIID: Incomplete | None = ...) -> PyIUnknown: ... @@ -5788,7 +5771,7 @@ class PyCWinApp: def LoadCursor(self, cursorId: PyResourceId): ... def LoadStandardCursor(self, cursorId: PyResourceId): ... def LoadOEMCursor(self, cursorId): ... - def LoadIcon(self, idResource): ... + def LoadIcon(self, idResource: int) -> int: ... def LoadStandardIcon(self, resourceName: PyResourceId): ... def OpenDocumentFile(self, fileName: str) -> None: ... def OnFileNew(self) -> None: ... diff --git a/stubs/pywin32/pythoncom.pyi b/stubs/pywin32/pythoncom.pyi index a46f55b0f..30a0f46a8 100644 --- a/stubs/pywin32/pythoncom.pyi +++ b/stubs/pywin32/pythoncom.pyi @@ -20,7 +20,7 @@ def CoCreateInstanceEx( iids: list[_win32typing.PyIID], ) -> _win32typing.PyIUnknown: ... def CoCreateInstance( - clsid: _win32typing.PyIID, unkOuter: _win32typing.PyIUnknown, context, iid: _win32typing.PyIID + __clsid: _win32typing.PyIID, __unkOuter: _win32typing.PyIUnknown | None, __context: int, __iid: _win32typing.PyIID ) -> _win32typing.PyIUnknown: ... def CoFreeUnusedLibraries() -> None: ... def CoInitialize() -> None: ... @@ -84,7 +84,7 @@ def OleLoadFromStream(stream: _win32typing.PyIStream, iid: _win32typing.PyIID) - def OleSaveToStream(persist: _win32typing.PyIPersistStream, stream: _win32typing.PyIStream) -> None: ... def OleLoad(storage: _win32typing.PyIStorage, iid: _win32typing.PyIID, site: _win32typing.PyIOleClientSite) -> None: ... def ProgIDFromCLSID(clsid) -> str: ... -def PumpWaitingMessages(): ... +def PumpWaitingMessages(__firstMessage: int = ..., __lastMessage: int = ...) -> int: ... def PumpMessages() -> None: ... def QueryPathOfRegTypeLib(iid: _win32typing.PyIID, versionMajor, versionMinor, lcid) -> str: ... def ReadClassStg(storage: _win32typing.PyIStorage) -> _win32typing.PyIID: ... diff --git a/stubs/pywin32/pythonwin/win32ui.pyi b/stubs/pywin32/pythonwin/win32ui.pyi index 61c3e6cee..ab07c2db0 100644 --- a/stubs/pywin32/pythonwin/win32ui.pyi +++ b/stubs/pywin32/pythonwin/win32ui.pyi @@ -122,7 +122,7 @@ def MessageBox(message: str, arg, title: str | None = ...): ... def OutputDebugString(msg: str) -> None: ... def EnableControlContainer(): ... def PrintTraceback(tb, output) -> None: ... -def PumpWaitingMessages(firstMessage, lastMessage): ... +def PumpWaitingMessages(__firstMessage: int = ..., __lastMessage: int = ...) -> int: ... def RegisterWndClass(style, hCursor: int = ..., hBrush: int = ..., hIcon=...) -> str: ... def RemoveRecentFile(index: int = ...) -> None: ... def SetAppHelpPath(): ... diff --git a/stubs/pywin32/win32/_wincerapi.pyi b/stubs/pywin32/win32/_wincerapi.pyi index a33e7d6df..a8834cc80 100644 --- a/stubs/pywin32/win32/_wincerapi.pyi +++ b/stubs/pywin32/win32/_wincerapi.pyi @@ -5,15 +5,15 @@ import _win32typing def CeRapiInit() -> None: ... def CeRapiUninit() -> None: ... def CreateProcess( - appName: str, - commandLine: str, - processAttributes: _win32typing.PySECURITY_ATTRIBUTES, - threadAttributes: _win32typing.PySECURITY_ATTRIBUTES, - bInheritHandles, - dwCreationFlags, - newEnvironment, - currentDirectory: str, - startupinfo: _win32typing.PySTARTUPINFO, + __appName: str | None, + __commandLine: str, + __processAttributes: _win32typing.PySECURITY_ATTRIBUTES | None, + __threadAttributes: _win32typing.PySECURITY_ATTRIBUTES | None, + __bInheritHandles: int | bool, + __dwCreationFlags: int, + __newEnvironment: dict[str, str] | None, + __currentDirectory: str | None, + __startupinfo: _win32typing.PySTARTUPINFO, ) -> tuple[int, int, Incomplete, Incomplete]: ... def CeRapiInitEx(): ... def CeCopyFile(_from: str, to: str, bFailIfExists) -> None: ... @@ -47,7 +47,7 @@ def CeGetFileAttributes(fileName: str): ... def CeSetFileAttributes(filename: str, newAttributes) -> None: ... def CeGetFileSize(): ... def CeReadFile(hFile: int, bufSize) -> str: ... -def WriteFile(hFile: int, data: str) -> tuple[Incomplete, Incomplete]: ... +def WriteFile(__hFile: int, __data: str | bytes | _win32typing.PyOVERLAPPEDReadBuffer) -> tuple[int, int]: ... CSIDL_BITBUCKET = ... CSIDL_COMMON_DESKTOPDIRECTORY = ... diff --git a/stubs/pywin32/win32/lib/pywintypes.pyi b/stubs/pywin32/win32/lib/pywintypes.pyi index bf2320d5f..c0f995607 100644 --- a/stubs/pywin32/win32/lib/pywintypes.pyi +++ b/stubs/pywin32/win32/lib/pywintypes.pyi @@ -6,12 +6,20 @@ from typing_extensions import Literal import _win32typing -class error(Exception): ... +class error(Exception): + winerror: int + funcname: str + strerror: str + def __init__(self, winerror: int, funcname: str, strerror: str): ... + class com_error(Exception): ... +class UnicodeType(str): ... class TimeType(datetime): Format = datetime.strftime +IIDType = _win32typing.PyIID + def DosDateTimeToTime() -> _win32typing.PyTime: ... def Unicode() -> str: ... def UnicodeFromRaw(_str: str) -> str: ... @@ -20,7 +28,7 @@ def OVERLAPPED() -> _win32typing.PyOVERLAPPED: ... def IID(iidString: str, is_bytes: bool = ...) -> _win32typing.PyIID: ... def Time(timeRepr) -> _win32typing.PyTime: ... def CreateGuid() -> _win32typing.PyIID: ... -def ACL(bufSize: int = ...) -> _win32typing.PyACL: ... +def ACL(__bufSize: int = ...) -> _win32typing.PyACL: ... def SID(buffer, idAuthority, subAuthorities, bufSize=...) -> _win32typing.PySID: ... def SECURITY_ATTRIBUTES() -> _win32typing.PySECURITY_ATTRIBUTES: ... def SECURITY_DESCRIPTOR() -> _win32typing.PySECURITY_DESCRIPTOR: ... diff --git a/stubs/pywin32/win32/lib/win32evtlogutil.pyi b/stubs/pywin32/win32/lib/win32evtlogutil.pyi index faf4b30f5..626cab5b1 100644 --- a/stubs/pywin32/win32/lib/win32evtlogutil.pyi +++ b/stubs/pywin32/win32/lib/win32evtlogutil.pyi @@ -1,4 +1,7 @@ from _typeshed import Incomplete +from collections.abc import Iterable + +import _win32typing error: Incomplete langid: Incomplete @@ -8,14 +11,14 @@ def AddSourceToRegistry( ) -> None: ... def RemoveSourceFromRegistry(appName, eventLogType: str = ...) -> None: ... def ReportEvent( - appName, - eventID, + appName: str, + eventID: int, eventCategory: int = ..., - eventType=..., - strings: Incomplete | None = ..., - data: Incomplete | None = ..., - sid: Incomplete | None = ..., + eventType: int = ..., + strings: Iterable[str] | None = ..., + data: bytes | None = ..., + sid: _win32typing.PySID | None = ..., ) -> None: ... -def FormatMessage(eventLogRecord, logType: str = ...): ... +def FormatMessage(eventLogRecord: _win32typing.PyEventLogRecord, logType: str = ...): ... def SafeFormatMessage(eventLogRecord, logType: Incomplete | None = ...): ... def FeedEventLogRecords(feeder, machineName: Incomplete | None = ..., logName: str = ..., readFlags: Incomplete | None = ...): ... diff --git a/stubs/pywin32/win32/lib/win32pdhquery.pyi b/stubs/pywin32/win32/lib/win32pdhquery.pyi index 61267b048..5130ceae5 100644 --- a/stubs/pywin32/win32/lib/win32pdhquery.pyi +++ b/stubs/pywin32/win32/lib/win32pdhquery.pyi @@ -37,6 +37,6 @@ class Query(BaseQuery): def collectdatawhile_slave(self, period) -> None: ... def __getinitargs__(self): ... -class QueryError: +class QueryError(Exception): query: Incomplete def __init__(self, query) -> None: ... diff --git a/stubs/pywin32/win32/lib/win32serviceutil.pyi b/stubs/pywin32/win32/lib/win32serviceutil.pyi new file mode 100644 index 000000000..d31471255 --- /dev/null +++ b/stubs/pywin32/win32/lib/win32serviceutil.pyi @@ -0,0 +1,81 @@ +from _typeshed import Incomplete +from collections.abc import Iterable, Sequence + +error = RuntimeError + +def LocatePythonServiceExe(exe: Incomplete | None = ...): ... +def SmartOpenService(hscm, name, access): ... +def LocateSpecificServiceExe(serviceName): ... +def InstallPerfmonForService(serviceName, iniName, dllName: Incomplete | None = ...) -> None: ... +def InstallService( + pythonClassString, + serviceName, + displayName, + startType: Incomplete | None = ..., + errorControl: Incomplete | None = ..., + bRunInteractive: int = ..., + serviceDeps: Incomplete | None = ..., + userName: Incomplete | None = ..., + password: Incomplete | None = ..., + exeName: Incomplete | None = ..., + perfMonIni: Incomplete | None = ..., + perfMonDll: Incomplete | None = ..., + exeArgs: Incomplete | None = ..., + description: Incomplete | None = ..., + delayedstart: Incomplete | None = ..., +) -> None: ... +def ChangeServiceConfig( + pythonClassString, + serviceName, + startType: Incomplete | None = ..., + errorControl: Incomplete | None = ..., + bRunInteractive: int = ..., + serviceDeps: Incomplete | None = ..., + userName: Incomplete | None = ..., + password: Incomplete | None = ..., + exeName: Incomplete | None = ..., + displayName: Incomplete | None = ..., + perfMonIni: Incomplete | None = ..., + perfMonDll: Incomplete | None = ..., + exeArgs: Incomplete | None = ..., + description: Incomplete | None = ..., + delayedstart: Incomplete | None = ..., +) -> None: ... +def InstallPythonClassString(pythonClassString, serviceName) -> None: ... +def SetServiceCustomOption(serviceName, option, value) -> None: ... +def GetServiceCustomOption(serviceName, option, defaultValue: Incomplete | None = ...): ... +def RemoveService(serviceName) -> None: ... +def ControlService(serviceName, code, machine: Incomplete | None = ...): ... +def WaitForServiceStatus(serviceName, status, waitSecs, machine: Incomplete | None = ...) -> None: ... +def StopServiceWithDeps(serviceName, machine: Incomplete | None = ..., waitSecs: int = ...) -> None: ... +def StopService(serviceName, machine: Incomplete | None = ...): ... +def StartService(serviceName, args: Incomplete | None = ..., machine: Incomplete | None = ...) -> None: ... +def RestartService( + serviceName, args: Incomplete | None = ..., waitSeconds: int = ..., machine: Incomplete | None = ... +) -> None: ... +def DebugService(cls, argv=...) -> None: ... +def GetServiceClassString(cls, argv: Incomplete | None = ...): ... +def QueryServiceStatus(serviceName, machine: Incomplete | None = ...): ... +def usage() -> None: ... +def HandleCommandLine( + cls: type[ServiceFramework], + serviceClassString: Incomplete | None = ..., + argv: Sequence[str] | None = ..., + customInstallOptions: str = ..., + customOptionHandler: Incomplete | None = ..., +): ... + +class ServiceFramework: + ssh: Incomplete + checkPoint: int + def __init__(self, args: Iterable[str]) -> None: ... + def GetAcceptedControls(self): ... + def ReportServiceStatus( + self, serviceStatus, waitHint: int = ..., win32ExitCode: int = ..., svcExitCode: int = ... + ) -> None: ... + def SvcInterrogate(self) -> None: ... + def SvcOther(self, control) -> None: ... + def ServiceCtrlHandler(self, control): ... + def SvcOtherEx(self, control, event_type, data): ... + def ServiceCtrlHandlerEx(self, control, event_type, data): ... + def SvcRun(self) -> None: ... diff --git a/stubs/pywin32/win32/lib/winerror.pyi b/stubs/pywin32/win32/lib/winerror.pyi index de99b3dbc..b586d0f7a 100644 --- a/stubs/pywin32/win32/lib/winerror.pyi +++ b/stubs/pywin32/win32/lib/winerror.pyi @@ -1942,7 +1942,7 @@ SEVERITY_ERROR: int def HRESULT_FROM_WIN32(scode): ... def SUCCEEDED(Status): ... def FAILED(Status): ... -def HRESULT_CODE(hr): ... +def HRESULT_CODE(hr: int) -> int: ... def SCODE_CODE(sc): ... def HRESULT_FACILITY(hr): ... def SCODE_FACILITY(sc): ... diff --git a/stubs/pywin32/win32/perfmon.pyi b/stubs/pywin32/win32/perfmon.pyi index 4639a21fa..0656bec3f 100644 --- a/stubs/pywin32/win32/perfmon.pyi +++ b/stubs/pywin32/win32/perfmon.pyi @@ -1,7 +1,7 @@ import _win32typing -def LoadPerfCounterTextStrings() -> None: ... -def UnloadPerfCounterTextStrings() -> None: ... +def LoadPerfCounterTextStrings(__commandLine: str) -> None: ... +def UnloadPerfCounterTextStrings(__commandLine: str) -> None: ... def CounterDefinition() -> _win32typing.PyPERF_COUNTER_DEFINITION: ... def ObjectType() -> _win32typing.PyPERF_OBJECT_TYPE: ... def PerfMonManager( diff --git a/stubs/pywin32/win32/servicemanager.pyi b/stubs/pywin32/win32/servicemanager.pyi index 5b61d790e..80f4b7e2e 100644 --- a/stubs/pywin32/win32/servicemanager.pyi +++ b/stubs/pywin32/win32/servicemanager.pyi @@ -3,11 +3,11 @@ from _typeshed import Incomplete def CoInitializeEx() -> None: ... def CoUninitialize() -> None: ... def RegisterServiceCtrlHandler(serviceName: str, callback, extra_args: bool = ...): ... -def LogMsg(errorType, eventId, inserts: tuple[str, Incomplete] | None = ...) -> None: ... +def LogMsg(__errorType: int, __eventId: int, __inserts: tuple[str, str] | None = ...) -> None: ... def LogInfoMsg(msg: str) -> None: ... def LogErrorMsg(msg: str) -> None: ... def LogWarningMsg(msg: str) -> None: ... -def PumpWaitingMessages(): ... +def PumpWaitingMessages(__firstMessage: int = ..., __lastMessage: int = ...) -> int: ... def Debugging(newVal: int = ...): ... def Initialize(eventSourceName: str | None = ..., eventSourceFile: str | None = ...) -> None: ... def Finalize() -> None: ... diff --git a/stubs/pywin32/win32/win32api.pyi b/stubs/pywin32/win32/win32api.pyi index e5acc9380..855559c79 100644 --- a/stubs/pywin32/win32/win32api.pyi +++ b/stubs/pywin32/win32/win32api.pyi @@ -1,4 +1,5 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, ReadableBuffer +from collections.abc import Callable, Iterable from typing_extensions import TypedDict import _win32typing @@ -18,14 +19,19 @@ def BeginUpdateResource(filename: str, delete) -> int: ... def ChangeDisplaySettings(DevMode: _win32typing.PyDEVMODE, Flags): ... def ChangeDisplaySettingsEx(DeviceName: Incomplete | None = ..., DevMode: _win32typing.PyDEVMODE | None = ..., Flags=...): ... def ClipCursor(arg: tuple[Incomplete, Incomplete, Incomplete, Incomplete]) -> None: ... -def CloseHandle(handle: int) -> None: ... +def CloseHandle(__handle: int) -> None: ... def CopyFile(src, dest: str, bFailOnExist: int = ...) -> None: ... def DebugBreak() -> None: ... def DeleteFile(fileName: str) -> None: ... def DragQueryFile(hDrop, fileNum: int = ...) -> str: ... def DragFinish(hDrop) -> None: ... def DuplicateHandle( - hSourceProcess: int, hSource: int, hTargetProcessHandle: int, desiredAccess, bInheritHandle, options + __hSourceProcess: int, + __hSource: int, + __hTargetProcessHandle: int, + __desiredAccess: int, + __bInheritHandle: int, + __options: int, ) -> int: ... def EndUpdateResource(handle: int, discard) -> None: ... def EnumDisplayDevices(Device: str | None = ..., DevNum: int = ..., Flags: int = ...) -> _win32typing.PyDISPLAY_DEVICE: ... @@ -47,10 +53,22 @@ def FindFirstChangeNotification(pathName: str, bSubDirs, _filter): ... def FindNextChangeNotification(handle: int) -> None: ... def FindCloseChangeNotification(handle) -> None: ... def FindExecutable(filename: str, _dir: str) -> tuple[Incomplete, str]: ... -def FormatMessage(flags, source, messageId, languageID, inserts, errCode: int = ...) -> str: ... -def FormatMessageW(flags, source, messageId, languageID, inserts, errCode: int = ...) -> str: ... +def FormatMessage( + __flags: int, + __source: str | None = ..., + __messageId: int = ..., + __languageID: int = ..., + __inserts: Iterable[str] | None = ..., +) -> str: ... +def FormatMessageW( + __flags: int, + __source: int | None = ..., + __messageId: int = ..., + __languageID: int = ..., + __inserts: Iterable[str] | None = ..., +) -> str: ... def FreeLibrary(hModule: int) -> None: ... -def GenerateConsoleCtrlEvent(controlEvent, processGroupId): ... +def GenerateConsoleCtrlEvent(__controlEvent: int, __processGroupId: int) -> None: ... def GetAsyncKeyState(key): ... def GetCommandLine() -> str: ... def GetComputerName() -> str: ... @@ -58,16 +76,16 @@ def GetComputerNameEx(NameType) -> str: ... def GetComputerObjectName(NameFormat) -> str: ... def GetMonitorInfo(hMonitor: int) -> _MonitorInfo: ... def GetUserName() -> str: ... -def GetUserNameEx(NameFormat) -> str: ... +def GetUserNameEx(__NameFormat: int) -> str: ... def GetCursorPos() -> tuple[Incomplete, Incomplete]: ... def GetCurrentThread(): ... def GetCurrentThreadId(): ... def GetCurrentProcessId(): ... -def GetCurrentProcess(): ... +def GetCurrentProcess() -> int: ... def GetConsoleTitle() -> str: ... def GetDateFormat(locale, flags, time: _win32typing.PyTime, _format: str) -> str: ... def GetDiskFreeSpace(rootPath: str): ... -def GetDiskFreeSpaceEx(rootPath: str): ... +def GetDiskFreeSpaceEx(__rootPath: str) -> tuple[int, int, int]: ... def GetDllDirectory() -> str: ... def GetDomainName() -> str: ... def GetEnvironmentVariable(variable): ... @@ -76,7 +94,7 @@ def GetFileAttributes(pathName: str): ... def GetFileVersionInfo(Filename: str, SubBlock: str) -> None: ... def GetFocus(): ... def GetFullPathName(fileName: str) -> str: ... -def GetHandleInformation(Object: int): ... +def GetHandleInformation(__Object: int): ... def GetKeyboardLayout(threadId: int = ...): ... def GetKeyboardLayoutName(): ... def GetKeyboardState() -> str: ... @@ -84,19 +102,19 @@ def GetKeyState(key): ... def GetLastError(): ... def GetLastInputInfo(): ... def GetLocalTime(): ... -def GetLongPathName(fileName: str) -> str: ... +def GetLongPathName(__fileName: str) -> str: ... def GetLongPathNameW(fileName: str) -> str: ... def GetLogicalDrives(): ... def GetLogicalDriveStrings() -> str: ... def GetModuleFileName(hModule: int) -> str: ... def GetModuleFileNameW(hModule: int) -> str: ... -def GetModuleHandle(fileName: str | None = ...): ... +def GetModuleHandle(__fileName: str | None = ...) -> int: ... def GetPwrCapabilities(): ... def GetProfileSection(section: str, iniName: str | None = ...): ... def GetProcAddress(hModule: int, functionName: _win32typing.PyResourceId): ... def GetProfileVal(section: str, entry: str, defValue: str, iniName: str | None = ...) -> str: ... def GetShortPathName(path: str) -> str: ... -def GetStdHandle(handle) -> None: ... +def GetStdHandle(__handle: int) -> _win32typing.PyHANDLE: ... def GetSysColor(index): ... def GetSystemDefaultLangID(): ... def GetSystemDefaultLCID(): ... @@ -117,11 +135,11 @@ def GetVersion(): ... def GetVersionEx(_format: int = ...): ... def GetVolumeInformation(path: str): ... def GetWindowsDirectory() -> str: ... -def GetWindowLong(hwnd: int, offset): ... +def GetWindowLong(__hwnd: int | None, __offset: int) -> int: ... def GetUserDefaultLangID(): ... def GetUserDefaultLCID(): ... def GlobalMemoryStatus(): ... -def GlobalMemoryStatusEx(): ... +def GlobalMemoryStatusEx() -> dict[str, int]: ... def keybd_event(bVk, bScan, dwFlags: int = ..., dwExtraInfo: int = ...) -> None: ... def mouse_event(dx, dy, dwData, dwFlags: int = ..., dwExtraInfo=...) -> None: ... def LoadCursor(hInstance: int, cursorid: _win32typing.PyResourceId) -> int: ... @@ -137,15 +155,15 @@ def MonitorFromRect(__rc: _win32typing.PyRECT | tuple[int, int, int, int], __Fla def MonitorFromWindow(hwnd: int, Flags: int = ...) -> int: ... def MoveFile(srcName: str, destName: str) -> None: ... def MoveFileEx(srcName: str, destName: str, flag) -> None: ... -def OpenProcess(reqdAccess, bInherit, pid) -> int: ... +def OpenProcess(__reqdAccess: int, __bInherit: int | bool, __pid: int) -> int: ... def OutputDebugString(msg: str) -> None: ... def PostMessage(hwnd: int, idMessage, wParam: Incomplete | None = ..., lParam: Incomplete | None = ...) -> None: ... -def PostQuitMessage(exitCode: int = ...) -> None: ... +def PostQuitMessage(__exitCode: int = ...) -> None: ... def PostThreadMessage(tid, idMessage, wParam: Incomplete | None = ..., lParam: Incomplete | None = ...) -> None: ... def RegCloseKey(key: _win32typing.PyHKEY) -> None: ... def RegConnectRegistry(computerName: str, key): ... def RegCopyTree(KeySrc: _win32typing.PyHKEY, SubKey: str, KeyDest: _win32typing.PyHKEY) -> None: ... -def RegCreateKey(key: _win32typing.PyHKEY, subKey: str) -> _win32typing.PyHKEY: ... +def RegCreateKey(key: _win32typing.PyHKEY | int, subKey: str) -> _win32typing.PyHKEY: ... def RegCreateKeyEx( Key: _win32typing.PyHKEY, SubKey: str, @@ -167,14 +185,16 @@ def RegFlushKey(key: _win32typing.PyHKEY) -> None: ... def RegGetKeySecurity(key: _win32typing.PyHKEY, security_info) -> _win32typing.PySECURITY_DESCRIPTOR: ... def RegLoadKey(key: _win32typing.PyHKEY, subKey: str, filename: str) -> None: ... def RegOpenCurrentUser(samDesired) -> _win32typing.PyHKEY: ... -def RegOpenKey() -> _win32typing.PyHKEY: ... -def RegOpenKeyEx(key: _win32typing.PyHKEY, subKey: str, sam, reserved=...) -> _win32typing.PyHKEY: ... +def RegOpenKey( + __key: _win32typing.PyHKEY | int, __subkey: str | None, __reserved: bool = ..., __sam: int = ... +) -> _win32typing.PyHKEY: ... +def RegOpenKeyEx(__key: _win32typing.PyHKEY, __subKey: str, __sam: int, __reserved: bool = ...) -> _win32typing.PyHKEY: ... def RegOpenKeyTransacted( Key: _win32typing.PyHKEY, SubKey: str, samDesired, Transaction: int, Options: int = ... ) -> _win32typing.PyHKEY: ... def RegOverridePredefKey(Key: _win32typing.PyHKEY, NewKey: _win32typing.PyHKEY) -> None: ... def RegQueryValue(key: _win32typing.PyHKEY, subKey: str) -> str: ... -def RegQueryValueEx(key: _win32typing.PyHKEY, valueName: str) -> tuple[Incomplete, Incomplete]: ... +def RegQueryValueEx(__key: _win32typing.PyHKEY | int, __valueName: str | None) -> tuple[str, int]: ... def RegQueryInfoKey(key: _win32typing.PyHKEY) -> tuple[Incomplete, Incomplete, Incomplete]: ... def RegQueryInfoKeyW(Key: _win32typing.PyHKEY): ... def RegRestoreKey(Key: _win32typing.PyHKEY, File: str, Flags: int = ...) -> None: ... @@ -183,14 +203,14 @@ def RegSaveKeyEx( Key: _win32typing.PyHKEY, File: str, Flags, SecurityAttributes: _win32typing.PySECURITY_ATTRIBUTES | None = ... ) -> None: ... def RegSetKeySecurity(key: _win32typing.PyHKEY, security_info, sd: _win32typing.PySECURITY_DESCRIPTOR) -> None: ... -def RegSetValue(key: _win32typing.PyHKEY, subKey: str, _type, value: str) -> None: ... +def RegSetValue(key: _win32typing.PyHKEY, subKey: str | None, _type, value: str) -> None: ... def RegSetValueEx(key: _win32typing.PyHKEY, valueName: str, reserved, _type, value) -> None: ... def RegUnLoadKey(key: _win32typing.PyHKEY, subKey: str) -> None: ... def RegisterWindowMessage(msgString: str) -> None: ... def RegNotifyChangeKeyValue(key: _win32typing.PyHKEY, bWatchSubTree, dwNotifyFilter, hKey: int, fAsynchronous) -> None: ... def SearchPath(path: str, fileName: str, fileExt: str | None = ...): ... def SendMessage(hwnd: int, idMessage, wParam: str | None = ..., lParam: str | None = ...) -> None: ... -def SetConsoleCtrlHandler(ctrlHandler, bAdd) -> None: ... +def SetConsoleCtrlHandler(__ctrlHandler: Callable[[int], bool], __bAdd: bool) -> None: ... def SetConsoleTitle(title: str) -> None: ... def SetCursorPos(arg: tuple[Incomplete, Incomplete]) -> None: ... def SetDllDirectory(PathName: str) -> None: ... @@ -210,15 +230,19 @@ def SetStdHandle(handle, handle1: int) -> None: ... def SetSystemPowerState(Suspend, Force) -> None: ... def SetThreadLocale(lcid) -> None: ... def SetTimeZoneInformation(tzi): ... -def SetWindowLong(hwnd: int, offset, val): ... +def SetWindowLong(__hwnd: int | None, __offset: int, __value: float) -> int: ... def ShellExecute(hwnd: int, op: str, file: str, params: str, _dir: str, bShow): ... def ShowCursor(show): ... def Sleep(time, bAlterable: int = ...): ... -def TerminateProcess(handle: int, exitCode) -> None: ... +def TerminateProcess(__handle: int, __exitCode: int) -> None: ... def ToAsciiEx(vk, scancode, keyboardstate, flags: int = ..., hlayout: Incomplete | None = ...): ... def Unicode() -> str: ... def UpdateResource( - handle: int, _type: _win32typing.PyResourceId, name: _win32typing.PyResourceId, data: str, language + __handle: int, + __type: _win32typing.PyResourceId | int, + __name: _win32typing.PyResourceId | int, + __data: ReadableBuffer | None, + language: int = ..., ) -> None: ... def VkKeyScan(char, char1): ... def WinExec(cmdLine: str, arg) -> None: ... diff --git a/stubs/pywin32/win32/win32console.pyi b/stubs/pywin32/win32/win32console.pyi index eccd920c0..e66038afe 100644 --- a/stubs/pywin32/win32/win32console.pyi +++ b/stubs/pywin32/win32/win32console.pyi @@ -20,8 +20,8 @@ def GetConsoleWindow(): ... def GetNumberOfConsoleFonts(): ... def SetConsoleTitle(ConsoleTitle) -> None: ... def GetConsoleTitle(): ... -def GenerateConsoleCtrlEvent(CtrlEvent, ProcessGroupId: int = ...) -> None: ... -def GetStdHandle(StdHandle) -> _win32typing.PyConsoleScreenBuffer: ... +def GenerateConsoleCtrlEvent(__CtrlEvent: int, __ProcessGroupId: int = ...) -> None: ... +def GetStdHandle(__StdHandle: int) -> _win32typing.PyConsoleScreenBuffer: ... def GetConsoleProcessList(*args, **kwargs): ... # incomplete ATTACH_PARENT_PROCESS: int diff --git a/stubs/pywin32/win32/win32event.pyi b/stubs/pywin32/win32/win32event.pyi index 91c15ec83..344afc119 100644 --- a/stubs/pywin32/win32/win32event.pyi +++ b/stubs/pywin32/win32/win32event.pyi @@ -1,8 +1,15 @@ +from collections.abc import Iterable + import _win32typing from win32.lib.pywintypes import error as error def CancelWaitableTimer() -> None: ... -def CreateEvent(EventAttributes: _win32typing.PySECURITY_ATTRIBUTES, bManualReset, bInitialState, Name: str) -> int: ... +def CreateEvent( + __EventAttributes: _win32typing.PySECURITY_ATTRIBUTES | None, + __bManualReset: int | bool, + __bInitialState: int | bool, + __Name: str | None, +) -> int: ... def CreateMutex(MutexAttributes: _win32typing.PySECURITY_ATTRIBUTES, InitialOwner, Name: str) -> int: ... def CreateSemaphore( SemaphoreAttributes: _win32typing.PySECURITY_ATTRIBUTES, InitialCount, MaximumCount, SemaphoreName @@ -14,7 +21,7 @@ def CreateWaitableTimerEx( __dwFlags: int, __dwDesiredAccess: int, ) -> _win32typing.PyHANDLE: ... -def MsgWaitForMultipleObjects(handlelist: list[int], bWaitAll, milliseconds, wakeMask): ... +def MsgWaitForMultipleObjects(__handlelist: Iterable[int], __bWaitAll: int, __milliseconds: int, __wakeMask: int) -> int: ... def MsgWaitForMultipleObjectsEx(handlelist: list[int], milliseconds, wakeMask, waitFlags): ... def OpenEvent(desiredAccess, bInheritHandle, name: str) -> int: ... def OpenMutex(desiredAccess, bInheritHandle, name: str) -> int: ... @@ -23,12 +30,12 @@ def OpenWaitableTimer(desiredAccess, bInheritHandle, timerName) -> int: ... def PulseEvent(hEvent: int) -> None: ... def ReleaseMutex(hEvent: int) -> None: ... def ReleaseSemaphore(hEvent: int, lReleaseCount): ... -def ResetEvent(hEvent: int) -> None: ... -def SetEvent(hEvent: int) -> None: ... +def ResetEvent(__hEvent: int) -> None: ... +def SetEvent(__hEvent: int) -> None: ... def SetWaitableTimer(handle: int, dueTime, period, func, param, resume_state) -> None: ... def WaitForMultipleObjects(handlelist: list[int], bWaitAll, milliseconds): ... def WaitForMultipleObjectsEx(handlelist: list[int], bWaitAll, milliseconds, bAlertable): ... -def WaitForSingleObject(hHandle: int, milliseconds): ... +def WaitForSingleObject(__hHandle: int, __milliseconds: int) -> int: ... def WaitForSingleObjectEx(hHandle: int, milliseconds, bAlertable): ... def WaitForInputIdle(hProcess: int, milliseconds): ... def SignalObjectAndWait(*args, **kwargs): ... # incomplete diff --git a/stubs/pywin32/win32/win32evtlog.pyi b/stubs/pywin32/win32/win32evtlog.pyi index 5a9685dcc..bf2823980 100644 --- a/stubs/pywin32/win32/win32evtlog.pyi +++ b/stubs/pywin32/win32/win32evtlog.pyi @@ -1,20 +1,31 @@ from _typeshed import Incomplete +from collections.abc import Iterable import _win32typing from win32.lib.pywintypes import error as error -def ReadEventLog(Handle, Flags, Offset, Size=...) -> list[Incomplete]: ... -def ClearEventLog(handle, eventLogName: str) -> None: ... +def ReadEventLog( + __Handle: _win32typing.PyEVTLOG_HANDLE, __Flags: int, __Offset: int, Size=... +) -> list[_win32typing.PyEventLogRecord]: ... +def ClearEventLog(handle: _win32typing.PyEVTLOG_HANDLE, eventLogName: str) -> None: ... def BackupEventLog(handle, eventLogName: str) -> None: ... -def CloseEventLog(handle) -> None: ... +def CloseEventLog(__handle: _win32typing.PyEVTLOG_HANDLE) -> None: ... def DeregisterEventSource(handle) -> None: ... def NotifyChangeEventLog(handle, handle1) -> None: ... -def GetNumberOfEventLogRecords(handle): ... +def GetNumberOfEventLogRecords(handle: _win32typing.PyEVTLOG_HANDLE) -> int: ... def GetOldestEventLogRecord(): ... -def OpenEventLog(serverName: str, sourceName: str) -> _win32typing.PyEVTLOG_HANDLE: ... -def RegisterEventSource(serverName: str, sourceName: str): ... +def OpenEventLog(__serverName: str | None, __sourceName: str) -> _win32typing.PyEVTLOG_HANDLE: ... +def RegisterEventSource(__serverName: str | None, __sourceName: str): ... def OpenBackupEventLog(serverName: str, fileName: str) -> _win32typing.PyEVTLOG_HANDLE: ... -def ReportEvent(EventLog: int, Type, Category, EventID, UserSid: _win32typing.PySID, Strings, RawData) -> None: ... +def ReportEvent( + __EventLog: int, + __Type: int, + __Category: int, + __EventID: int, + __UserSid: _win32typing.PySID | None, + __Strings: Iterable[str] | None, + __RawData: bytes | None, +) -> None: ... def EvtOpenChannelEnum(Session: _win32typing.PyEVT_HANDLE | None = ..., Flags: int = ...) -> _win32typing.PyEVT_HANDLE: ... def EvtNextChannelPath(ChannelEnum: _win32typing.PyEVT_HANDLE): ... def EvtOpenLog(Path, Flags, Session: _win32typing.PyEVT_HANDLE | None = ...) -> _win32typing.PyEVT_HANDLE: ... @@ -27,15 +38,15 @@ def EvtExportLog( def EvtArchiveExportedLog(LogFilePath, Locale, Session: _win32typing.PyEVT_HANDLE | None = ..., Flags=...) -> None: ... def EvtGetExtendedStatus(): ... def EvtQuery( - Path, Flags, Query: Incomplete | None = ..., Session: _win32typing.PyEVT_HANDLE | None = ... + __Path: str, __Flags: int, __Query: str | None = ..., __Session: _win32typing.PyEVT_HANDLE | None = ... ) -> _win32typing.PyEVT_HANDLE: ... def EvtNext( - ResultSet: _win32typing.PyEVT_HANDLE, Count, Timeout: int = ..., Flags=... + __ResultSet: _win32typing.PyEVT_HANDLE, __Count: int, __Timeout: int = ..., __Flags: int = ... ) -> tuple[_win32typing.PyEVT_HANDLE, ...]: ... def EvtSeek( ResultSet: _win32typing.PyEVT_HANDLE, Position, Flags, Bookmark: _win32typing.PyEVT_HANDLE | None = ..., Timeout: int = ... ) -> None: ... -def EvtRender(Event: _win32typing.PyEVT_HANDLE, Flags): ... +def EvtRender(__Event: _win32typing.PyEVT_HANDLE, __Flags: int, Context=...): ... def EvtSubscribe( ChannelPath, Flags, diff --git a/stubs/pywin32/win32/win32file.pyi b/stubs/pywin32/win32/win32file.pyi index 7161497ed..a66b91c93 100644 --- a/stubs/pywin32/win32/win32file.pyi +++ b/stubs/pywin32/win32/win32file.pyi @@ -1,4 +1,6 @@ from _typeshed import Incomplete +from socket import socket +from typing import overload import _win32typing from win32.lib.pywintypes import error as error @@ -7,18 +9,18 @@ def AreFileApisANSI(): ... def CancelIo(handle: int) -> None: ... def CopyFile(_from: str, to: str, bFailIfExists) -> None: ... def CopyFileW(_from: str, to: str, bFailIfExists) -> None: ... -def CreateDirectory(name: str, sa: _win32typing.PySECURITY_ATTRIBUTES) -> None: ... +def CreateDirectory(__name: str, __sa: _win32typing.PySECURITY_ATTRIBUTES) -> None: ... def CreateDirectoryW(name: str, sa: _win32typing.PySECURITY_ATTRIBUTES) -> None: ... def CreateDirectoryEx(templateName: str, newDirectory: str, sa: _win32typing.PySECURITY_ATTRIBUTES) -> None: ... def CreateFile( - fileName: str, - desiredAccess, - shareMode, - attributes: _win32typing.PySECURITY_ATTRIBUTES, - CreationDisposition, - flagsAndAttributes, - hTemplateFile: int, -) -> int: ... + __fileName: str, + __desiredAccess: int, + __shareMode: int, + __attributes: _win32typing.PySECURITY_ATTRIBUTES | None, + __CreationDisposition: int, + __flagsAndAttributes: int, + __hTemplateFile: int | None, +) -> _win32typing.PyHANDLE: ... def CreateIoCompletionPort(handle: int, existing: int, completionKey, numThreads) -> int: ... def CreateMailslot(Name, MaxMessageSize, ReadTimeout, SecurityAttributes: _win32typing.PySECURITY_ATTRIBUTES) -> int: ... def GetMailslotInfo(Mailslot: int) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... @@ -34,7 +36,7 @@ def FindNextChangeNotification(hChangeHandle): ... def FlushFileBuffers(hFile: int) -> None: ... def GetBinaryType(appName: str): ... def GetDiskFreeSpace(rootPathName: str) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... -def GetDiskFreeSpaceEx(rootPathName: str) -> tuple[Incomplete, Incomplete, Incomplete]: ... +def GetDiskFreeSpaceEx(__rootPathName: str) -> tuple[int, int, int]: ... def GetDriveType(rootPathName: str): ... def GetDriveTypeW(rootPathName: str): ... def GetFileAttributes(fileName: str): ... @@ -52,14 +54,17 @@ def SetFileTime( def GetFileInformationByHandle(handle: int): ... def GetCompressedFileSize(): ... def GetFileSize(): ... -def AllocateReadBuffer(bufSize) -> _win32typing.PyOVERLAPPEDReadBuffer: ... +def AllocateReadBuffer(__bufSize: int) -> _win32typing.PyOVERLAPPEDReadBuffer: ... +@overload +def ReadFile(__hFile: int, __bufSize: int) -> tuple[int, str]: ... +@overload def ReadFile( - hFile: int, buffer_bufSize: _win32typing.PyOVERLAPPEDReadBuffer, overlapped: _win32typing.PyOVERLAPPED | None = ... -) -> tuple[Incomplete, str]: ... + __hFile: int, __buffer: _win32typing.PyOVERLAPPEDReadBuffer, __overlapped: _win32typing.PyOVERLAPPED | None +) -> tuple[int, str]: ... def WriteFile( - hFile: int, data: str | _win32typing.PyOVERLAPPEDReadBuffer, ol: _win32typing.PyOVERLAPPED | None = ... -) -> tuple[Incomplete, Incomplete]: ... -def CloseHandle(handle: int) -> None: ... + __hFile: int, __data: str | bytes | _win32typing.PyOVERLAPPEDReadBuffer, __ol: _win32typing.PyOVERLAPPED | None = ... +) -> tuple[int, int]: ... +def CloseHandle(__handle: int) -> None: ... def LockFileEx(hFile: int, _int, _int1, _int2, ol: _win32typing.PyOVERLAPPED | None = ...) -> None: ... def UnlockFileEx(hFile: int, _int, _int1, ol: _win32typing.PyOVERLAPPED | None = ...) -> None: ... def GetQueuedCompletionStatus(hPort: int, timeOut) -> tuple[Incomplete, Incomplete, Incomplete, _win32typing.PyOVERLAPPED]: ... @@ -68,7 +73,7 @@ def PostQueuedCompletionStatus( ): ... def GetFileType(hFile: int): ... def GetLogicalDrives(): ... -def GetOverlappedResult(hFile: int, overlapped: _win32typing.PyOVERLAPPED, bWait): ... +def GetOverlappedResult(__hFile: int, __overlapped: _win32typing.PyOVERLAPPED, __bWait: int | bool) -> int: ... def LockFile(hFile: int, offsetLow, offsetHigh, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh) -> None: ... def MoveFile(existingFileName: str, newFileName: str) -> None: ... def MoveFileW(existingFileName: str, newFileName: str) -> None: ... @@ -83,7 +88,7 @@ def SetCurrentDirectory(lpPathName: str) -> None: ... def SetEndOfFile(hFile: int) -> None: ... def SetFileApisToANSI() -> None: ... def SetFileApisToOEM() -> None: ... -def SetFileAttributes(filename: str, newAttributes) -> None: ... +def SetFileAttributes(__filename: str, __newAttributes: int) -> None: ... def SetFilePointer(handle: int, offset, moveMethod) -> None: ... def SetVolumeLabel(rootPathName: str, volumeName: str) -> None: ... def UnlockFile(hFile: int, offsetLow, offsetHigh, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh) -> None: ... @@ -105,13 +110,13 @@ def CalculateSocketEndPointSize(socket): ... def GetAcceptExSockaddrs( sAccepting, buffer: _win32typing.PyOVERLAPPEDReadBuffer ) -> tuple[Incomplete, Incomplete, Incomplete]: ... -def WSAEventSelect(socket, hEvent, networkEvents) -> None: ... -def WSAEnumNetworkEvents(s, hEvent: int): ... +def WSAEventSelect(__socket: socket, __hEvent: int, __networkEvents: int) -> None: ... +def WSAEnumNetworkEvents(__s: socket, __hEvent: int) -> dict[int, int]: ... def WSAAsyncSelect(socket, hwnd: int, _int, networkEvents) -> None: ... def WSASend(s, buffer: str, ol: _win32typing.PyOVERLAPPED, dwFlags) -> tuple[Incomplete, Incomplete]: ... def WSARecv(s, buffer, ol: _win32typing.PyOVERLAPPED, dwFlags) -> tuple[Incomplete, Incomplete]: ... def BuildCommDCB(_def: str, dcb: _win32typing.PyDCB) -> _win32typing.PyDCB: ... -def ClearCommError(PyHANDLE) -> tuple[Incomplete, _win32typing.PyCOMSTAT]: ... +def ClearCommError(__handle: int) -> tuple[Incomplete, _win32typing.PyCOMSTAT]: ... def EscapeCommFunction(handle: int) -> None: ... def GetCommState(handle: int) -> _win32typing.PyDCB: ... def SetCommState(handle: int, dcb: _win32typing.PyDCB) -> None: ... @@ -219,7 +224,7 @@ def FindFileNames(FileName: str, Transaction: int | None = ...) -> list[Incomple def GetFinalPathNameByHandle(File: int, Flags) -> str: ... def SfcGetNextProtectedFile() -> list[Incomplete]: ... def SfcIsFileProtected(ProtFileName: str): ... -def GetLongPathName(ShortPath: str, Transaction: int | None = ...) -> str: ... +def GetLongPathName(__ShortPath: str, __Transaction: int | None = ...) -> str: ... def GetFullPathName(FileName, Transaction: int | None = ...): ... def Wow64DisableWow64FsRedirection(): ... def Wow64RevertWow64FsRedirection(OldValue) -> None: ... @@ -236,7 +241,7 @@ def OpenFileById( ) -> int: ... def DCB(*args, **kwargs): ... # incomplete def GetFileAttributesExW(*args, **kwargs): ... # incomplete -def OVERLAPPED(*args, **kwargs): ... # incomplete +def OVERLAPPED() -> _win32typing.PyOVERLAPPED: ... CALLBACK_CHUNK_FINISHED: int CALLBACK_STREAM_SWITCH: int @@ -437,3 +442,6 @@ WSAEWOULDBLOCK: int FD_ADDRESS_LIST_CHANGE: int INVALID_HANDLE_VALUE: int UNICODE: int + +# win32pipe.FDCreatePipe is the only known public method to expose this. But it opens both read and write handles. +def _open_osfhandle(osfhandle: _win32typing.PyHANDLE, flags: int) -> int: ... diff --git a/stubs/pywin32/win32/win32gui.pyi b/stubs/pywin32/win32/win32gui.pyi index b51e1e13a..a233e3b4b 100644 --- a/stubs/pywin32/win32/win32gui.pyi +++ b/stubs/pywin32/win32/win32gui.pyi @@ -1,6 +1,7 @@ from _typeshed import Incomplete, ReadableBuffer, WriteableBuffer from collections.abc import Callable from typing import TypeVar +from typing_extensions import Literal import _win32typing from win32.lib.pywintypes import error as error @@ -14,7 +15,7 @@ def CreateFontIndirect(lplf: _win32typing.PyLOGFONT): ... def GetObject(handle: int): ... def GetObjectType(h: int): ... def PyGetMemory(__addr: int, __len: int): ... -def PyGetString(addr, _len) -> str: ... +def PyGetString(addr, _len=...) -> str: ... def PySetString(addr, String, maxLen): ... def PySetMemory(addr, String): ... def PyGetArraySignedLong(array, index): ... @@ -79,7 +80,7 @@ def LoadMenu(hinstance, resource_id: str): ... def DestroyMenu() -> None: ... def SetMenu(hwnd: int, hmenu) -> None: ... def GetMenu(__hwnd: int) -> int: ... -def LoadIcon(hinstance, resource_id: str): ... +def LoadIcon(__hinstance: int, __resource_id_or_name: str | int) -> _win32typing.PyWNDCLASS: ... def CopyIcon(hicon): ... def DrawIcon(hDC, X, Y, hicon) -> None: ... def DrawIconEx( @@ -87,7 +88,9 @@ def DrawIconEx( ) -> None: ... def CreateIconIndirect(iconinfo: _win32typing.PyICONINFO): ... def CreateIconFromResource(bits: str, fIcon, ver: int = ...) -> int: ... -def LoadImage(hinst, name: str, _type, cxDesired, cyDesired, fuLoad): ... +def LoadImage( + __hinst: int, __name: str, __type: int, __cxDesired: int, __cyDesired: int, __fuLoad: int +) -> _win32typing.PyGdiHANDLE: ... def DeleteObject(handle: _win32typing.PyGdiHANDLE) -> None: ... def BitBlt(hdcDest, x, y, width, height, hdcSrc, nXSrc, nYSrc, dwRop) -> None: ... def StretchBlt(hdcDest, x, y, width, height, hdcSrc, nXSrc, nYSrc, nWidthSrc, nHeightSrc, dwRop) -> None: ... @@ -115,8 +118,20 @@ def AlphaBlend( ) -> None: ... def MessageBox(parent, text: str, caption: str, flags): ... def MessageBeep(_type) -> None: ... -def CreateWindow(className: str, windowTitle: str, style, x, y, width, height, parent, menu, hinstance, reserved): ... -def DestroyWindow(hwnd: int) -> None: ... +def CreateWindow( + __className: str | _win32typing.PyResourceId, + __windowTitle: str | None, + __style: int, + __x: int, + __y: int, + __width: int, + __height: int, + __parent: int, + __menu: int, + __hinstance: int, + __reserved: Incomplete | None, +) -> int: ... +def DestroyWindow(_hwnd: int) -> None: ... def EnableWindow(hWnd: int, bEnable): ... def FindWindow(__ClassName: _win32typing.PyResourceId | str | None, __WindowName: str | None) -> int: ... def FindWindowEx( @@ -135,7 +150,7 @@ def IsWindowVisible(__hwnd: int | None) -> int: ... def IsWindowEnabled(__hwnd: int | None) -> int: ... def SetFocus(hwnd: int) -> None: ... def GetFocus() -> None: ... -def UpdateWindow(hwnd: int) -> None: ... +def UpdateWindow(__hwnd: int) -> None: ... def BringWindowToTop(hwnd: int) -> None: ... def SetActiveWindow(hwnd: int): ... def GetActiveWindow(): ... @@ -153,21 +168,21 @@ def SelectObject(hdc, _object): ... def GetCurrentObject(hdc: int, ObjectType) -> int: ... def GetWindowRect(hwnd: int) -> tuple[int, int, int, int]: ... def GetStockObject(Object) -> int: ... -def PostQuitMessage(rc) -> None: ... +def PostQuitMessage(__rc: int) -> None: ... def WaitMessage() -> None: ... def SetWindowPos(__hWnd: int, __InsertAfter: int | None, __X: int, __Y: int, __cx: int, __cy: int, __Flags: int) -> None: ... def GetWindowPlacement(__hwnd: int) -> tuple[int, int, tuple[int, int], tuple[int, int], tuple[int, int, int, int]]: ... def SetWindowPlacement(hWnd: int, placement) -> None: ... -def RegisterClass(wndClass: _win32typing.PyWNDCLASS): ... -def UnregisterClass(atom: _win32typing.PyResourceId, hinst: int) -> None: ... +def RegisterClass(__wndClass: _win32typing.PyWNDCLASS) -> _win32typing.PyResourceId: ... +def UnregisterClass(__atom: _win32typing.PyResourceId, __hinst: int) -> None: ... def PumpMessages() -> None: ... -def PumpWaitingMessages(): ... +def PumpWaitingMessages(__firstMessage: int = ..., __lastMessage: int = ...) -> int: ... def GetMessage(hwnd: int, _min, _max): ... def TranslateMessage(msg): ... def DispatchMessage(msg): ... def TranslateAccelerator(hwnd: int, haccel, msg): ... def PeekMessage(hwnd: int, filterMin, filterMax, removalOptions): ... -def Shell_NotifyIcon(Message, nid: _win32typing.PyNOTIFYICONDATA) -> None: ... +def Shell_NotifyIcon(__Message: int, __nid: _win32typing.PyNOTIFYICONDATA) -> None: ... def GetSystemMenu(hwnd: int, bRevert): ... def DrawMenuBar(hwnd: int) -> None: ... def MoveWindow(__hwnd: int, __x: int, __y: int, __width: int, __height: int, __bRepaint: bool) -> None: ... @@ -417,7 +432,7 @@ def ChildWindowFromPointEx(*args, **kwargs): ... # incomplete def CreateDialogIndirectParam(*args, **kwargs): ... # incomplete def DestroyAcceleratorTable(*args, **kwargs): ... # incomplete def Edit_GetLine(*args, **kwargs): ... # incomplete -def GetModuleHandle(*args, **kwargs): ... # incomplete +def GetModuleHandle(__lpModuleName: str | None) -> int: ... def GetWindowTextLength(*args, **kwargs): ... # incomplete def HIWORD(*args, **kwargs): ... # incomplete def ImageList_Add(*args, **kwargs): ... # incomplete @@ -438,7 +453,7 @@ def LOWORD(*args, **kwargs): ... # incomplete def ListView_SortItems(*args, **kwargs): ... # incomplete def ListView_SortItemsEx(*args, **kwargs): ... # incomplete def ValidateRect(*args, **kwargs): ... # incomplete -def WNDCLASS(*args, **kwargs): ... # incomplete +def WNDCLASS() -> _win32typing.PyWNDCLASS: ... def lpstr(*args, **kwargs): ... # incomplete CLR_NONE: int @@ -495,5 +510,5 @@ TPM_RIGHTALIGN: int TPM_RIGHTBUTTON: int TPM_TOPALIGN: int TPM_VCENTERALIGN: int -UNICODE: bool +UNICODE: Literal[True] dllhandle: int diff --git a/stubs/pywin32/win32/win32job.pyi b/stubs/pywin32/win32/win32job.pyi index 2edda455b..23b5d7af0 100644 --- a/stubs/pywin32/win32/win32job.pyi +++ b/stubs/pywin32/win32/win32job.pyi @@ -2,7 +2,7 @@ import _win32typing from win32.lib.pywintypes import error as error def AssignProcessToJobObject(hJob: int, hProcess: int) -> None: ... -def CreateJobObject(jobAttributes: _win32typing.PySECURITY_ATTRIBUTES, name) -> None: ... +def CreateJobObject(__jobAttributes: _win32typing.PySECURITY_ATTRIBUTES | None, __name: str) -> None: ... def OpenJobObject(desiredAccess, inheritHandles, name) -> None: ... def TerminateJobObject(hJob: int, exitCode) -> None: ... def UserHandleGrantAccess(hUserHandle: int, hJob: int, grant) -> None: ... diff --git a/stubs/pywin32/win32/win32pdh.pyi b/stubs/pywin32/win32/win32pdh.pyi index 9ae7795d8..c2b768e16 100644 --- a/stubs/pywin32/win32/win32pdh.pyi +++ b/stubs/pywin32/win32/win32pdh.pyi @@ -5,8 +5,8 @@ from win32.lib.pywintypes import error as error def AddCounter(hQuery, path: str, userData: int = ...): ... def AddEnglishCounter(hQuery, path: str, userData: int = ...): ... def RemoveCounter(handle) -> None: ... -def EnumObjectItems(DataSource: str, machine: str, _object: str, detailLevel, flags=...): ... -def EnumObjects(DataSource: str, machine: str, detailLevel, refresh: int = ...): ... +def EnumObjectItems(DataSource: str | None, machine: str | None, _object: str, detailLevel, flags=...): ... +def EnumObjects(DataSource: str | None, machine: str | None, detailLevel: int, refresh: bool = ...): ... def OpenQuery(DataSource: Incomplete | None = ..., userData: int = ...): ... def CloseQuery(handle) -> None: ... def MakeCounterPath( @@ -21,7 +21,7 @@ def ParseCounterPath(path: str, flags=...) -> tuple[Incomplete, Incomplete, Inco def ParseInstanceName(instanceName: str) -> tuple[Incomplete, Incomplete, Incomplete]: ... def SetCounterScaleFactor(hCounter, factor) -> None: ... def BrowseCounters( - Flags: tuple[Incomplete, ...], + Flags: tuple[Incomplete, ...] | None, hWndOwner: int, CallBack1, CallBack2, @@ -33,7 +33,7 @@ def BrowseCounters( ) -> str: ... def ConnectMachine(machineName: str) -> str: ... def LookupPerfIndexByName(machineName: str, instanceName: str): ... -def LookupPerfNameByIndex(machineName: str, index) -> str: ... +def LookupPerfNameByIndex(machineName: str | None, index) -> str: ... def GetFormattedCounterArray(*args, **kwargs): ... # incomplete PDH_FMT_1000: int diff --git a/stubs/pywin32/win32/win32pipe.pyi b/stubs/pywin32/win32/win32pipe.pyi index 1f5a9ab9a..7fa9ca0fe 100644 --- a/stubs/pywin32/win32/win32pipe.pyi +++ b/stubs/pywin32/win32/win32pipe.pyi @@ -4,7 +4,9 @@ import _win32typing from win32.lib.pywintypes import error as error def GetNamedPipeHandleState(hPipe: int, bGetCollectionData=...) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete, str]: ... -def SetNamedPipeHandleState(hPipe: int, Mode, MaxCollectionCount, CollectDataTimeout) -> None: ... +def SetNamedPipeHandleState( + __hPipe: int, __Mode: int, __MaxCollectionCount: None | Incomplete, __CollectDataTimeout: None | Incomplete +) -> None: ... def ConnectNamedPipe(hPipe: int, overlapped: _win32typing.PyOVERLAPPED | None = ...): ... def TransactNamedPipe( pipeName, @@ -13,7 +15,7 @@ def TransactNamedPipe( overlapped: _win32typing.PyOVERLAPPED | None = ..., ) -> str: ... def CallNamedPipe(pipeName, data: str, bufSize, timeOut) -> str: ... -def CreatePipe(sa: _win32typing.PySECURITY_ATTRIBUTES, nSize) -> tuple[int, int]: ... +def CreatePipe(__sa: _win32typing.PySECURITY_ATTRIBUTES, __nSize: int) -> tuple[int, int]: ... def FdCreatePipe(sa: _win32typing.PySECURITY_ATTRIBUTES, nSize, mode) -> tuple[Incomplete, Incomplete]: ... def CreateNamedPipe( pipeName: str, @@ -26,10 +28,10 @@ def CreateNamedPipe( sa: _win32typing.PySECURITY_ATTRIBUTES, ) -> int: ... def DisconnectNamedPipe(hFile: int) -> None: ... -def GetOverlappedResult(hFile: int, overlapped: _win32typing.PyOVERLAPPED, bWait): ... +def GetOverlappedResult(__hFile: int, __overlapped: _win32typing.PyOVERLAPPED, __bWait: int | bool) -> int: ... def WaitNamedPipe(pipeName: str, timeout) -> None: ... def GetNamedPipeInfo(hNamedPipe: int) -> tuple[Incomplete, Incomplete, Incomplete, Incomplete]: ... -def PeekNamedPipe(hPipe: int, size) -> tuple[str, Incomplete, Incomplete]: ... +def PeekNamedPipe(__hPipe: int, __size: int) -> tuple[str, int, Incomplete]: ... def GetNamedPipeClientProcessId(hPipe: int): ... def GetNamedPipeServerProcessId(hPipe: int): ... def GetNamedPipeClientSessionId(hPipe: int): ... diff --git a/stubs/pywin32/win32/win32process.pyi b/stubs/pywin32/win32/win32process.pyi index 3b38c7884..c80062a07 100644 --- a/stubs/pywin32/win32/win32process.pyi +++ b/stubs/pywin32/win32/win32process.pyi @@ -9,15 +9,15 @@ def CreateRemoteThread( hprocess: int, sa: _win32typing.PySECURITY_ATTRIBUTES, stackSize, entryPoint, Parameter, flags ) -> tuple[int, Incomplete]: ... def CreateProcess( - appName: str, - commandLine: str, - processAttributes: _win32typing.PySECURITY_ATTRIBUTES, - threadAttributes: _win32typing.PySECURITY_ATTRIBUTES, - bInheritHandles, - dwCreationFlags, - newEnvironment, - currentDirectory: str, - startupinfo: _win32typing.PySTARTUPINFO, + __appName: str | None, + __commandLine: str, + __processAttributes: _win32typing.PySECURITY_ATTRIBUTES | None, + __threadAttributes: _win32typing.PySECURITY_ATTRIBUTES | None, + __bInheritHandles: int | bool, + __dwCreationFlags: int, + __newEnvironment: dict[str, str] | None, + __currentDirectory: str | None, + __startupinfo: _win32typing.PySTARTUPINFO, ) -> tuple[int, int, Incomplete, Incomplete]: ... def CreateProcessAsUser( hToken: int, @@ -31,13 +31,13 @@ def CreateProcessAsUser( currentDirectory: str, startupinfo: _win32typing.PySTARTUPINFO, ) -> tuple[int, int, Incomplete, Incomplete]: ... -def GetCurrentProcess(): ... +def GetCurrentProcess() -> int: ... def GetProcessVersion(processId): ... def GetCurrentProcessId(): ... def GetStartupInfo() -> _win32typing.PySTARTUPINFO: ... def GetPriorityClass(handle: int): ... def GetExitCodeThread(handle: int): ... -def GetExitCodeProcess(handle: int): ... +def GetExitCodeProcess(__handle: int) -> int: ... def GetWindowThreadProcessId(__hwnd: int | None) -> tuple[int, int]: ... def SetThreadPriority(handle: int, nPriority) -> None: ... def GetThreadPriority(handle: int): ... @@ -48,7 +48,7 @@ def SetThreadPriorityBoost(Thread: int, DisablePriorityBoost) -> None: ... def GetThreadIOPendingFlag(Thread: int): ... def GetThreadTimes(Thread: int): ... def GetProcessId(Process: int): ... -def SetPriorityClass(handle: int, dwPriorityClass) -> None: ... +def SetPriorityClass(__handle: int, __dwPriorityClass: int) -> None: ... def AttachThreadInput(idAttach, idAttachTo, Attach) -> None: ... def SetThreadIdealProcessor(handle: int, dwIdealProcessor): ... def GetProcessAffinityMask(hProcess: int) -> tuple[Incomplete, Incomplete]: ... @@ -56,7 +56,7 @@ def SetProcessAffinityMask(hProcess: int, mask) -> None: ... def SetThreadAffinityMask(hThread: int, ThreadAffinityMask): ... def SuspendThread(handle: int): ... def ResumeThread(handle: int): ... -def TerminateProcess(handle: int, exitCode) -> None: ... +def TerminateProcess(__handle: int, __exitCode: int) -> None: ... def ExitProcess(exitCode) -> None: ... def EnumProcesses() -> tuple[Incomplete, Incomplete]: ... def EnumProcessModules(hProcess: int) -> tuple[Incomplete, Incomplete]: ... diff --git a/stubs/pywin32/win32/win32security.pyi b/stubs/pywin32/win32/win32security.pyi index b391d28dc..d47f00a55 100644 --- a/stubs/pywin32/win32/win32security.pyi +++ b/stubs/pywin32/win32/win32security.pyi @@ -24,7 +24,7 @@ def DsGetDcName( def DsCrackNames( hds: _win32typing.PyDS_HANDLE, flags, formatOffered, formatDesired, names: list[Incomplete] ) -> tuple[Incomplete, Incomplete, Incomplete]: ... -def ACL(bufSize: int = ...) -> _win32typing.PyACL: ... +def ACL(__bufSize: int = ...) -> _win32typing.PyACL: ... def SID() -> _win32typing.PySID: ... def SECURITY_ATTRIBUTES() -> _win32typing.PySECURITY_ATTRIBUTES: ... def SECURITY_DESCRIPTOR() -> _win32typing.PySECURITY_DESCRIPTOR: ... @@ -33,13 +33,15 @@ def ImpersonateLoggedOnUser(handle: int) -> None: ... def ImpersonateAnonymousToken(ThreadHandle: int) -> None: ... def IsTokenRestricted(__TokenHandle: int | None) -> bool: ... def RevertToSelf() -> None: ... -def LogonUser(Username: str, Domain: str, Password: str, LogonType, LogonProvider) -> int: ... +def LogonUser( + __Username: str, __Domain: str | None, __Password: str, __LogonType: int, __LogonProvider: int +) -> _win32typing.PyHANDLE: ... def LogonUserEx( Username: str, Domain: str, Password: str, LogonType, LogonProvider ) -> tuple[int, _win32typing.PySID, Incomplete, Incomplete]: ... -def LookupAccountName(systemName: str, accountName: str) -> tuple[_win32typing.PySID, str, Incomplete]: ... -def LookupAccountSid(systemName: str, sid: _win32typing.PySID) -> tuple[str, str, Incomplete]: ... -def GetBinarySid(SID: str) -> _win32typing.PySID: ... +def LookupAccountName(__systemName: str | None, __accountName: str) -> tuple[_win32typing.PySID, str, int]: ... +def LookupAccountSid(__systemName: str, __sid: _win32typing.PySID) -> tuple[str, str, Incomplete]: ... +def GetBinarySid(__SID: str) -> _win32typing.PySID: ... def SetSecurityInfo( handle: int, ObjectType, @@ -51,15 +53,15 @@ def SetSecurityInfo( ) -> None: ... def GetSecurityInfo(handle: int, ObjectType, SecurityInfo) -> _win32typing.PySECURITY_DESCRIPTOR: ... def SetNamedSecurityInfo( - ObjectName, - ObjectType, - SecurityInfo, - Owner: _win32typing.PySID, - Group: _win32typing.PySID, - Dacl: _win32typing.PyACL, - Sacl: _win32typing.PyACL, + __ObjectName: str, + __ObjectType: int, + __SecurityInfo: int, + __Owner: _win32typing.PySID | None, + __Group: _win32typing.PySID | None, + __Dacl: _win32typing.PyACL | None, + __Sacl: _win32typing.PyACL | None, ) -> None: ... -def GetNamedSecurityInfo(ObjectName, ObjectType, SecurityInfo) -> _win32typing.PySECURITY_DESCRIPTOR: ... +def GetNamedSecurityInfo(__ObjectName: str, __ObjectType: int, __SecurityInfo: int) -> _win32typing.PySECURITY_DESCRIPTOR: ... def OpenProcessToken(processHandle, desiredAccess) -> int: ... def LookupPrivilegeValue(systemName: str, privilegeName: str) -> _win32typing.LARGE_INTEGER: ... def LookupPrivilegeName(SystemName: str, luid: _win32typing.LARGE_INTEGER) -> str: ... @@ -71,8 +73,8 @@ def AdjustTokenGroups(TokenHandle: int, ResetToDefault, NewState: _win32typing.P def GetTokenInformation(TokenHandle: int, TokenInformationClass): ... def OpenThreadToken(handle: int, desiredAccess, openAsSelf): ... def SetThreadToken(Thread: int, Token: int) -> None: ... -def GetFileSecurity(filename: str, info) -> _win32typing.PySECURITY_DESCRIPTOR: ... -def SetFileSecurity(filename: str, info, security: _win32typing.PySECURITY_DESCRIPTOR) -> None: ... +def GetFileSecurity(__filename: str, __info: int = ...) -> _win32typing.PySECURITY_DESCRIPTOR: ... +def SetFileSecurity(__filename: str, __info: int, __security: _win32typing.PySECURITY_DESCRIPTOR) -> None: ... def GetUserObjectSecurity(handle: int, info) -> _win32typing.PySECURITY_DESCRIPTOR: ... def SetUserObjectSecurity(handle: int, info, security: _win32typing.PySECURITY_DESCRIPTOR) -> None: ... def GetKernelObjectSecurity(handle: int, info) -> _win32typing.PySECURITY_DESCRIPTOR: ... @@ -90,8 +92,8 @@ def LsaRemoveAccountRights( ) -> None: ... def LsaEnumerateAccountRights(PolicyHandle: _win32typing.PyLSA_HANDLE, AccountSid: _win32typing.PySID) -> list[str]: ... def LsaEnumerateAccountsWithUserRight(PolicyHandle: _win32typing.PyLSA_HANDLE, UserRight) -> tuple[_win32typing.PySID, ...]: ... -def ConvertSidToStringSid(Sid: _win32typing.PySID) -> str: ... -def ConvertStringSidToSid(StringSid: str) -> _win32typing.PySID: ... +def ConvertSidToStringSid(__Sid: _win32typing.PySID) -> str: ... +def ConvertStringSidToSid(__StringSid: str) -> _win32typing.PySID: ... def ConvertSecurityDescriptorToStringSecurityDescriptor( SecurityDescriptor: _win32typing.PySECURITY_DESCRIPTOR, RequestedStringSDRevision, SecurityInformation ) -> str: ... diff --git a/stubs/pywin32/win32/win32service.pyi b/stubs/pywin32/win32/win32service.pyi index 1f95aa9a5..47492ad6b 100644 --- a/stubs/pywin32/win32/win32service.pyi +++ b/stubs/pywin32/win32/win32service.pyi @@ -1,4 +1,5 @@ from _typeshed import Incomplete +from collections.abc import Iterable import _win32typing from win32.lib.pywintypes import error as error @@ -23,9 +24,9 @@ def EnumServicesStatusEx( ) -> tuple[Incomplete, ...]: ... def EnumDependentServices(hService: _win32typing.PySC_HANDLE, ServiceState) -> tuple[Incomplete, ...]: ... def QueryServiceConfig(hService: _win32typing.PySC_HANDLE): ... -def StartService(hService: _win32typing.PySC_HANDLE, args: list[str]) -> None: ... +def StartService(hService: _win32typing.PySC_HANDLE, args: Iterable[str] | None) -> None: ... def OpenService(scHandle: _win32typing.PySC_HANDLE, name: str, desiredAccess) -> _win32typing.PySC_HANDLE: ... -def OpenSCManager(machineName: str, dbName: str, desiredAccess) -> _win32typing.PySC_HANDLE: ... +def OpenSCManager(machineName: str | None, dbName: str | None, desiredAccess: int) -> _win32typing.PySC_HANDLE: ... def CloseServiceHandle(scHandle: _win32typing.PySC_HANDLE) -> None: ... def QueryServiceStatus(hService: _win32typing.PySC_HANDLE) -> _win32typing.SERVICE_STATUS: ... def QueryServiceStatusEx(hService: _win32typing.PySC_HANDLE) -> _win32typing.SERVICE_STATUS: ... @@ -35,36 +36,36 @@ def SetServiceObjectSecurity( def QueryServiceObjectSecurity(Handle: _win32typing.PySC_HANDLE, SecurityInformation) -> _win32typing.PySECURITY_DESCRIPTOR: ... def GetServiceKeyName(hSCManager: _win32typing.PySC_HANDLE, DisplayName): ... def GetServiceDisplayName(hSCManager: _win32typing.PySC_HANDLE, ServiceName): ... -def SetServiceStatus(scHandle, serviceStatus: _win32typing.SERVICE_STATUS) -> None: ... +def SetServiceStatus(scHandle, serviceStatus: _win32typing.SERVICE_STATUS | tuple[int, int, int, int, int, int, int]) -> None: ... def ControlService(scHandle: _win32typing.PySC_HANDLE, code) -> _win32typing.SERVICE_STATUS: ... def DeleteService(scHandle: _win32typing.PySC_HANDLE) -> None: ... def CreateService( scHandle: _win32typing.PySC_HANDLE, name: str, displayName: str, - desiredAccess, - serviceType, - startType, - errorControl, + desiredAccess: int, + serviceType: int, + startType: int, + errorControl: int, binaryFile: str, - loadOrderGroup: str, - bFetchTag, - serviceDeps: list[Incomplete], - acctName: str, - password: str, -) -> tuple[_win32typing.PySC_HANDLE]: ... + loadOrderGroup: str | None, + bFetchTag: bool, + serviceDeps: Iterable[Incomplete] | None, + acctName: str | None, + password: str | None, +) -> _win32typing.PySC_HANDLE: ... def ChangeServiceConfig( hService: _win32typing.PySC_HANDLE, - serviceType, - startType, - errorControl, - binaryFile: str, - loadOrderGroup: str, - bFetchTag, - serviceDeps: list[Incomplete], - acctName: str, - password: str, - displayName: str, + serviceType: int, + startType: int, + errorControl: int, + binaryFile: str | None, + loadOrderGroup: str | None, + bFetchTag: bool, + serviceDeps: Iterable[Incomplete] | None, + acctName: str | None, + password: str | None, + displayName: str | None, ): ... def LockServiceDatabase(sc_handle: _win32typing.PySC_HANDLE): ... def UnlockServiceDatabase(lock): ... diff --git a/stubs/pywin32/win32/win32ts.pyi b/stubs/pywin32/win32/win32ts.pyi index 853682ead..7e37d2ec9 100644 --- a/stubs/pywin32/win32/win32ts.pyi +++ b/stubs/pywin32/win32/win32ts.pyi @@ -5,10 +5,10 @@ def WTSCloseServer(Server: int) -> None: ... def WTSQueryUserConfig(ServerName: str, UserName: str, ConfigClass): ... def WTSSetUserConfig(ServerName: str, UserName: str, ConfigClass) -> None: ... def WTSEnumerateServers(DomainName: str | None = ..., Version: int = ..., Reserved=...) -> tuple[str, ...]: ... -def WTSEnumerateSessions(Server: int, Version: int = ..., Reserved=...) -> tuple[Incomplete, ...]: ... -def WTSLogoffSession(Server: int, SessionId, Wait) -> None: ... -def WTSDisconnectSession(Server: int, SessionId, Wait) -> None: ... -def WTSQuerySessionInformation(Server: int, SessionId, WTSInfoClass) -> None: ... +def WTSEnumerateSessions(__Server: int, __Version: int = ..., __Reserved=...) -> tuple[dict[str, str | int], ...]: ... +def WTSLogoffSession(__Server: int, __SessionId: int, __Wait: bool) -> None: ... +def WTSDisconnectSession(__Server: int, __SessionId: int, __Wait: bool) -> None: ... +def WTSQuerySessionInformation(__Server: int, __SessionId: int, __WTSInfoClass: int) -> str: ... def WTSEnumerateProcesses(Server: int, Version: int = ..., Reserved: int = ...) -> tuple[str, ...]: ... def WTSQueryUserToken(SessionId) -> int: ... def WTSShutdownSystem(Server: int, ShutdownFlag) -> None: ... diff --git a/stubs/pywin32/win32com/client/__init__.pyi b/stubs/pywin32/win32com/client/__init__.pyi index 31d4eca21..930b06f00 100644 --- a/stubs/pywin32/win32com/client/__init__.pyi +++ b/stubs/pywin32/win32com/client/__init__.pyi @@ -1,25 +1,29 @@ from _typeshed import Incomplete +from typing_extensions import TypeAlias -from win32com.client import dynamic as dynamic +import _win32typing +from win32com.client import dynamic as dynamic, gencache as gencache + +_Stringifiable: TypeAlias = object def GetObject(Pathname: str | None = ..., Class: Incomplete | None = ..., clsctx: Incomplete | None = ...) -> CDispatch: ... def GetActiveObject(Class, clsctx=...): ... def Moniker(Pathname, clsctx=...): ... def Dispatch( - dispatch, - userName: Incomplete | None = ..., - resultCLSID: Incomplete | None = ..., - typeinfo: Incomplete | None = ..., - UnicodeToString: Incomplete | None = ..., - clsctx=..., -): ... + dispatch: str | dynamic.PyIDispatchType | dynamic._GoodDispatchTypes | dynamic.PyIUnknownType, + userName: str | None = ..., + resultCLSID: _Stringifiable | None = ..., + typeinfo: _win32typing.PyITypeInfo | None = ..., + UnicodeToString: None = ..., + clsctx: int = ..., +) -> dynamic.CDispatch: ... def DispatchEx( clsid, machine: Incomplete | None = ..., userName: Incomplete | None = ..., resultCLSID: Incomplete | None = ..., typeinfo: Incomplete | None = ..., - UnicodeToString: Incomplete | None = ..., + UnicodeToString: None = ..., clsctx: Incomplete | None = ..., ): ... diff --git a/stubs/pywin32/win32com/client/build.pyi b/stubs/pywin32/win32com/client/build.pyi new file mode 100644 index 000000000..cbbcd2e9a --- /dev/null +++ b/stubs/pywin32/win32com/client/build.pyi @@ -0,0 +1,36 @@ +from _typeshed import Incomplete + +class OleItem: + typename: str + doc: Incomplete + python_name: Incomplete + bWritten: int + bIsDispatch: int + bIsSink: int + clsid: Incomplete + co_class: Incomplete + def __init__(self, doc: Incomplete | None = ...) -> None: ... + +class DispatchItem(OleItem): + typename: str + propMap: Incomplete + propMapGet: Incomplete + propMapPut: Incomplete + mapFuncs: Incomplete + defaultDispatchName: Incomplete + hidden: int + def __init__( + self, typeinfo: Incomplete | None = ..., attr: Incomplete | None = ..., doc: Incomplete | None = ..., bForUser: int = ... + ) -> None: ... + clsid: Incomplete + bIsDispatch: Incomplete + def Build(self, typeinfo, attr, bForUser: int = ...) -> None: ... + def CountInOutOptArgs(self, argTuple): ... + def MakeFuncMethod(self, entry, name, bMakeClass: int = ...): ... + def MakeDispatchFuncMethod(self, entry, name, bMakeClass: int = ...): ... + def MakeVarArgsFuncMethod(self, entry, name, bMakeClass: int = ...): ... + +class LazyDispatchItem(DispatchItem): + typename: str + clsid: Incomplete + def __init__(self, attr, doc) -> None: ... diff --git a/stubs/pywin32/win32com/client/dynamic.pyi b/stubs/pywin32/win32com/client/dynamic.pyi index 1d5dfe588..d9cdc85b6 100644 --- a/stubs/pywin32/win32com/client/dynamic.pyi +++ b/stubs/pywin32/win32com/client/dynamic.pyi @@ -1,14 +1,73 @@ from _typeshed import Incomplete -from typing import Any +from typing import Any, Protocol, TypeVar, overload +from typing_extensions import TypeAlias + +import _win32typing +from win32.lib.pywintypes import IIDType +from win32com.client import build as build + +_T_co = TypeVar("_T_co", covariant=True) +_T = TypeVar("_T") + +class _DispatchCreateClass(Protocol[_T_co]): + @staticmethod + def __call__( + IDispatch: str | PyIDispatchType | _GoodDispatchTypes | PyIUnknownType, + olerepr: build.DispatchItem | build.LazyDispatchItem, + userName: str | None = ..., + UnicodeToString: None = ..., + lazydata: Incomplete | None = ..., + ) -> _T_co: ... + +debugging: int +debugging_attr: int +LCID: int +ERRORS_BAD_CONTEXT: Incomplete +ALL_INVOKE_TYPES: Incomplete + +def debug_print(*args) -> None: ... +def debug_attr_print(*args) -> None: ... +def MakeMethod(func, inst, cls): ... + +PyIDispatchType = _win32typing.PyIDispatch +PyIUnknownType = _win32typing.PyIUnknown + +_GoodDispatchTypes: TypeAlias = tuple[type[str], type[IIDType]] + +@overload +def Dispatch( + IDispatch: str | PyIDispatchType | _GoodDispatchTypes | PyIUnknownType, + userName: str | None, + createClass: _DispatchCreateClass[_T], + typeinfo: _win32typing.PyITypeInfo | None = ..., + UnicodeToString: None = ..., + clsctx: int = ..., +) -> _T: ... +@overload +def Dispatch( + IDispatch: str | PyIDispatchType | _GoodDispatchTypes | PyIUnknownType, + userName: str | None = ..., + createClass: None = ..., + typeinfo: _win32typing.PyITypeInfo | None = ..., + UnicodeToString: None = ..., + clsctx: int = ..., +) -> CDispatch: ... +def MakeOleRepr(IDispatch, typeinfo, typecomp): ... +def DumbDispatch( + IDispatch, + userName: Incomplete | None = ..., + createClass: Incomplete | None = ..., + UnicodeToString: Incomplete | None = ..., + clsctx=..., +): ... -# Necessary for mypy to not throw AssertionError with win32com.client class CDispatch: def __init__( self, IDispatch, olerepr, userName: Incomplete | None = ..., - UnicodeToString: Incomplete | None = ..., + UnicodeToString: None = ..., lazydata: Incomplete | None = ..., ) -> None: ... def __call__(self, *args): ... diff --git a/stubs/pywin32/win32com/client/gencache.pyi b/stubs/pywin32/win32com/client/gencache.pyi new file mode 100644 index 000000000..825af08d8 --- /dev/null +++ b/stubs/pywin32/win32com/client/gencache.pyi @@ -0,0 +1,5 @@ +from win32com.client import dynamic + +def EnsureDispatch( + prog_id: str | dynamic.PyIDispatchType | dynamic._GoodDispatchTypes | dynamic.PyIUnknownType, bForDemand: int = ... +) -> dynamic.CDispatch: ... diff --git a/stubs/pywin32/win32com/server/dispatcher.pyi b/stubs/pywin32/win32com/server/dispatcher.pyi index dde27d7cb..d88bf4f40 100644 --- a/stubs/pywin32/win32com/server/dispatcher.pyi +++ b/stubs/pywin32/win32com/server/dispatcher.pyi @@ -19,4 +19,4 @@ class DispatcherOutputDebugString(DispatcherTrace): ... class DispatcherWin32dbg(DispatcherBase): def __init__(self, policyClass, ob) -> None: ... -DefaultDebugDispatcher: TypeAlias = DispatcherWin32trace +DefaultDebugDispatcher: TypeAlias = DispatcherTrace diff --git a/stubs/pywin32/win32com/server/policy.pyi b/stubs/pywin32/win32com/server/policy.pyi index 6de24c353..8edf97e27 100644 --- a/stubs/pywin32/win32com/server/policy.pyi +++ b/stubs/pywin32/win32com/server/policy.pyi @@ -1,4 +1,5 @@ from _typeshed import Incomplete +from abc import ABC, abstractmethod from pythoncom import ( DISPID_COLLECT as DISPID_COLLECT, @@ -20,13 +21,21 @@ regAddnPath: str def CreateInstance(clsid, reqIID): ... -class BasicWrapPolicy: +class BasicWrapPolicy(ABC): def __init__(self, object) -> None: ... + def _InvokeEx_(self, dispid, lcid, wFlags, args, kwargs, serviceProvider) -> tuple[Incomplete]: ... + @abstractmethod + def _invokeex_(self, dispid, lcid, wFlags, args, kwargs, serviceProvider) -> tuple[Incomplete]: ... + +class MappedWrapPolicy(BasicWrapPolicy): + _dispid_to_func_: dict[int, str] + def _invokeex_(self, dispid, lcid, wFlags, args, kwargs, serviceProvider) -> tuple[Incomplete]: ... -class MappedWrapPolicy(BasicWrapPolicy): ... class DesignatedWrapPolicy(MappedWrapPolicy): ... class EventHandlerPolicy(DesignatedWrapPolicy): ... -class DynamicPolicy(BasicWrapPolicy): ... + +class DynamicPolicy(BasicWrapPolicy): + def _invokeex_(self, dispid, lcid, wFlags, args, kwargs, serviceProvider) -> tuple[Incomplete]: ... DefaultPolicy = DesignatedWrapPolicy diff --git a/stubs/pywin32/win32com/universal.pyi b/stubs/pywin32/win32com/universal.pyi index 8d9a1fdc6..f10b28b8a 100644 --- a/stubs/pywin32/win32com/universal.pyi +++ b/stubs/pywin32/win32com/universal.pyi @@ -1,6 +1,7 @@ from _typeshed import Incomplete from pythoncom import com_error as com_error +from win32com.client import gencache as gencache def RegisterInterfaces(typelibGUID, lcid, major, minor, interface_names: Incomplete | None = ...): ... diff --git a/stubs/pywin32/win32serviceutil.pyi b/stubs/pywin32/win32serviceutil.pyi new file mode 100644 index 000000000..1e989b027 --- /dev/null +++ b/stubs/pywin32/win32serviceutil.pyi @@ -0,0 +1 @@ +from win32.lib.win32serviceutil import * diff --git a/stubs/setuptools/setuptools/__init__.pyi b/stubs/setuptools/setuptools/__init__.pyi index bc712d21a..7b3d04890 100644 --- a/stubs/setuptools/setuptools/__init__.pyi +++ b/stubs/setuptools/setuptools/__init__.pyi @@ -1,5 +1,5 @@ from abc import abstractmethod -from collections.abc import Iterable, Mapping +from collections.abc import Iterable, Mapping, Sequence from distutils.core import Command as _Command from typing import Any @@ -34,7 +34,7 @@ def setup( packages: list[str] = ..., py_modules: list[str] = ..., scripts: list[str] = ..., - ext_modules: list[Extension] = ..., + ext_modules: Sequence[Extension] = ..., classifiers: list[str] = ..., distclass: type[Distribution] = ..., script_name: str = ..., diff --git a/stubs/setuptools/setuptools/_distutils/core.pyi b/stubs/setuptools/setuptools/_distutils/core.pyi index 199a4d70a..07334edc1 100644 --- a/stubs/setuptools/setuptools/_distutils/core.pyi +++ b/stubs/setuptools/setuptools/_distutils/core.pyi @@ -1,4 +1,4 @@ -from collections.abc import Mapping +from collections.abc import Mapping, Sequence from distutils.cmd import Command as Command from distutils.dist import Distribution as Distribution from distutils.extension import Extension as Extension @@ -19,7 +19,7 @@ def setup( packages: list[str] = ..., py_modules: list[str] = ..., scripts: list[str] = ..., - ext_modules: list[Extension] = ..., + ext_modules: Sequence[Extension] = ..., classifiers: list[str] = ..., distclass: type[Distribution] = ..., script_name: str = ...,