Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
301 changes: 197 additions & 104 deletions stubs/pywin32/_win32typing.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 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, Sequence
from typing import Literal, NoReturn, SupportsIndex, TypeAlias, final, overload
from typing_extensions import Self, deprecated, disjoint_base
from typing import Literal, NoReturn, SupportsIndex, TypeAlias, TypedDict, final, overload
from typing_extensions import Never, Required, Self, deprecated, disjoint_base

from win32.lib.pywintypes import TimeType

Expand Down Expand Up @@ -116,15 +116,33 @@ class DOCINFO:

class ExportCallback: ...

class FORM_INFO_1:
@property
def Flags(self): ...
@property
def Name(self) -> str: ...
@property
def Size(self): ...
@property
def ImageableArea(self): ...
class PrinterExtents(TypedDict):
Length: int
Width: int

class PrinterDpi(TypedDict):
xdpi: int
ydpi: int

class PrinterPaperSize(TypedDict):
x: int
y: int

class SIZEL(TypedDict):
cx: int
cy: int

class RECTL(TypedDict):
bottom: int
left: int
right: int
top: int

class FORM_INFO_1(TypedDict):
Flags: int
Name: str
Size: SIZEL
ImageableArea: RECTL

class ImportCallback: ...

Expand Down Expand Up @@ -162,13 +180,166 @@ class NCB:
@property
def Post(self): ...

class PRINTER_DEFAULTS:
@property
def pDatatype(self) -> str: ...
@property
def pDevMode(self) -> PyDEVMODE: ...
@property
def DesiredAccess(self): ...
class PRINTER_DEFAULTS(TypedDict, total=False):
pDataType: str | None
pDevMode: PyDEVMODEW | None
DesiredAccess: Required[int]

class PRINTER_INFO_1(TypedDict):
Flags: int
pDescription: str
pName: str
pComment: str

PRINTER_INFO_1_TUPLE: TypeAlias = tuple[int, str, str, str]

class PRINTER_INFO_2(TypedDict):
Attributes: int
AveragePPM: int
DefaultPriority: int
Priority: int
StartTime: int
Status: int
UntilTime: int
cJobs: int
pComment: str | None
pDatatype: str | None
pDevMode: PyDEVMODEW | None
pDriverName: str
pLocation: str | None
pParameters: str | None
pPortName: str
pPrintProcessor: str
pPrinterName: str
pSecurityDescriptor: PySECURITY_DESCRIPTOR | None
pSepFile: str | None
pServerName: str | None
pShareName: str | None

PRINTER_INFO_2_TUPLE: TypeAlias = tuple[
str | None, # pServerName
str, # pPrinterName
str, # pShareName
str, # pPortName
str, # pDriverName
str, # pComment
str, # pLocation
None, # (always None)
str, # pSepFile
str, # pPrintProcessor
str, # pDatatype
str, # pParameters
None, # (always None)
int, # Attributes
int, # Priority
int, # DefaultPriority
int, # StartTime
int, # UntilTime
int, # Status
int, # cJobs
int, # AveragePPM
]

class PRINTER_INFO_3(TypedDict):
pSecurityDescriptor: PySECURITY_DESCRIPTOR

class PRINTER_INFO_4(TypedDict):
Attributes: int
pPrinterName: str
pServerName: str | None

class PRINTER_INFO_5(TypedDict):
Attributes: int
DeviceNotSelectedTimeout: int
TransmissionRetryTimeout: int
pPortName: str
pPrinterName: str

class PRINTER_INFO_6(TypedDict):
Status: int

class PRINTER_INFO_7(TypedDict):
Action: int
ObjectGUID: str | None

class PRINTER_INFO_8_9(TypedDict):
pDevMode: PyDEVMODEW | None

class JOB_INFO_1(TypedDict):
JobId: int
pPrinterName: str
pMachineName: str
pUserName: str
pDocument: str
pDatatype: str
pStatus: str | None
Status: int
Priority: int
Position: int
TotalPages: int
PagesPrinted: int
Submitted: TimeType

class JOB_INFO_2(JOB_INFO_1):
pNotifyName: str
pPrintProcessor: str
pParameters: str
pDriverName: str
pDevMode: PyDEVMODEW
pSecurityDescriptor: PySECURITY_DESCRIPTOR | None
StartTime: int
UntilTime: int
Size: int
Time: int

class JOB_INFO_3(TypedDict):
JobId: int
NextJobId: int
Reserved: int

class DRIVER_INFO_1(TypedDict):
Name: str

MONITOR_INFO_1: TypeAlias = DRIVER_INFO_1
PORT_INFO_1: TypeAlias = DRIVER_INFO_1

class MONITOR_INFO_2(MONITOR_INFO_1):
DLLName: str
Environment: str

class PORT_INFO_2(PORT_INFO_1):
Description: str
MonitorName: str
PortType: int
Reserved: int

class DRIVER_INFO_2(DRIVER_INFO_1):
ConfigFile: str
DataFile: str
DriverPath: str
Environment: str
Version: int

class DRIVER_INFO_3(DRIVER_INFO_2):
DefaultDataType: str | None
DependentFiles: list[str]
HelpFile: str | None
MonitorName: str | None

class DRIVER_INFO_4(DRIVER_INFO_3):
PreviousNames: str | None

class DRIVER_INFO_5(DRIVER_INFO_2):
ConfigVersion: int
DriverAttributes: int
DriverVersion: int

class DRIVER_INFO_6(DRIVER_INFO_4):
MfgName: str
OEMUrl: str | None
Provider: str
DriverDate: TimeType
DriverVersion: int

