Type stub for win32com.server (#14492)

This commit is contained in:
qwerty吃小庄
2025-07-31 00:38:53 +08:00
committed by GitHub
parent ecb0742e7f
commit 52652635af
5 changed files with 88 additions and 5 deletions
@@ -22,9 +22,6 @@ win32com.makegw.*
(win32.lib.)?pywintypes.__import_pywin32_system_module__
# COM object servers scripts
win32com.server.factory
win32com.server.localserver
win32com.server.register
win32com.servers.*
# Active X Scripts
win32com(ext)?.axscript.client.pyscript_rexec
+2 -2
View File
@@ -47,9 +47,9 @@ def CoUnmarshalInterface(Stm: _win32typing.PyIStream, riid: _win32typing.PyIID,
def CoReleaseMarshalData(Stm: _win32typing.PyIStream, /) -> None: ...
def CoGetObject(name: str, iid: _win32typing.PyIID, bindOpts: Incomplete | None = ..., /) -> _win32typing.PyIUnknown: ...
def CoUninitialize() -> None: ...
def CoRegisterClassObject(iid: _win32typing.PyIID, factory: _win32typing.PyIUnknown, context, flags, /): ...
def CoRegisterClassObject(iid: _win32typing.PyIID, factory: _win32typing.PyIUnknown, context, flags, /) -> int: ...
def CoResumeClassObjects() -> None: ...
def CoRevokeClassObject(reg, /) -> None: ...
def CoRevokeClassObject(reg: int, /) -> None: ...
def CoTreatAsClass(clsidold: _win32typing.PyIID, clsidnew: _win32typing.PyIID, /) -> None: ...
def CoWaitForMultipleHandles(Flags, Timeout, Handles: list[int], /): ...
def Connect(cls, /) -> _win32typing.PyIDispatch: ...
@@ -0,0 +1,9 @@
from _typeshed import Unused
from collections.abc import Iterable
from _win32typing import PyIClassFactory, PyIID
def RegisterClassFactories(
clsids: Iterable[PyIID], flags: int | None = None, clsctx: int | None = None
) -> list[tuple[PyIClassFactory, int]]: ...
def RevokeClassFactories(infos: Iterable[tuple[Unused, int]]) -> None: ...
@@ -0,0 +1,9 @@
from collections.abc import Iterable
from typing import Final
from _win32typing import PyIID
usage: Final[str]
def serve(clsids: Iterable[PyIID]) -> None: ...
def main() -> None: ...
@@ -0,0 +1,68 @@
from collections.abc import Callable, Iterable, Mapping
from typing import Final, Literal, Protocol, TypedDict, TypeVar, type_check_only
from typing_extensions import Unpack
from _win32typing import PyHKEY, PyIID
_T = TypeVar("_T", PyHKEY, int)
@type_check_only
class _RegisterClass(Protocol):
_reg_clsid_: PyIID
@type_check_only
class _RegisterFlag(TypedDict, total=False):
quiet: bool
debug: bool
finalize_register: Callable[[], None]
@type_check_only
class _UnregisterFlag(TypedDict, total=False):
quiet: bool
finalize_unregister: Callable[[], None]
@type_check_only
class _ElevatedFlag(TypedDict, total=False):
quiet: bool
unattended: bool
hwnd: int
@type_check_only
class _CommandFlag(_RegisterFlag, _UnregisterFlag, _ElevatedFlag): # type: ignore[misc]
...
CATID_PythonCOMServer: Final = "{B3EF80D0-68E2-11D0-A689-00C04FD658FF}"
def recurse_delete_key(path: str | None, base: PyHKEY | int = -2147483648) -> None: ...
def RegisterServer(
clsid: PyIID,
pythonInstString: str | None = None,
desc: str | None = None,
progID: str | None = None,
verProgID: str | None = None,
defIcon: str | None = None,
threadingModel: Literal["apartment", "both", "free", "neutral"] = "both",
policy: str | None = None,
catids: list[PyIID] = [],
other: Mapping[str, str] = {},
addPyComCat: bool | None = None,
dispatcher: str | None = None,
clsctx: int | None = None,
addnPath: str | None = None,
) -> None: ...
def GetUnregisterServerKeys(
clsid: PyIID, progID: str | None = None, verProgID: str | None = None, customKeys: Iterable[tuple[str, _T]] | None = None
) -> list[tuple[str, _T | int]]: ...
def UnregisterServer(
clsid: PyIID,
progID: str | None = None,
verProgID: str | None = None,
customKeys: Iterable[tuple[str, PyHKEY | int]] | None = None,
) -> None: ...
def GetRegisteredServerOption(clsid: PyIID, optionName: str) -> str | None: ...
def RegisterClasses(*classes: type[_RegisterClass], **flags: Unpack[_RegisterFlag]) -> None: ...
def UnregisterClasses(*classes: type[_RegisterClass], **flags: Unpack[_UnregisterFlag]) -> None: ...
def UnregisterInfoClasses(*classes: type[_RegisterClass]) -> list[tuple[str, PyHKEY | int]]: ...
def ReExecuteElevated(flags: _ElevatedFlag) -> None: ...
def UseCommandLine(*classes: type[_RegisterClass], **flags: Unpack[_CommandFlag]) -> list[tuple[str, PyHKEY | int]] | None: ...
def RegisterPyComCategory() -> None: ...