-
-
Notifications
You must be signed in to change notification settings - Fork 2k
[pywin32] Improve win32com #15527
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
[pywin32] Improve win32com #15527
Changes from 7 commits
275984b
9cbb0e6
fc1af20
300503e
8e38cd6
d21a4f0
c0f4c67
34147ba
4730227
0943e0f
e60f518
e5592a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,70 @@ | ||
| from _typeshed import Incomplete | ||
| from collections.abc import Iterable | ||
| from typing import ClassVar, Final, Literal | ||
|
|
||
| class NotSupportedException(Exception): ... | ||
|
|
||
| DropIndirection: Final = "DropIndirection" | ||
| NoTranslateTypes: Final[list[int]] | ||
| NoTranslateMap: Final[set[int]] | ||
|
|
||
| class MapEntry: | ||
| dispid: Incomplete | ||
| desc: Incomplete | None | ||
| names: Incomplete | ||
| doc: Incomplete | ||
| resultCLSID: Incomplete | ||
| resultDocumentation: Incomplete | None | ||
| wasProperty: Incomplete | ||
| hidden: bool | Literal[0, 1] | ||
| def __init__( | ||
| self, desc_or_id, names=None, doc=None, resultCLSID=..., resultDoc=None, hidden: bool | Literal[0, 1] = 0 | ||
| ) -> None: ... | ||
| def GetResultCLSID(self) -> Incomplete | None: ... | ||
| def GetResultCLSIDStr(self) -> str: ... | ||
| def GetResultName(self) -> Incomplete | None: ... | ||
|
|
||
| class OleItem: | ||
| typename: str | ||
| typename: ClassVar[str] | ||
| doc: Incomplete | ||
| python_name: Incomplete | ||
| bWritten: int | ||
| bIsDispatch: int | ||
| bIsSink: int | ||
| clsid: Incomplete | ||
| co_class: Incomplete | ||
| def __init__(self, doc: Incomplete | None = ...) -> None: ... | ||
| python_name: Incomplete | None | ||
| bWritten: bool | Literal[0, 1] | ||
| bIsDispatch: bool | Literal[0, 1] | ||
| bIsSink: bool | Literal[0, 1] | ||
| clsid: Incomplete | None | ||
| co_class: Incomplete | None | ||
| def __init__(self, doc=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: ... | ||
| typename: ClassVar[str] | ||
| propMap: dict[Incomplete, Incomplete] | ||
| propMapGet: dict[Incomplete, Incomplete] | ||
| propMapPut: dict[Incomplete, Incomplete] | ||
| mapFuncs: dict[Incomplete, Incomplete] | ||
| defaultDispatchName: Incomplete | None | ||
| hidden: bool | Literal[0, 1] | ||
| def __init__(self, typeinfo=None, attr=None, doc=None, bForUser: bool | Literal[0, 1] = 1) -> 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 = ...): ... | ||
| bIsDispatch: bool | Literal[0, 1] | ||
| def Build(self, typeinfo, attr, bForUser: bool | Literal[0, 1] = 1) -> None: ... | ||
| def CountInOutOptArgs(self, argTuple: Iterable[Incomplete]) -> tuple[int, int, int]: ... | ||
| def MakeFuncMethod(self, entry, name: str, bMakeClass: bool | Literal[0, 1] = 1) -> list[str]: ... | ||
| def MakeDispatchFuncMethod(self, entry, name: str, bMakeClass: bool | Literal[0, 1] = 1) -> list[str]: ... | ||
| def MakeVarArgsFuncMethod(self, entry, name: str, bMakeClass: bool | Literal[0, 1] = 1) -> list[str]: ... | ||
|
|
||
| class VTableItem(DispatchItem): | ||
| vtableFuncs: list[tuple[Incomplete, Incomplete, Incomplete]] | ||
| def Build(self, typeinfo, attr, bForUser: bool | Literal[0, 1] = 1) -> None: ... | ||
|
|
||
| class LazyDispatchItem(DispatchItem): | ||
| typename: str | ||
| typename: ClassVar[str] | ||
| clsid: Incomplete | ||
| def __init__(self, attr, doc) -> None: ... | ||
|
|
||
| typeSubstMap: Final[dict[int, int]] | ||
| valid_identifier_chars: Final[str] | ||
|
|
||
| def demunge_leading_underscores(className: str) -> str: ... | ||
| def MakePublicAttributeName(className: str, is_global: bool = False) -> str: ... | ||
| def MakeDefaultArgRepr(defArgVal) -> str | None: ... | ||
| def BuildCallList(fdesc, names, defNamedOptArg, defNamedNotOptArg, defUnnamedArg, defOutArg, is_comment: bool = False) -> str: ... |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,5 @@ | ||||||
| from _typeshed import Incomplete | ||||||
| from typing import Any, Protocol, TypeVar, overload | ||||||
| from typing import Any, Final, Literal, Protocol, TypeVar, overload, type_check_only | ||||||
| from typing_extensions import TypeAlias | ||||||
|
|
||||||
| import _win32typing | ||||||
|
|
@@ -9,23 +9,24 @@ from win32com.client import build | |||||
| _T_co = TypeVar("_T_co", covariant=True) | ||||||
| _T = TypeVar("_T") | ||||||
|
|
||||||
| @type_check_only | ||||||
| class _DispatchCreateClass(Protocol[_T_co]): | ||||||
|
Comment on lines
+11
to
12
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @brianschubert I didn’t find any occurrences of this name in the source code (via grep), so I thought this case might also be interesting for your stubtest patch.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this is covered by an allowlist entry, which is why it hasn't been flagged yet: typeshed/stubs/pywin32/@tests/stubtest_allowlist_win32.txt Lines 14 to 15 in 50ec910
Maybe you can refine that while we're here? |
||||||
| @staticmethod | ||||||
| def __call__( | ||||||
| IDispatch: str | PyIDispatchType | _GoodDispatchTypes | PyIUnknownType, | ||||||
| olerepr: build.DispatchItem | build.LazyDispatchItem, | ||||||
| userName: str | None = ..., | ||||||
| lazydata: Incomplete | None = ..., | ||||||
| userName: str | None = None, | ||||||
| lazydata=None, | ||||||
| ) -> _T_co: ... | ||||||
|
|
||||||
| debugging: int | ||||||
| debugging_attr: int | ||||||
| LCID: int | ||||||
| ERRORS_BAD_CONTEXT: Incomplete | ||||||
| ALL_INVOKE_TYPES: Incomplete | ||||||
| LCID: Final = 0x0 | ||||||
| ERRORS_BAD_CONTEXT: Final[list[int]] | ||||||
| ALL_INVOKE_TYPES: Final[list[int]] | ||||||
|
|
||||||
| def debug_print(*args) -> None: ... | ||||||
| def debug_attr_print(*args) -> None: ... | ||||||
| def debug_print(*args: object) -> None: ... | ||||||
| def debug_attr_print(*args: object) -> None: ... | ||||||
|
|
||||||
| PyIDispatchType = _win32typing.PyIDispatch | ||||||
| PyIUnknownType = _win32typing.PyIUnknown | ||||||
|
|
@@ -37,32 +38,32 @@ def Dispatch( | |||||
| IDispatch: str | PyIDispatchType | _GoodDispatchTypes | PyIUnknownType, | ||||||
| userName: str | None, | ||||||
| createClass: _DispatchCreateClass[_T], | ||||||
| typeinfo: _win32typing.PyITypeInfo | None = ..., | ||||||
| typeinfo: _win32typing.PyITypeInfo | None = None, | ||||||
| clsctx: int = ..., | ||||||
| ) -> _T: ... | ||||||
| @overload | ||||||
| def Dispatch( | ||||||
| IDispatch: str | PyIDispatchType | _GoodDispatchTypes | PyIUnknownType, | ||||||
| userName: str | None = ..., | ||||||
| userName: str | None = None, | ||||||
| createClass: None = None, | ||||||
| typeinfo: _win32typing.PyITypeInfo | None = ..., | ||||||
| typeinfo: _win32typing.PyITypeInfo | None = None, | ||||||
| clsctx: int = ..., | ||||||
| ) -> CDispatch: ... | ||||||
| def MakeOleRepr(IDispatch, typeinfo, typecomp): ... | ||||||
| def DumbDispatch(IDispatch, userName: Incomplete | None = ..., createClass: Incomplete | None = ..., clsctx=...): ... | ||||||
| def MakeOleRepr(IDispatch, typeinfo, typecomp) -> build.DispatchItem | build.LazyDispatchItem: ... | ||||||
| def DumbDispatch(IDispatch, userName=None, createClass=None, clsctx=...): ... | ||||||
|
|
||||||
| class CDispatch: | ||||||
| def __init__(self, IDispatch, olerepr, userName: Incomplete | None = ..., lazydata: Incomplete | None = ...) -> None: ... | ||||||
| def __init__(self, IDispatch, olerepr, userName=None, lazydata=None) -> None: ... | ||||||
| def __call__(self, *args): ... | ||||||
| def __bool__(self) -> bool: ... | ||||||
| def __dir__(self): ... | ||||||
| def __eq__(self, other): ... | ||||||
| def __ne__(self, other): ... | ||||||
| def __dir__(self) -> list[str]: ... | ||||||
| def __eq__(self, other) -> bool: ... | ||||||
| def __ne__(self, other) -> bool: ... | ||||||
| def __int__(self) -> int: ... | ||||||
| def __len__(self) -> int: ... | ||||||
| def __getitem__(self, index): ... | ||||||
| def __setitem__(self, index, *args) -> None: ... | ||||||
| def __LazyMap__(self, attr): ... | ||||||
| def __LazyMap__(self, attr) -> Literal[0, 1] | None: ... | ||||||
| def __AttrToID__(self, attr): ... | ||||||
| ob: Incomplete | ||||||
| # CDispatch objects are dynamically generated and too complex to type | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| from typing import Literal | ||
|
|
||
| from win32com.client import dynamic | ||
|
|
||
| def EnsureDispatch( | ||
| prog_id: str | dynamic.PyIDispatchType | dynamic._GoodDispatchTypes | dynamic.PyIUnknownType, bForDemand: int = ... | ||
| prog_id: str | dynamic.PyIDispatchType | dynamic._GoodDispatchTypes | dynamic.PyIUnknownType, | ||
| bForDemand: bool | Literal[0, 1] = 1, | ||
| ) -> dynamic.CDispatch: ... |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,54 +1,56 @@ | ||
| FACILITY_CONTROL: int | ||
| from typing import Final | ||
|
|
||
| FACILITY_CONTROL: Final = 0xA | ||
|
|
||
| def MAKE_SCODE(sev: int, fac: int, code: int) -> int: ... | ||
| def STD_CTL_SCODE(n: int) -> int: ... | ||
|
|
||
| CTL_E_ILLEGALFUNCTIONCALL: int | ||
| CTL_E_OVERFLOW: int | ||
| CTL_E_OUTOFMEMORY: int | ||
| CTL_E_DIVISIONBYZERO: int | ||
| CTL_E_OUTOFSTRINGSPACE: int | ||
| CTL_E_OUTOFSTACKSPACE: int | ||
| CTL_E_BADFILENAMEORNUMBER: int | ||
| CTL_E_FILENOTFOUND: int | ||
| CTL_E_BADFILEMODE: int | ||
| CTL_E_FILEALREADYOPEN: int | ||
| CTL_E_DEVICEIOERROR: int | ||
| CTL_E_FILEALREADYEXISTS: int | ||
| CTL_E_BADRECORDLENGTH: int | ||
| CTL_E_DISKFULL: int | ||
| CTL_E_BADRECORDNUMBER: int | ||
| CTL_E_BADFILENAME: int | ||
| CTL_E_TOOMANYFILES: int | ||
| CTL_E_DEVICEUNAVAILABLE: int | ||
| CTL_E_PERMISSIONDENIED: int | ||
| CTL_E_DISKNOTREADY: int | ||
| CTL_E_PATHFILEACCESSERROR: int | ||
| CTL_E_PATHNOTFOUND: int | ||
| CTL_E_INVALIDPATTERNSTRING: int | ||
| CTL_E_INVALIDUSEOFNULL: int | ||
| CTL_E_INVALIDFILEFORMAT: int | ||
| CTL_E_INVALIDPROPERTYVALUE: int | ||
| CTL_E_INVALIDPROPERTYARRAYINDEX: int | ||
| CTL_E_SETNOTSUPPORTEDATRUNTIME: int | ||
| CTL_E_SETNOTSUPPORTED: int | ||
| CTL_E_NEEDPROPERTYARRAYINDEX: int | ||
| CTL_E_SETNOTPERMITTED: int | ||
| CTL_E_GETNOTSUPPORTEDATRUNTIME: int | ||
| CTL_E_GETNOTSUPPORTED: int | ||
| CTL_E_PROPERTYNOTFOUND: int | ||
| CTL_E_INVALIDCLIPBOARDFORMAT: int | ||
| CTL_E_INVALIDPICTURE: int | ||
| CTL_E_PRINTERERROR: int | ||
| CTL_E_CANTSAVEFILETOTEMP: int | ||
| CTL_E_SEARCHTEXTNOTFOUND: int | ||
| CTL_E_REPLACEMENTSTOOLONG: int | ||
| CONNECT_E_FIRST: int | ||
| CONNECT_E_LAST: int | ||
| CONNECT_S_FIRST: int | ||
| CONNECT_S_LAST: int | ||
| CONNECT_E_NOCONNECTION: int | ||
| CONNECT_E_ADVISELIMIT: int | ||
| CONNECT_E_CANNOTCONNECT: int | ||
| CONNECT_E_OVERRIDDEN: int | ||
| CLASS_E_NOTLICENSED: int | ||
| CTL_E_ILLEGALFUNCTIONCALL: Final = -2146828283 | ||
| CTL_E_OVERFLOW: Final = -2146828282 | ||
| CTL_E_OUTOFMEMORY: Final = -2146828281 | ||
| CTL_E_DIVISIONBYZERO: Final = -2146828277 | ||
| CTL_E_OUTOFSTRINGSPACE: Final = -2146828274 | ||
| CTL_E_OUTOFSTACKSPACE: Final = -2146828260 | ||
| CTL_E_BADFILENAMEORNUMBER: Final = -2146828236 | ||
| CTL_E_FILENOTFOUND: Final = -2146828235 | ||
| CTL_E_BADFILEMODE: Final = -2146828234 | ||
| CTL_E_FILEALREADYOPEN: Final = -2146828233 | ||
| CTL_E_DEVICEIOERROR: Final = -2146828231 | ||
| CTL_E_FILEALREADYEXISTS: Final = -2146828230 | ||
| CTL_E_BADRECORDLENGTH: Final = -2146828229 | ||
| CTL_E_DISKFULL: Final = -2146828227 | ||
| CTL_E_BADRECORDNUMBER: Final = -2146828225 | ||
| CTL_E_BADFILENAME: Final = -2146828224 | ||
| CTL_E_TOOMANYFILES: Final = -2146828221 | ||
| CTL_E_DEVICEUNAVAILABLE: Final = -2146828220 | ||
| CTL_E_PERMISSIONDENIED: Final = -2146828218 | ||
| CTL_E_DISKNOTREADY: Final = -2146828217 | ||
| CTL_E_PATHFILEACCESSERROR: Final = -2146828213 | ||
| CTL_E_PATHNOTFOUND: Final = -2146828212 | ||
| CTL_E_INVALIDPATTERNSTRING: Final = -2146828195 | ||
| CTL_E_INVALIDUSEOFNULL: Final = -2146828194 | ||
| CTL_E_INVALIDFILEFORMAT: Final = -2146827967 | ||
| CTL_E_INVALIDPROPERTYVALUE: Final = -2146827908 | ||
| CTL_E_INVALIDPROPERTYARRAYINDEX: Final = -2146827907 | ||
| CTL_E_SETNOTSUPPORTEDATRUNTIME: Final = -2146827906 | ||
| CTL_E_SETNOTSUPPORTED: Final = -2146827905 | ||
| CTL_E_NEEDPROPERTYARRAYINDEX: Final = -2146827903 | ||
| CTL_E_SETNOTPERMITTED: Final = -2146827901 | ||
| CTL_E_GETNOTSUPPORTEDATRUNTIME: Final = -2146827895 | ||
| CTL_E_GETNOTSUPPORTED: Final = -2146827894 | ||
| CTL_E_PROPERTYNOTFOUND: Final = -2146827866 | ||
| CTL_E_INVALIDCLIPBOARDFORMAT: Final = -2146827828 | ||
| CTL_E_INVALIDPICTURE: Final = -2146827807 | ||
| CTL_E_PRINTERERROR: Final = -2146827806 | ||
| CTL_E_CANTSAVEFILETOTEMP: Final = -2146827553 | ||
| CTL_E_SEARCHTEXTNOTFOUND: Final = -2146827544 | ||
| CTL_E_REPLACEMENTSTOOLONG: Final = -2146827542 | ||
| CONNECT_E_FIRST: Final = -2147220992 | ||
| CONNECT_E_LAST: Final = -2147220977 | ||
| CONNECT_S_FIRST: Final = 262656 | ||
| CONNECT_S_LAST: Final = 262671 | ||
| CONNECT_E_NOCONNECTION: Final = -2147220992 | ||
| CONNECT_E_ADVISELIMIT: Final = -2147220991 | ||
| CONNECT_E_CANNOTCONNECT: Final = -2147220990 | ||
| CONNECT_E_OVERRIDDEN: Final = -2147220989 | ||
| CLASS_E_NOTLICENSED: Final = -2147221230 |
Uh oh!
There was an error while loading. Please reload this page.