class PyACL:
def Initialize(self) -> None: ...
Expand Down Expand Up @@ -682,91 +853,10 @@ class PyDCB:
@property
def fDummy2(self) -> int: ...

class PyDEVMODE:
@property
def SpecVersion(self) -> int: ...
@property
def DriverVersion(self) -> int: ...
@property
def Size(self) -> int: ...
@property
def DriverExtra(self) -> int: ...
@property
def Fields(self) -> int: ...
@property
def Orientation(self) -> int: ...
@property
def PaperSize(self) -> int: ...
@property
def PaperLength(self) -> int: ...
@property
def PaperWidth(self) -> int: ...
@property
def Position_x(self) -> int: ...
@property
def Position_y(self) -> int: ...
@property
def DisplayOrientation(self) -> int: ...
@property
def DisplayFixedOutput(self) -> int: ...
@property
def Scale(self) -> int: ...
@property
def Copies(self) -> int: ...
@property
def DefaultSource(self) -> int: ...
@property
def PrintQuality(self) -> int: ...
@property
def Color(self) -> int: ...
@property
def Duplex(self) -> int: ...
@property
def YResolution(self) -> int: ...
@property
def TTOption(self) -> int: ...
@property
def Collate(self) -> int: ...
@property
def LogPixels(self) -> int: ...
@property
def BitsPerPel(self) -> int: ...
@property
def PelsWidth(self) -> int: ...
@property
def PelsHeight(self) -> int: ...
@property
def DisplayFlags(self) -> int: ...
@property
def DisplayFrequency(self) -> int: ...
@property
def ICMMethod(self) -> int: ...
@property
def ICMIntent(self) -> int: ...
@property
def MediaType(self) -> int: ...
@property
def DitherType(self) -> int: ...
@property
def Reserved1(self) -> int: ...
@property
def Reserved2(self) -> int: ...
@property
def Nup(self) -> int: ...
@property
def PanningWidth(self) -> int: ...
@property
def PanningHeight(self) -> int: ...
@property
def DeviceName(self) -> str: ...
@property
def FormName(self) -> str: ...
@property
def DriverData(self) -> Incomplete | None: ...
def Clear(self) -> None: ...

@disjoint_base
class PyDEVMODEW:
def __init__(self, DriverExtra: int = ...) -> None: ...
def __new__(self, DriverExtra: int = 0) -> Self: ...
def Clear(self) -> None: ...
SpecVersion: int
DriverVersion: int
@property
Expand Down Expand Up @@ -909,12 +999,15 @@ class PyGROUP_USERS_INFO_1:
class PyGdiHANDLE: ...
class PyGetSignerCertificate: ...

class PyHANDLE:
@disjoint_base
class PyHANDLE: # type: ignore[type-var]
def __new__(cls, *args: Never) -> NoReturn: ...
@property
def handle(self) -> int: ...
def Close(self) -> None: ...
def close(self) -> None: ...
def Detach(self) -> Self: ...
def __int__(self) -> int: ...

@final
class PyHDESK:
Expand Down Expand Up @@ -1247,7 +1340,7 @@ class PyPROFILEINFO:
class PyPerfMonManager:
def Close(self) -> None: ...

class PyPrinterHANDLE: ...
class PyPrinterHANDLE(PyHANDLE): ...
class PyRECT: ...
class PyResourceId: ...
class PySCROLLINFO: ...
Expand Down
21 changes: 7 additions & 14 deletions stubs/pywin32/win32/lib/pywintypes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from _typeshed import Incomplete
from collections.abc import Sequence
from datetime import datetime
from typing import ClassVar, Final, NoReturn, SupportsInt, overload
from typing_extensions import Never, deprecated, disjoint_base
from typing import ClassVar, Final, SupportsInt, overload
from typing_extensions import deprecated

import _win32typing

Expand All @@ -16,20 +16,13 @@ class error(Exception):

class com_error(Exception): ...

@disjoint_base
class HANDLEType: # type: ignore[type-var]
def __new__(cls, *args: Never) -> NoReturn: ...
@property
def handle(self) -> int: ...
def Close(self) -> None: ...
def close(self) -> None: ...
def Detach(self) -> None: ...
def __int__(self) -> int: ...

class TimeType(datetime): # aka: PyTime, PyDateTime
__name__: ClassVar[str] = "datetime"
Format = datetime.strftime
def Format(self, format: str = "%c") -> str: ...

HANDLEType = _win32typing.PyHANDLE
DEVMODEType = _win32typing.PyDEVMODEW
DEVMODEWType = _win32typing.PyDEVMODEW
IIDType = _win32typing.PyIID

def DosDateTimeToTime(FatDate: int, FatTime: int, /) -> TimeType: ...
Expand All @@ -43,7 +36,7 @@ def ACL(bufSize: int = ..., /) -> _win32typing.PyACL: ...
def SID(buffer, idAuthority, subAuthorities, bufSize=..., /) -> _win32typing.PySID: ...
def SECURITY_ATTRIBUTES() -> _win32typing.PySECURITY_ATTRIBUTES: ...
def SECURITY_DESCRIPTOR() -> _win32typing.PySECURITY_DESCRIPTOR: ...
def HANDLE() -> HANDLEType: ...
def HANDLE() -> _win32typing.PyHANDLE: ...
def HKEY() -> _win32typing.PyHKEY: ...
def WAVEFORMATEX() -> _win32typing.PyWAVEFORMATEX: ...
@overload
Expand Down
Loading
Loading