-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Add deprecation decorator and comments for pywin32 #11570
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
Changes from 4 commits
68eeebf
c1e82d5
4b340e3
0fd060a
d5033d2
9b522b1
3fba6e1
9ff7c0c
d8fd8bc
ffaf31a
631868a
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,8 +1,9 @@ | ||||||
| # Not available at runtime. Contains type definitions that are otherwise not exposed and not part of a specific module. | ||||||
| from _typeshed import Incomplete, Unused | ||||||
| from collections.abc import Iterable | ||||||
| from datetime import datetime | ||||||
| from typing import Literal, final, overload | ||||||
| from typing_extensions import Self | ||||||
| from typing_extensions import Self, TypeAlias, deprecated | ||||||
|
|
||||||
| class ArgNotFound: ... | ||||||
| class PyOleEmpty: ... | ||||||
|
|
@@ -123,7 +124,12 @@ class FORM_INFO_1: | |||||
| def ImageableArea(self): ... | ||||||
|
|
||||||
| class ImportCallback: ... | ||||||
| class LARGE_INTEGER: ... | ||||||
|
|
||||||
| # Note: Don't use these, use `int` instead. Or an overload with a deprecation message on the tuple param. | ||||||
| # We're only keeping these here as a reminder when typing from source code. | ||||||
| # Deprecated: Support for passing 2 integers to create a 64bit value is deprecated - pass a long instead | ||||||
| LARGE_INTEGER: TypeAlias = int | tuple[int, int] | ||||||
| ULARGE_INTEGER: TypeAlias = int | tuple[int, int] | ||||||
|
|
||||||
| class NCB: | ||||||
| @property | ||||||
|
|
@@ -164,6 +170,12 @@ class PRINTER_DEFAULTS: | |||||
| class PyACL: | ||||||
| def Initialize(self) -> None: ... | ||||||
| def IsValid(self) -> bool: ... | ||||||
| @deprecated( | ||||||
| """\ | ||||||
| Early versions of this function supported only two arguments. \ | ||||||
| This has been deprecated in preference of the three argument version, \ | ||||||
| which reflects the win32 API and the new functions in this module.""" | ||||||
| ) | ||||||
| @overload | ||||||
| def AddAccessAllowedAce(self, access: int, sid: PySID, /) -> None: ... | ||||||
| @overload | ||||||
|
|
@@ -172,7 +184,16 @@ class PyACL: | |||||
| def AddAccessAllowedObjectAce( | ||||||
| self, AceRevision, AceFlags, AccessMask, ObjectTypeGuid: PyIID, InheritedObjectTypeGuid: PyIID, sid: PySID, / | ||||||
| ) -> None: ... | ||||||
| def AddAccessDeniedAce(self, revision: int, access: int, sid: PySID, access1: int, sid1: PySID, /) -> None: ... | ||||||
| @deprecated( | ||||||
| """\ | ||||||
| Early versions of this function supported only two arguments. \ | ||||||
| This has been deprecated in preference of the three argument version, \ | ||||||
| which reflects the win32 API and the new functions in this module.""" | ||||||
| ) | ||||||
| @overload | ||||||
| def AddAccessDeniedAce(self, access: int, sid: PySID, /) -> None: ... | ||||||
| @overload | ||||||
| def AddAccessDeniedAce(self, revision: int, access: int, sid: 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: ... | ||||||
|
|
@@ -217,9 +238,13 @@ class PyCEHANDLE: ... | |||||
| class PyCERTSTORE: | ||||||
| @property | ||||||
| def HCERTSTORE(self): ... | ||||||
| # Flags argument is deprecated. | ||||||
| # The underlying function is now always called with `CERT_CLOSE_STORE_CHECK_FLAG`, | ||||||
| # and support for this param will be dropped at some point in the future. | ||||||
| @deprecated( | ||||||
| """\ | ||||||
| `Flags` argument has been deprecated as it is likely to crash the process if \ | ||||||
| `CERT_CLOSE_STORE_FORCE_FLAG` is specified. The underlying function is now \ | ||||||
| always called with `CERT_CLOSE_STORE_CHECK_FLAG`, and support for this \ | ||||||
| param will be dropped at some point in the future.""" | ||||||
| ) | ||||||
| def CertCloseStore(self, Flags: int = ...) -> None: ... | ||||||
|
Avasam marked this conversation as resolved.
Outdated
|
||||||
| def CertControlStore(self, Flags, CtrlType, CtrlPara: int) -> None: ... | ||||||
| def CertEnumCertificatesInStore(self) -> list[PyCERT_CONTEXT]: ... | ||||||
|
|
@@ -1676,7 +1701,7 @@ class PyTRUSTEE: | |||||
|
|
||||||
| class PyTS_HANDLE: ... | ||||||
|
|
||||||
| class PyTime: | ||||||
| class PyTime(datetime): | ||||||
|
Avasam marked this conversation as resolved.
Outdated
|
||||||
| @property | ||||||
| def year(self): ... | ||||||
| @property | ||||||
|
|
@@ -2403,7 +2428,6 @@ class SERVICE_STATUS: | |||||
| def __getitem__(self, i: int, /) -> int: ... | ||||||
|
|
||||||
| class TRACKMOUSEEVENT: ... | ||||||
| class ULARGE_INTEGER: ... | ||||||
| class WIN32_FIND_DATA: ... | ||||||
| class com_error: ... | ||||||
|
|
||||||
|
|
@@ -3682,7 +3706,11 @@ class PyIInternetPriority: | |||||
|
|
||||||
| class PyIInternetProtocol: | ||||||
| def Read(self, cb, /) -> None: ... | ||||||
| def Seek(self, dlibMove: LARGE_INTEGER, dwOrigin, /) -> None: ... | ||||||
| @overload | ||||||
| def Seek(self, dlibMove: int, dwOrigin, /) -> None: ... | ||||||
| @overload | ||||||
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | ||||||
|
Member
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.
Suggested change
|
||||||
| def Seek(self, dlibMove: tuple[int, int], dwOrigin, /) -> None: ... | ||||||
| def LockRequest(self, dwOptions, /) -> None: ... | ||||||
| def UnlockRequest(self) -> None: ... | ||||||
|
|
||||||
|
|
@@ -3741,13 +3769,32 @@ class PyIKnownFolderManager: | |||||
| def Redirect(self, _id: PyIID, hwnd: int, flags, TargetPath, Exclusion: tuple[PyIID, ...], /) -> None: ... | ||||||
|
|
||||||
| class PyILockBytes: | ||||||
| def ReadAt(self, ulOffset: ULARGE_INTEGER, cb, /) -> str: ... | ||||||
| def WriteAt(self, ulOffset: ULARGE_INTEGER, data: str, /): ... | ||||||
| @overload | ||||||
| def ReadAt(self, ulOffset: int, cb, /) -> str: ... | ||||||
| @overload | ||||||
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | ||||||
|
Member
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.
Suggested change
|
||||||
| def ReadAt(self, ulOffset: tuple[int, int], cb, /) -> str: ... | ||||||
| @overload | ||||||
| def WriteAt(self, ulOffset: int, data: str, /): ... | ||||||
| @overload | ||||||
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | ||||||
|
Member
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.
Suggested change
|
||||||
| def WriteAt(self, ulOffset: tuple[int, int], data: str, /): ... | ||||||
| def Flush(self) -> None: ... | ||||||
| def SetSize(self, cb: ULARGE_INTEGER, /) -> None: ... | ||||||
| def LockRegion(self, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType, /) -> None: ... | ||||||
| def UnlockRegion(self, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType, /) -> None: ... | ||||||
| def Stat(self, grfStatFlag, /) -> STATSTG: ... | ||||||
| @overload | ||||||
| def SetSize(self, cb: int, /) -> None: ... | ||||||
| @overload | ||||||
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | ||||||
|
Member
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.
Suggested change
|
||||||
| def SetSize(self, cb: tuple[int, int], /) -> None: ... | ||||||
| @overload | ||||||
| def LockRegion(self, libOffset: int, cb: int, dwLockType, /) -> None: ... | ||||||
| @overload | ||||||
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | ||||||
|
Member
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.
Suggested change
|
||||||
| def LockRegion(self, libOffset: tuple[int, int], cb: tuple[int, int], dwLockType, /) -> None: ... | ||||||
| @overload | ||||||
| def UnlockRegion(self, libOffset: int, cb: int, dwLockType, /) -> None: ... | ||||||
| @overload | ||||||
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | ||||||
|
Member
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.
Suggested change
Seems like this occurs a bunch more times, please change the remaining ones too
Collaborator
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. Yeah I copied the string from source (almost) verbatim. Except I replaced |
||||||
| def UnlockRegion(self, libOffset: tuple[int, int], cb: tuple[int, int], dwLockType, /) -> None: ... | ||||||
|
|
||||||
| class PyIMAPIContainer: | ||||||
| def OpenEntry(self, entryId: str, iid: PyIID, flags, /): ... | ||||||
|
|
@@ -3882,6 +3929,7 @@ class PyIMsgServiceAdmin: | |||||
| def GetMsgServiceTable(self, flags, /) -> PyIMAPITable: ... | ||||||
| def GetProviderTable(self, flags, /) -> PyIMAPITable: ... | ||||||
| def DeleteMsgService(self, uuid: PyIID, /) -> None: ... | ||||||
| @deprecated("This is deprecated, and there is no replacement referenced to use instead.") | ||||||
| def RenameMsgService(self, uuid: PyIID, flags, newName: str, /) -> None: ... | ||||||
| def OpenProfileSection(self, uuid: PyIID, iid: PyIID, flags, /): ... | ||||||
| def AdminProviders(self, uuid: PyIID, flags, /): ... | ||||||
|
|
@@ -4104,7 +4152,7 @@ class PyIPersistStream: | |||||
| def IsDirty(self) -> bool: ... | ||||||
| def Load(self, stream: PyIStream, /) -> None: ... | ||||||
| def Save(self, stream: PyIStream, bClearDirty, /) -> None: ... | ||||||
| def GetSizeMax(self) -> ULARGE_INTEGER: ... | ||||||
| def GetSizeMax(self) -> int: ... | ||||||
|
|
||||||
| class PyIPersistStreamInit: | ||||||
| def InitNew(self) -> None: ... | ||||||
|
|
@@ -4539,13 +4587,33 @@ class PyIStream: | |||||
| def read(self, numBytes, /) -> str: ... | ||||||
| def Write(self, data: str, /) -> None: ... | ||||||
| def write(self, data: str, /) -> None: ... | ||||||
| def Seek(self, offset, origin, /) -> ULARGE_INTEGER: ... | ||||||
| def SetSize(self, newSize: ULARGE_INTEGER, /) -> None: ... | ||||||
| def CopyTo(self, stream: PyIStream, cb: ULARGE_INTEGER, /) -> ULARGE_INTEGER: ... | ||||||
| @overload | ||||||
| def Seek(self, offset: int, origin: int, /) -> int: ... | ||||||
| @overload | ||||||
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | ||||||
| def Seek(self, offset: tuple[int, int], origin: int, /) -> int: ... | ||||||
| @overload | ||||||
| def SetSize(self, newSize: int, /) -> None: ... | ||||||
| @overload | ||||||
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | ||||||
| def SetSize(self, newSize: tuple[int, int], /) -> None: ... | ||||||
| @overload | ||||||
| def CopyTo(self, stream: PyIStream, cb: int, /) -> int: ... | ||||||
| @overload | ||||||
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | ||||||
| def CopyTo(self, stream: PyIStream, cb: tuple[int, int], /) -> int: ... | ||||||
| def Commit(self, flags, /) -> None: ... | ||||||
| def Revert(self) -> None: ... | ||||||
| def LockRegion(self, offset: ULARGE_INTEGER, cb: ULARGE_INTEGER, lockType, /) -> None: ... | ||||||
| def UnLockRegion(self, offset: ULARGE_INTEGER, cb: ULARGE_INTEGER, lockType, /) -> None: ... | ||||||
| @overload | ||||||
| def LockRegion(self, offset: int, cb: int, lockType, /) -> None: ... | ||||||
| @overload | ||||||
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | ||||||
| def LockRegion(self, offset: tuple[int, int], cb: tuple[int, int], lockType, /) -> None: ... | ||||||
| @overload | ||||||
| def UnLockRegion(self, offset: int, cb: int, lockType, /) -> None: ... | ||||||
| @overload | ||||||
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | ||||||
| def UnLockRegion(self, offset: tuple[int, int], cb: tuple[int, int], lockType, /) -> None: ... | ||||||
| def Clone(self) -> PyIStream: ... | ||||||
| def Stat(self, grfStatFlag: int = ..., /) -> STATSTG: ... | ||||||
|
|
||||||
|
|
@@ -4682,6 +4750,10 @@ class PyPROPERTYKEY: ... | |||||
|
|
||||||
| @final | ||||||
| class PyPROPVARIANT: | ||||||
| @overload | ||||||
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | ||||||
| def __init__(self, Value: tuple[int, int], Type=...) -> None: ... | ||||||
| @overload | ||||||
| def __init__(self, Value, Type=...) -> None: ... | ||||||
| @property | ||||||
| def vt(self): ... | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,5 @@ | ||||||
| from _typeshed import Incomplete | ||||||
| from typing_extensions import TypeAlias | ||||||
| from typing_extensions import TypeAlias, deprecated | ||||||
|
|
||||||
| import _win32typing | ||||||
| from win32.lib.pywintypes import com_error as com_error | ||||||
|
|
@@ -69,6 +69,10 @@ def IsGatewayRegistered(iid: _win32typing.PyIID | None, /) -> int: ... | |||||
| def LoadRegTypeLib(iid: _win32typing.PyIID, versionMajor, versionMinor, lcid, /) -> _win32typing.PyITypeLib: ... | ||||||
| def LoadTypeLib(libFileName: str, /) -> _win32typing.PyITypeLib: ... | ||||||
| def MakePyFactory(iid: _win32typing.PyIID, /) -> _win32typing.PyIClassFactory: ... | ||||||
| @deprecated("MakeIID is deprecated - please use pywintypes.IID() instead.") | ||||||
|
Member
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.
Suggested change
Type checker messages should already point out the name of the function |
||||||
| def MakeIID(iidString: str, is_bytes: bool = ..., /) -> _win32typing.PyIID: ... | ||||||
| @deprecated("MakeTime is deprecated - please use pywintypes.Time() instead.") | ||||||
|
Member
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.
Suggested change
|
||||||
| def MakeTime(timeRepr, /) -> _win32typing.PyTime: ... | ||||||
| def MkParseDisplayName( | ||||||
| displayName: str, bindCtx: _win32typing.PyIBindCtx | None = ..., / | ||||||
| ) -> tuple[_win32typing.PyIMoniker, Incomplete, _win32typing.PyIBindCtx]: ... | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,5 @@ | ||||||
| from _typeshed import Incomplete | ||||||
| from typing_extensions import deprecated | ||||||
|
|
||||||
| class BaseQuery: | ||||||
| counters: Incomplete | ||||||
|
|
@@ -24,6 +25,10 @@ class BaseQuery: | |||||
| class Query(BaseQuery): | ||||||
| volatilecounters: Incomplete | ||||||
| def __init__(self, *args, **namedargs) -> None: ... | ||||||
| @deprecated( | ||||||
| "The use of addperfcounter by end-users is deprecated, since the use of addcounterbybrowsing is considerably more flexible and general." | ||||||
|
Member
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.
Suggested change
|
||||||
| ) | ||||||
| def addperfcounter(self, object, counter, machine=None): ... | ||||||
| def addinstcounter( | ||||||
| self, object, counter, machine: Incomplete | None = ..., objtype: str = ..., volatile: int = ..., format=... | ||||||
| ) -> None: ... | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| from _typeshed import Incomplete, ReadableBuffer | ||
| from collections.abc import Callable, Iterable | ||
| from typing import TypedDict | ||
| from typing_extensions import deprecated | ||
|
|
||
| import _win32typing | ||
| from win32.lib.pywintypes import error as error | ||
|
|
@@ -111,8 +112,10 @@ def GetModuleFileName(hModule: int, /) -> str: ... | |
| def GetModuleFileNameW(hModule: int, /) -> str: ... | ||
| def GetModuleHandle(fileName: str | None = ..., /) -> int: ... | ||
| def GetPwrCapabilities(): ... | ||
| @deprecated("This function is obsolete, applications should use the registry instead.") | ||
| def GetProfileSection(section: str, iniName: str | None = ..., /): ... | ||
| def GetProcAddress(hModule: int, functionName: _win32typing.PyResourceId, /): ... | ||
| @deprecated("This function is obsolete, applications should use the registry instead.") | ||
| def GetProfileVal(section: str, entry: str, defValue: str, iniName: str | None = ..., /) -> str: ... | ||
| def GetShortPathName(path: str, /) -> str: ... | ||
| def GetStdHandle(handle: int, /) -> _win32typing.PyHANDLE: ... | ||
|
|
@@ -223,6 +226,7 @@ def SetSysColors(Elements, RgbValues, /) -> None: ... | |
| def SetLocalTime(SystemTime: _win32typing.PyTime, /) -> None: ... | ||
| def SetSystemTime(year, month, dayOfWeek, day, hour, minute, second, millseconds, /): ... | ||
| def SetClassLong(hwnd: int, offset, val, /): ... | ||
| @deprecated("This function is obsolete, use `win32api.SetClassLong` instead") | ||
| def SetClassWord(hwnd: int, offset, val, /): ... | ||
| def SetCursor(hCursor: int, /) -> int: ... | ||
| def SetEnvironmentVariable(Name, Value, /) -> None: ... | ||
|
|
@@ -233,6 +237,11 @@ def SetSystemPowerState(Suspend, Force, /) -> None: ... | |
| def SetThreadLocale(lcid, /) -> None: ... | ||
| def SetTimeZoneInformation(tzi, /): ... | ||
| def SetWindowLong(hwnd: int | None, offset: int, value: float, /) -> int: ... | ||
|
|
||
| # This method is accidentally overwritten in source, can re-introduce once fixed: | ||
| # https://github.com/mhammond/pywin32/pull/2199 | ||
|
Collaborator
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. |
||
| # @deprecated("This function is obsolete, use `win32api.SetWindowLong` instead") | ||
| # def SetWindowWord(hwnd, offset: int, val: int) -> int: ... | ||
| def ShellExecute(hwnd: int, op: str, file: str, params: str, _dir: str, bShow, /): ... | ||
| def ShowCursor(show, /): ... | ||
| def Sleep(time, bAlterable: int = ..., /): ... | ||
|
|
@@ -250,7 +259,9 @@ def UpdateResource( | |
| def VkKeyScan(char, char1, /): ... | ||
| def WinExec(cmdLine: str, arg, /) -> None: ... | ||
| def WinHelp(hwnd: int, hlpFile: str, cmd, data: str | int = ..., /) -> None: ... | ||
| @deprecated("This function is obsolete, applications should use the registry instead.") | ||
| def WriteProfileSection(section: str, data: str, iniName: str | None = ..., /): ... | ||
| @deprecated("This function is obsolete, applications should use the registry instead.") | ||
| def WriteProfileVal(section: str, entry: str, value: str, iniName: str | None = ..., /) -> None: ... | ||
| def HIBYTE(val: int, /) -> int: ... | ||
| def LOBYTE(val: int, /) -> int: ... | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.