Add deprecation decorator and comments for pywin32#11570
Add deprecation decorator and comments for pywin32#11570JelleZijlstra merged 11 commits intopython:mainfrom
Conversation
| 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 |
There was a problem hiding this comment.
| NCBType = _win32typing.PyNCB | ||
| NETRESOURCE = _win32typing.PyNETRESOURCE | ||
| NCB = _win32typing.PyNCB | ||
| # old "deprecated" names, before types could create instances. |
There was a problem hiding this comment.
What's weird is that it seems to be the other way around everywhere else. Where ClassType is the reference type, and Class is a method that creates an instance of PyClass.
The exception to the rule I guess. 🤷
This comment has been minimized.
This comment has been minimized.
| def Read(self, cb, /) -> None: ... | ||
| def Seek(self, dlibMove: LARGE_INTEGER, dwOrigin, /) -> None: ... | ||
| @overload | ||
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") |
There was a problem hiding this comment.
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | |
| @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") |
| def ReadAt(self, ulOffset: ULARGE_INTEGER, cb, /) -> str: ... | ||
| def WriteAt(self, ulOffset: ULARGE_INTEGER, data: str, /): ... | ||
| @overload | ||
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") |
There was a problem hiding this comment.
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | |
| @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") |
| @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") |
There was a problem hiding this comment.
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | |
| @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") |
| def UnlockRegion(self, libOffset: ULARGE_INTEGER, cb: ULARGE_INTEGER, dwLockType, /) -> None: ... | ||
| def Stat(self, grfStatFlag, /) -> STATSTG: ... | ||
| @overload | ||
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") |
There was a problem hiding this comment.
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | |
| @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") |
| @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") |
There was a problem hiding this comment.
| @deprecated("Support for passing 2 integers to create a 64bit value is deprecated - pass an int instead") | |
| @deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead") |
Seems like this occurs a bunch more times, please change the remaining ones too
There was a problem hiding this comment.
Yeah I copied the string from source (almost) verbatim. Except I replaced long for int, so I don't mind changing it slightly further.
| 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.") |
There was a problem hiding this comment.
| @deprecated("MakeIID is deprecated - please use pywintypes.IID() instead.") | |
| @deprecated("Use pywintypes.IID() instead.") |
Type checker messages should already point out the name of the function
| def MakePyFactory(iid: _win32typing.PyIID, /) -> _win32typing.PyIClassFactory: ... | ||
| @deprecated("MakeIID is deprecated - please use pywintypes.IID() instead.") | ||
| def MakeIID(iidString: str, is_bytes: bool = ..., /) -> _win32typing.PyIID: ... | ||
| @deprecated("MakeTime is deprecated - please use pywintypes.Time() instead.") |
There was a problem hiding this comment.
| @deprecated("MakeTime is deprecated - please use pywintypes.Time() instead.") | |
| @deprecated("Use pywintypes.Time() instead.") |
| 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." |
There was a problem hiding this comment.
| "The use of addperfcounter by end-users is deprecated, since the use of addcounterbybrowsing is considerably more flexible and general." | |
| "Use addcounterbybrowsing instead." |
| class DispatcherOutputDebugString(DispatcherTrace): ... | ||
|
|
||
| class DispatcherWin32dbg(DispatcherBase): | ||
| @deprecated( |
There was a problem hiding this comment.
Should this be on the class instead?
There was a problem hiding this comment.
Oh yeah you can do that! Any usage of the class (even as type hint) appears as deprecated in Pylance. Sure.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
I searched and read the source for
deprecatandobsoletFixed the type of some methods I touched here. All typing changes are tested.