pywin32: Correctly reference TimeType aka pywintypes.datetime (#11577)

* Correctly reference TimeType

* PyUnicode is UnicodeType
This commit is contained in:
Avasam
2024-03-12 01:42:51 -04:00
committed by GitHub
parent a4cc79fbec
commit dea4dd1dc1
7 changed files with 44 additions and 64 deletions
+10 -8
View File
@@ -1,9 +1,9 @@
# Can't generate with stubgen because:
# "KeyError: 'pywintypes'"
# Can't generate with stubgen because `import pywintypes` must be called first.
# Otherwise you get the error: "KeyError: 'pywintypes'"
from _typeshed import Incomplete
from datetime import datetime
from typing import Literal, NoReturn, overload
from typing_extensions import Never, deprecated
from typing import ClassVar, Literal, NoReturn, overload
from typing_extensions import Never, TypeAlias, deprecated
import _win32typing
@@ -14,7 +14,8 @@ class error(Exception):
def __init__(self, winerror: int, funcname: str, strerror: str, /): ...
class com_error(Exception): ...
class UnicodeType(str): ...
UnicodeType: TypeAlias = str
class HANDLEType:
def __init__(self, *args: Never) -> NoReturn: ...
@@ -25,18 +26,19 @@ class HANDLEType:
def Detach(self) -> None: ...
def __int__(self) -> int: ...
class TimeType(datetime):
class TimeType(datetime): # aka: PyTime, PyDateTime
__name__: ClassVar[str] = "datetime"
Format = datetime.strftime
IIDType = _win32typing.PyIID
def DosDateTimeToTime() -> _win32typing.PyTime: ...
def DosDateTimeToTime() -> TimeType: ...
def Unicode() -> str: ...
def UnicodeFromRaw(_str: str, /) -> str: ...
def IsTextUnicode(_str: str, flags, /) -> tuple[Incomplete, Incomplete]: ...
def OVERLAPPED() -> _win32typing.PyOVERLAPPED: ...
def IID(iidString: str, is_bytes: bool = ..., /) -> _win32typing.PyIID: ...
def Time(timeRepr, /) -> _win32typing.PyTime: ...
def Time(timeRepr, /) -> TimeType: ...
def CreateGuid() -> _win32typing.PyIID: ...
def ACL(bufSize: int = ..., /) -> _win32typing.PyACL: ...
def SID(buffer, idAuthority, subAuthorities, bufSize=..., /) -> _win32typing.PySID: ...
+4 -4
View File
@@ -4,7 +4,7 @@ from typing import TypedDict
from typing_extensions import deprecated
import _win32typing
from win32.lib.pywintypes import error as error
from win32.lib.pywintypes import TimeType, error as error
class _MonitorInfo(TypedDict):
Monitor: tuple[int, int, int, int]
@@ -85,7 +85,7 @@ def GetCurrentThreadId(): ...
def GetCurrentProcessId(): ...
def GetCurrentProcess() -> int: ...
def GetConsoleTitle() -> str: ...
def GetDateFormat(locale, flags, time: _win32typing.PyTime, _format: str, /) -> str: ...
def GetDateFormat(locale, flags, time: TimeType, _format: str, /) -> str: ...
def GetDiskFreeSpace(rootPath: str, /): ...
def GetDiskFreeSpaceEx(rootPath: str, /) -> tuple[int, int, int]: ...
def GetDllDirectory() -> str: ...
@@ -134,7 +134,7 @@ def GetTempFileName(path: str, prefix: str, nUnique, /): ...
def GetTempPath() -> str: ...
def GetThreadLocale(): ...
def GetTickCount() -> int: ...
def GetTimeFormat(locale, flags, time: _win32typing.PyTime, _format: str, /) -> str: ...
def GetTimeFormat(locale, flags, time: TimeType, _format: str, /) -> str: ...
def GetTimeZoneInformation(times_as_tuples: bool = ..., /): ...
def GetVersion(): ...
def GetVersionEx(_format: int = ..., /): ...
@@ -223,7 +223,7 @@ def SetErrorMode(errorMode, /): ...
def SetFileAttributes(pathName: str, attrs, /): ...
def SetLastError(): ...
def SetSysColors(Elements, RgbValues, /) -> None: ...
def SetLocalTime(SystemTime: _win32typing.PyTime, /) -> None: ...
def SetLocalTime(SystemTime: TimeType, /) -> 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")
+6 -6
View File
@@ -4,7 +4,7 @@ from typing import overload
from typing_extensions import deprecated
import _win32typing
from win32.lib.pywintypes import error as error
from win32.lib.pywintypes import TimeType, error as error
def AreFileApisANSI(): ...
def CancelIo(handle: int, /) -> None: ...
@@ -44,13 +44,13 @@ def GetDriveTypeW(rootPathName: str, /): ...
def GetFileAttributes(fileName: str, /): ...
def GetFileAttributesW(fileName: str, /): ...
def GetFileTime(
handle: int, creationTime: _win32typing.PyTime, accessTime: _win32typing.PyTime, writeTime: _win32typing.PyTime, /
) -> tuple[_win32typing.PyTime, _win32typing.PyTime, _win32typing.PyTime]: ...
handle: int, creationTime: TimeType, accessTime: TimeType, writeTime: TimeType, /
) -> tuple[TimeType, TimeType, TimeType]: ...
def SetFileTime(
File: int,
CreationTime: _win32typing.PyTime | None = ...,
LastAccessTime: _win32typing.PyTime | None = ...,
LastWriteTime: _win32typing.PyTime | None = ...,
CreationTime: TimeType | None = ...,
LastAccessTime: TimeType | None = ...,
LastWriteTime: TimeType | None = ...,
UTCTimes: bool = ...,
) -> None: ...
def GetFileInformationByHandle(handle: int, /): ...
+3 -3
View File
@@ -1,7 +1,7 @@
from _typeshed import Incomplete
import _win32typing
from win32.lib.pywintypes import error as error
from win32.lib.pywintypes import TimeType, error as error
def InternetSetCookie(url: str, lpszCookieName: str, data: str, /) -> None: ...
def InternetGetCookie(Url: str, CookieName: str, /) -> str: ...
@@ -52,8 +52,8 @@ def CommitUrlCacheEntry(
UrlName,
LocalFileName,
CacheEntryType,
ExpireTime: _win32typing.PyTime | None = ...,
LastModifiedTime: _win32typing.PyTime | None = ...,
ExpireTime: TimeType | None = ...,
LastModifiedTime: TimeType | None = ...,
HeaderInfo: Incomplete | None = ...,
OriginalUrl: Incomplete | None = ...,
): ...
+4 -4
View File
@@ -3,7 +3,7 @@ from typing import overload
from typing_extensions import deprecated
import _win32typing
from win32.lib.pywintypes import error as error
from win32.lib.pywintypes import TimeType, error as error
def DsGetSpn(
ServiceType,
@@ -147,11 +147,11 @@ def LsaGetLogonSessionData(LogonId: int, /) -> tuple[Incomplete, ...]: ...
@deprecated("Support for passing two ints to create a 64-bit value is deprecated; pass a single int instead")
def AcquireCredentialsHandle(
Principal, Package, CredentialUse, LogonID: tuple[int, int], AuthData, /
) -> tuple[_win32typing.PyCredHandle, _win32typing.PyTime]: ...
) -> tuple[_win32typing.PyCredHandle, TimeType]: ...
@overload
def AcquireCredentialsHandle(
Principal, Package, CredentialUse, LogonID: int | None, AuthData, /
) -> tuple[_win32typing.PyCredHandle, _win32typing.PyTime]: ...
) -> tuple[_win32typing.PyCredHandle, TimeType]: ...
def InitializeSecurityContext(
Credential: _win32typing.PyCredHandle,
Context: _win32typing.PyCtxtHandle,
@@ -162,7 +162,7 @@ def InitializeSecurityContext(
NewContext: _win32typing.PyCtxtHandle,
pOutput: _win32typing.PySecBufferDesc,
/,
) -> tuple[Incomplete, Incomplete, _win32typing.PyTime]: ...
) -> tuple[Incomplete, Incomplete, TimeType]: ...
def AcceptSecurityContext(
Credential: _win32typing.PyCredHandle,
Context: _win32typing.PyCtxtHandle,