mirror of https://github.com/astral-sh/ruff
Sync Windows docstrings
This commit is contained in:
parent
a81d3f6ac1
commit
fc0a72ba1f
|
|
@ -31,22 +31,42 @@ if sys.platform == "win32":
|
||||||
_COMError_Details: TypeAlias = tuple[str | None, str | None, str | None, int | None, int | None]
|
_COMError_Details: TypeAlias = tuple[str | None, str | None, str | None, int | None, int | None]
|
||||||
|
|
||||||
class COMError(Exception):
|
class COMError(Exception):
|
||||||
|
"""Raised when a COM method call failed.
|
||||||
|
"""
|
||||||
hresult: int
|
hresult: int
|
||||||
text: str | None
|
text: str | None
|
||||||
details: _COMError_Details
|
details: _COMError_Details
|
||||||
|
|
||||||
def __init__(self, hresult: int, text: str | None, details: _COMError_Details) -> None: ...
|
def __init__(self, hresult: int, text: str | None, details: _COMError_Details) -> None: ...
|
||||||
|
|
||||||
def CopyComPointer(src: _PointerLike, dst: _PointerLike | _CArgObject) -> int: ...
|
def CopyComPointer(src: _PointerLike, dst: _PointerLike | _CArgObject) -> int:
|
||||||
|
"""CopyComPointer(src, dst) -> HRESULT value
|
||||||
|
"""
|
||||||
|
|
||||||
FUNCFLAG_HRESULT: Final = 0x2
|
FUNCFLAG_HRESULT: Final = 0x2
|
||||||
FUNCFLAG_STDCALL: Final = 0x0
|
FUNCFLAG_STDCALL: Final = 0x0
|
||||||
|
|
||||||
def FormatError(code: int = ...) -> str: ...
|
def FormatError(code: int = ...) -> str:
|
||||||
|
"""FormatError([integer]) -> string
|
||||||
|
|
||||||
|
Convert a win32 error code into a string. If the error code is not
|
||||||
|
given, the return value of a call to GetLastError() is used.
|
||||||
|
"""
|
||||||
def get_last_error() -> int: ...
|
def get_last_error() -> int: ...
|
||||||
def set_last_error(value: int) -> int: ...
|
def set_last_error(value: int) -> int: ...
|
||||||
def LoadLibrary(name: str, load_flags: int = 0, /) -> int: ...
|
def LoadLibrary(name: str, load_flags: int = 0, /) -> int:
|
||||||
def FreeLibrary(handle: int, /) -> None: ...
|
"""LoadLibrary(name, load_flags) -> handle
|
||||||
|
|
||||||
|
Load an executable (usually a DLL), and return a handle to it.
|
||||||
|
The handle may be used to locate exported functions in this
|
||||||
|
module. load_flags are as defined for LoadLibraryEx in the
|
||||||
|
Windows API.
|
||||||
|
"""
|
||||||
|
def FreeLibrary(handle: int, /) -> None:
|
||||||
|
"""FreeLibrary(handle) -> void
|
||||||
|
|
||||||
|
Free the handle of an executable previously loaded by LoadLibrary.
|
||||||
|
"""
|
||||||
|
|
||||||
else:
|
else:
|
||||||
def dlclose(handle: int, /) -> None:
|
def dlclose(handle: int, /) -> None:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
"""Documentation
|
||||||
|
"""
|
||||||
import sys
|
import sys
|
||||||
from typing import Final, type_check_only
|
from typing import Final, type_check_only
|
||||||
|
|
||||||
|
|
@ -51,10 +53,32 @@ if sys.platform == "win32":
|
||||||
__new__: None # type: ignore[assignment]
|
__new__: None # type: ignore[assignment]
|
||||||
__init__: None # type: ignore[assignment]
|
__init__: None # type: ignore[assignment]
|
||||||
|
|
||||||
def UuidCreate() -> str: ...
|
def UuidCreate() -> str:
|
||||||
def FCICreate(cabname: str, files: list[str], /) -> None: ...
|
"""Return the string representation of a new unique identifier.
|
||||||
def OpenDatabase(path: str, persist: int, /) -> _Database: ...
|
"""
|
||||||
def CreateRecord(count: int, /) -> _Record: ...
|
def FCICreate(cabname: str, files: list[str], /) -> None:
|
||||||
|
"""Create a new CAB file.
|
||||||
|
|
||||||
|
cabname
|
||||||
|
the name of the CAB file
|
||||||
|
files
|
||||||
|
a list of tuples, each containing the name of the file on disk,
|
||||||
|
and the name of the file inside the CAB file
|
||||||
|
"""
|
||||||
|
def OpenDatabase(path: str, persist: int, /) -> _Database:
|
||||||
|
"""Return a new database object.
|
||||||
|
|
||||||
|
path
|
||||||
|
the file name of the MSI file
|
||||||
|
persist
|
||||||
|
the persistence mode
|
||||||
|
"""
|
||||||
|
def CreateRecord(count: int, /) -> _Record:
|
||||||
|
"""Return a new record object.
|
||||||
|
|
||||||
|
count
|
||||||
|
the number of fields of the record
|
||||||
|
"""
|
||||||
|
|
||||||
MSICOLINFO_NAMES: Final[int]
|
MSICOLINFO_NAMES: Final[int]
|
||||||
MSICOLINFO_TYPES: Final[int]
|
MSICOLINFO_TYPES: Final[int]
|
||||||
|
|
|
||||||
|
|
@ -880,7 +880,14 @@ operations. A timeout of None indicates that timeouts on socket
|
||||||
operations are disabled.
|
operations are disabled.
|
||||||
"""
|
"""
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
def ioctl(self, control: int, option: int | tuple[int, int, int] | bool, /) -> None: ...
|
def ioctl(self, control: int, option: int | tuple[int, int, int] | bool, /) -> None:
|
||||||
|
"""ioctl(cmd, option) -> long
|
||||||
|
|
||||||
|
Control the socket with WSAIoctl syscall. Currently supported 'cmd' values are
|
||||||
|
SIO_RCVALL: 'option' must be one of the socket.RCVALL_* constants.
|
||||||
|
SIO_KEEPALIVE_VALS: 'option' is a tuple of (onoff, timeout, interval).
|
||||||
|
SIO_LOOPBACK_FAST_PATH: 'option' is a boolean value, and is disabled by default
|
||||||
|
"""
|
||||||
|
|
||||||
def listen(self, backlog: int = ..., /) -> None:
|
def listen(self, backlog: int = ..., /) -> None:
|
||||||
"""listen([backlog])
|
"""listen([backlog])
|
||||||
|
|
@ -1070,7 +1077,14 @@ None, optlen.
|
||||||
@overload
|
@overload
|
||||||
def setsockopt(self, level: int, optname: int, value: None, optlen: int, /) -> None: ...
|
def setsockopt(self, level: int, optname: int, value: None, optlen: int, /) -> None: ...
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
def share(self, process_id: int, /) -> bytes: ...
|
def share(self, process_id: int, /) -> bytes:
|
||||||
|
"""share(process_id) -> bytes
|
||||||
|
|
||||||
|
Share the socket with another process. The target process id
|
||||||
|
must be provided and the resulting bytes object passed to the target
|
||||||
|
process. There the shared socket can be instantiated by calling
|
||||||
|
socket.fromshare().
|
||||||
|
"""
|
||||||
|
|
||||||
def shutdown(self, how: int, /) -> None:
|
def shutdown(self, how: int, /) -> None:
|
||||||
"""shutdown(flag)
|
"""shutdown(flag)
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,23 @@ The values are 'cert_file_env', 'cert_file', 'cert_dir_env', 'cert_dir'.
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
_EnumRetType: TypeAlias = list[tuple[bytes, str, set[str] | bool]]
|
_EnumRetType: TypeAlias = list[tuple[bytes, str, set[str] | bool]]
|
||||||
def enum_certificates(store_name: str) -> _EnumRetType: ...
|
def enum_certificates(store_name: str) -> _EnumRetType:
|
||||||
def enum_crls(store_name: str) -> _EnumRetType: ...
|
"""Retrieve certificates from Windows' cert store.
|
||||||
|
|
||||||
|
store_name may be one of 'CA', 'ROOT' or 'MY'. The system may provide
|
||||||
|
more cert storages, too. The function returns a list of (bytes,
|
||||||
|
encoding_type, trust) tuples. The encoding_type flag can be interpreted
|
||||||
|
with X509_ASN_ENCODING or PKCS_7_ASN_ENCODING. The trust setting is either
|
||||||
|
a set of OIDs or the boolean True.
|
||||||
|
"""
|
||||||
|
def enum_crls(store_name: str) -> _EnumRetType:
|
||||||
|
"""Retrieve CRLs from Windows' cert store.
|
||||||
|
|
||||||
|
store_name may be one of 'CA', 'ROOT' or 'MY'. The system may provide
|
||||||
|
more cert storages, too. The function returns a list of (bytes,
|
||||||
|
encoding_type) tuples. The encoding_type flag can be interpreted with
|
||||||
|
X509_ASN_ENCODING or PKCS_7_ASN_ENCODING.
|
||||||
|
"""
|
||||||
|
|
||||||
def txt2obj(txt: str, name: bool = False) -> tuple[int, str, str, str]:
|
def txt2obj(txt: str, name: bool = False) -> tuple[int, str, str, str]:
|
||||||
"""Lookup NID, short name, long name and OID of an ASN1_OBJECT.
|
"""Lookup NID, short name, long name and OID of an ASN1_OBJECT.
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,9 @@ if sys.platform == "win32":
|
||||||
if sys.version_info >= (3, 14):
|
if sys.version_info >= (3, 14):
|
||||||
COPY_FILE_DIRECTORY: Final = 0x00000080
|
COPY_FILE_DIRECTORY: Final = 0x00000080
|
||||||
|
|
||||||
def CloseHandle(handle: int, /) -> None: ...
|
def CloseHandle(handle: int, /) -> None:
|
||||||
|
"""Close handle.
|
||||||
|
"""
|
||||||
@overload
|
@overload
|
||||||
def ConnectNamedPipe(handle: int, overlapped: Literal[True]) -> Overlapped: ...
|
def ConnectNamedPipe(handle: int, overlapped: Literal[True]) -> Overlapped: ...
|
||||||
@overload
|
@overload
|
||||||
|
|
@ -207,7 +209,14 @@ if sys.platform == "win32":
|
||||||
security_attributes: int,
|
security_attributes: int,
|
||||||
/,
|
/,
|
||||||
) -> int: ...
|
) -> int: ...
|
||||||
def CreatePipe(pipe_attrs: Any, size: int, /) -> tuple[int, int]: ...
|
def CreatePipe(pipe_attrs: Any, size: int, /) -> tuple[int, int]:
|
||||||
|
"""Create an anonymous pipe.
|
||||||
|
|
||||||
|
pipe_attrs
|
||||||
|
Ignored internally, can be None.
|
||||||
|
|
||||||
|
Returns a 2-tuple of handles, to the read and write ends of the pipe.
|
||||||
|
"""
|
||||||
def CreateProcess(
|
def CreateProcess(
|
||||||
application_name: str | None,
|
application_name: str | None,
|
||||||
command_line: str | None,
|
command_line: str | None,
|
||||||
|
|
@ -219,7 +228,19 @@ if sys.platform == "win32":
|
||||||
current_directory: str | None,
|
current_directory: str | None,
|
||||||
startup_info: Any,
|
startup_info: Any,
|
||||||
/,
|
/,
|
||||||
) -> tuple[int, int, int, int]: ...
|
) -> tuple[int, int, int, int]:
|
||||||
|
"""Create a new process and its primary thread.
|
||||||
|
|
||||||
|
command_line
|
||||||
|
Can be str or None
|
||||||
|
proc_attrs
|
||||||
|
Ignored internally, can be None.
|
||||||
|
thread_attrs
|
||||||
|
Ignored internally, can be None.
|
||||||
|
|
||||||
|
The return value is a tuple of the process handle, thread handle,
|
||||||
|
process ID, and thread ID.
|
||||||
|
"""
|
||||||
def DuplicateHandle(
|
def DuplicateHandle(
|
||||||
source_process_handle: int,
|
source_process_handle: int,
|
||||||
source_handle: int,
|
source_handle: int,
|
||||||
|
|
@ -228,16 +249,46 @@ if sys.platform == "win32":
|
||||||
inherit_handle: bool,
|
inherit_handle: bool,
|
||||||
options: int = 0,
|
options: int = 0,
|
||||||
/,
|
/,
|
||||||
) -> int: ...
|
) -> int:
|
||||||
|
"""Return a duplicate handle object.
|
||||||
|
|
||||||
|
The duplicate handle refers to the same object as the original
|
||||||
|
handle. Therefore, any changes to the object are reflected
|
||||||
|
through both handles.
|
||||||
|
"""
|
||||||
def ExitProcess(ExitCode: int, /) -> NoReturn: ...
|
def ExitProcess(ExitCode: int, /) -> NoReturn: ...
|
||||||
def GetACP() -> int: ...
|
def GetACP() -> int:
|
||||||
|
"""Get the current Windows ANSI code page identifier.
|
||||||
|
"""
|
||||||
def GetFileType(handle: int) -> int: ...
|
def GetFileType(handle: int) -> int: ...
|
||||||
def GetCurrentProcess() -> int: ...
|
def GetCurrentProcess() -> int:
|
||||||
def GetExitCodeProcess(process: int, /) -> int: ...
|
"""Return a handle object for the current process.
|
||||||
|
"""
|
||||||
|
def GetExitCodeProcess(process: int, /) -> int:
|
||||||
|
"""Return the termination status of the specified process.
|
||||||
|
"""
|
||||||
def GetLastError() -> int: ...
|
def GetLastError() -> int: ...
|
||||||
def GetModuleFileName(module_handle: int, /) -> str: ...
|
def GetModuleFileName(module_handle: int, /) -> str:
|
||||||
def GetStdHandle(std_handle: int, /) -> int: ...
|
"""Return the fully-qualified path for the file that contains module.
|
||||||
def GetVersion() -> int: ...
|
|
||||||
|
The module must have been loaded by the current process.
|
||||||
|
|
||||||
|
The module parameter should be a handle to the loaded module
|
||||||
|
whose path is being requested. If this parameter is 0,
|
||||||
|
GetModuleFileName retrieves the path of the executable file
|
||||||
|
of the current process.
|
||||||
|
"""
|
||||||
|
def GetStdHandle(std_handle: int, /) -> int:
|
||||||
|
"""Return a handle to the specified standard device.
|
||||||
|
|
||||||
|
std_handle
|
||||||
|
One of STD_INPUT_HANDLE, STD_OUTPUT_HANDLE, or STD_ERROR_HANDLE.
|
||||||
|
|
||||||
|
The integer associated with the handle object is returned.
|
||||||
|
"""
|
||||||
|
def GetVersion() -> int:
|
||||||
|
"""Return the version number of the current operating system.
|
||||||
|
"""
|
||||||
def MapViewOfFile(
|
def MapViewOfFile(
|
||||||
file_map: int, desired_access: int, file_offset_high: int, file_offset_low: int, number_bytes: int, /
|
file_map: int, desired_access: int, file_offset_high: int, file_offset_low: int, number_bytes: int, /
|
||||||
) -> int: ...
|
) -> int: ...
|
||||||
|
|
@ -256,10 +307,18 @@ if sys.platform == "win32":
|
||||||
def SetNamedPipeHandleState(
|
def SetNamedPipeHandleState(
|
||||||
named_pipe: int, mode: int | None, max_collection_count: int | None, collect_data_timeout: int | None, /
|
named_pipe: int, mode: int | None, max_collection_count: int | None, collect_data_timeout: int | None, /
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def TerminateProcess(handle: int, exit_code: int, /) -> None: ...
|
def TerminateProcess(handle: int, exit_code: int, /) -> None:
|
||||||
|
"""Terminate the specified process and all of its threads.
|
||||||
|
"""
|
||||||
def VirtualQuerySize(address: int, /) -> int: ...
|
def VirtualQuerySize(address: int, /) -> int: ...
|
||||||
def WaitForMultipleObjects(handle_seq: Sequence[int], wait_flag: bool, milliseconds: int = 0xFFFFFFFF, /) -> int: ...
|
def WaitForMultipleObjects(handle_seq: Sequence[int], wait_flag: bool, milliseconds: int = 0xFFFFFFFF, /) -> int: ...
|
||||||
def WaitForSingleObject(handle: int, milliseconds: int, /) -> int: ...
|
def WaitForSingleObject(handle: int, milliseconds: int, /) -> int:
|
||||||
|
"""Wait for a single object.
|
||||||
|
|
||||||
|
Wait until the specified object is in the signaled state or
|
||||||
|
the time-out interval elapses. The timeout value is specified
|
||||||
|
in milliseconds.
|
||||||
|
"""
|
||||||
def WaitNamedPipe(name: str, timeout: int, /) -> None: ...
|
def WaitNamedPipe(name: str, timeout: int, /) -> None: ...
|
||||||
@overload
|
@overload
|
||||||
def WriteFile(handle: int, buffer: ReadableBuffer, overlapped: Literal[True]) -> tuple[Overlapped, int]: ...
|
def WriteFile(handle: int, buffer: ReadableBuffer, overlapped: Literal[True]) -> tuple[Overlapped, int]: ...
|
||||||
|
|
@ -269,6 +328,8 @@ if sys.platform == "win32":
|
||||||
def WriteFile(handle: int, buffer: ReadableBuffer, overlapped: int | bool) -> tuple[Any, int]: ...
|
def WriteFile(handle: int, buffer: ReadableBuffer, overlapped: int | bool) -> tuple[Any, int]: ...
|
||||||
@final
|
@final
|
||||||
class Overlapped:
|
class Overlapped:
|
||||||
|
"""OVERLAPPED structure wrapper
|
||||||
|
"""
|
||||||
event: int
|
event: int
|
||||||
def GetOverlappedResult(self, wait: bool, /) -> tuple[int, int]: ...
|
def GetOverlappedResult(self, wait: bool, /) -> tuple[int, int]: ...
|
||||||
def cancel(self) -> None: ...
|
def cancel(self) -> None: ...
|
||||||
|
|
@ -277,11 +338,40 @@ if sys.platform == "win32":
|
||||||
if sys.version_info >= (3, 13):
|
if sys.version_info >= (3, 13):
|
||||||
def BatchedWaitForMultipleObjects(
|
def BatchedWaitForMultipleObjects(
|
||||||
handle_seq: Sequence[int], wait_all: bool, milliseconds: int = 0xFFFFFFFF
|
handle_seq: Sequence[int], wait_all: bool, milliseconds: int = 0xFFFFFFFF
|
||||||
) -> list[int]: ...
|
) -> list[int]:
|
||||||
|
"""Supports a larger number of handles than WaitForMultipleObjects
|
||||||
|
|
||||||
|
Note that the handles may be waited on other threads, which could cause
|
||||||
|
issues for objects like mutexes that become associated with the thread
|
||||||
|
that was waiting for them. Objects may also be left signalled, even if
|
||||||
|
the wait fails.
|
||||||
|
|
||||||
|
It is recommended to use WaitForMultipleObjects whenever possible, and
|
||||||
|
only switch to BatchedWaitForMultipleObjects for scenarios where you
|
||||||
|
control all the handles involved, such as your own thread pool or
|
||||||
|
files, and all wait objects are left unmodified by a wait (for example,
|
||||||
|
manual reset events, threads, and files/pipes).
|
||||||
|
|
||||||
|
Overlapped handles returned from this module use manual reset events.
|
||||||
|
"""
|
||||||
def CreateEventW(security_attributes: int, manual_reset: bool, initial_state: bool, name: str | None) -> int: ...
|
def CreateEventW(security_attributes: int, manual_reset: bool, initial_state: bool, name: str | None) -> int: ...
|
||||||
def CreateMutexW(security_attributes: int, initial_owner: bool, name: str) -> int: ...
|
def CreateMutexW(security_attributes: int, initial_owner: bool, name: str) -> int: ...
|
||||||
def GetLongPathName(path: str) -> str: ...
|
def GetLongPathName(path: str) -> str:
|
||||||
def GetShortPathName(path: str) -> str: ...
|
"""Return the long version of the provided path.
|
||||||
|
|
||||||
|
If the path is already in its long form, returns the same value.
|
||||||
|
|
||||||
|
The path must already be a 'str'. If the type is not known, use
|
||||||
|
os.fsdecode before calling this function.
|
||||||
|
"""
|
||||||
|
def GetShortPathName(path: str) -> str:
|
||||||
|
"""Return the short version of the provided path.
|
||||||
|
|
||||||
|
If the path is already in its short form, returns the same value.
|
||||||
|
|
||||||
|
The path must already be a 'str'. If the type is not known, use
|
||||||
|
os.fsdecode before calling this function.
|
||||||
|
"""
|
||||||
def OpenEventW(desired_access: int, inherit_handle: bool, name: str) -> int: ...
|
def OpenEventW(desired_access: int, inherit_handle: bool, name: str) -> int: ...
|
||||||
def OpenMutexW(desired_access: int, inherit_handle: bool, name: str) -> int: ...
|
def OpenMutexW(desired_access: int, inherit_handle: bool, name: str) -> int: ...
|
||||||
def ReleaseMutex(mutex: int) -> None: ...
|
def ReleaseMutex(mutex: int) -> None: ...
|
||||||
|
|
@ -291,5 +381,13 @@ if sys.platform == "win32":
|
||||||
def OpenFileMapping(desired_access: int, inherit_handle: bool, name: str, /) -> int: ...
|
def OpenFileMapping(desired_access: int, inherit_handle: bool, name: str, /) -> int: ...
|
||||||
|
|
||||||
if sys.version_info >= (3, 12):
|
if sys.version_info >= (3, 12):
|
||||||
def CopyFile2(existing_file_name: str, new_file_name: str, flags: int, progress_routine: int | None = None) -> int: ...
|
def CopyFile2(existing_file_name: str, new_file_name: str, flags: int, progress_routine: int | None = None) -> int:
|
||||||
|
"""Copies a file from one name to a new name.
|
||||||
|
|
||||||
|
This is implemented using the CopyFile2 API, which preserves all stat
|
||||||
|
and metadata information apart from security attributes.
|
||||||
|
|
||||||
|
progress_routine is reserved for future use, but is currently not
|
||||||
|
implemented. Its value is ignored.
|
||||||
|
"""
|
||||||
def NeedCurrentDirectoryForExePath(exe_name: str, /) -> bool: ...
|
def NeedCurrentDirectoryForExePath(exe_name: str, /) -> bool: ...
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
"""Selector and proactor event loops for Windows.
|
||||||
|
"""
|
||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
from _typeshed import Incomplete, ReadableBuffer, WriteableBuffer
|
from _typeshed import Incomplete, ReadableBuffer, WriteableBuffer
|
||||||
|
|
@ -47,14 +49,22 @@ if sys.platform == "win32":
|
||||||
CONNECT_PIPE_MAX_DELAY: float
|
CONNECT_PIPE_MAX_DELAY: float
|
||||||
|
|
||||||
class PipeServer:
|
class PipeServer:
|
||||||
|
"""Class representing a pipe server.
|
||||||
|
|
||||||
|
This is much like a bound, listening socket.
|
||||||
|
"""
|
||||||
def __init__(self, address: str) -> None: ...
|
def __init__(self, address: str) -> None: ...
|
||||||
def __del__(self) -> None: ...
|
def __del__(self) -> None: ...
|
||||||
def closed(self) -> bool: ...
|
def closed(self) -> bool: ...
|
||||||
def close(self) -> None: ...
|
def close(self) -> None: ...
|
||||||
|
|
||||||
class _WindowsSelectorEventLoop(selector_events.BaseSelectorEventLoop): ...
|
class _WindowsSelectorEventLoop(selector_events.BaseSelectorEventLoop):
|
||||||
|
"""Windows version of selector event loop.
|
||||||
|
"""
|
||||||
|
|
||||||
class ProactorEventLoop(proactor_events.BaseProactorEventLoop):
|
class ProactorEventLoop(proactor_events.BaseProactorEventLoop):
|
||||||
|
"""Windows version of proactor event loop using IOCP.
|
||||||
|
"""
|
||||||
def __init__(self, proactor: IocpProactor | None = None) -> None: ...
|
def __init__(self, proactor: IocpProactor | None = None) -> None: ...
|
||||||
async def create_pipe_connection(
|
async def create_pipe_connection(
|
||||||
self, protocol_factory: Callable[[], streams.StreamReaderProtocol], address: str
|
self, protocol_factory: Callable[[], streams.StreamReaderProtocol], address: str
|
||||||
|
|
@ -64,6 +74,8 @@ if sys.platform == "win32":
|
||||||
) -> list[PipeServer]: ...
|
) -> list[PipeServer]: ...
|
||||||
|
|
||||||
class IocpProactor:
|
class IocpProactor:
|
||||||
|
"""Proactor implementation using IOCP.
|
||||||
|
"""
|
||||||
def __init__(self, concurrency: int = 0xFFFFFFFF) -> None: ...
|
def __init__(self, concurrency: int = 0xFFFFFFFF) -> None: ...
|
||||||
def __del__(self) -> None: ...
|
def __del__(self) -> None: ...
|
||||||
def set_loop(self, loop: events.AbstractEventLoop) -> None: ...
|
def set_loop(self, loop: events.AbstractEventLoop) -> None: ...
|
||||||
|
|
@ -86,7 +98,12 @@ if sys.platform == "win32":
|
||||||
def sendfile(self, sock: socket.socket, file: IO[bytes], offset: int, count: int) -> futures.Future[Any]: ...
|
def sendfile(self, sock: socket.socket, file: IO[bytes], offset: int, count: int) -> futures.Future[Any]: ...
|
||||||
def accept_pipe(self, pipe: socket.socket) -> futures.Future[Any]: ...
|
def accept_pipe(self, pipe: socket.socket) -> futures.Future[Any]: ...
|
||||||
async def connect_pipe(self, address: str) -> windows_utils.PipeHandle: ...
|
async def connect_pipe(self, address: str) -> windows_utils.PipeHandle: ...
|
||||||
def wait_for_handle(self, handle: windows_utils.PipeHandle, timeout: int | None = None) -> bool: ...
|
def wait_for_handle(self, handle: windows_utils.PipeHandle, timeout: int | None = None) -> bool:
|
||||||
|
"""Wait for a handle.
|
||||||
|
|
||||||
|
Return a Future object. The result of the future is True if the wait
|
||||||
|
completed, or False if the wait did not complete (on timeout).
|
||||||
|
"""
|
||||||
def close(self) -> None: ...
|
def close(self) -> None: ...
|
||||||
if sys.version_info >= (3, 11):
|
if sys.version_info >= (3, 11):
|
||||||
def recvfrom_into(
|
def recvfrom_into(
|
||||||
|
|
@ -105,13 +122,21 @@ if sys.platform == "win32":
|
||||||
else:
|
else:
|
||||||
class WindowsSelectorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
|
class WindowsSelectorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
|
||||||
_loop_factory: ClassVar[type[SelectorEventLoop]]
|
_loop_factory: ClassVar[type[SelectorEventLoop]]
|
||||||
def get_child_watcher(self) -> NoReturn: ...
|
def get_child_watcher(self) -> NoReturn:
|
||||||
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
|
"""Get the watcher for child processes.
|
||||||
|
"""
|
||||||
|
def set_child_watcher(self, watcher: Any) -> NoReturn:
|
||||||
|
"""Set the watcher for child processes.
|
||||||
|
"""
|
||||||
|
|
||||||
class WindowsProactorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
|
class WindowsProactorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
|
||||||
_loop_factory: ClassVar[type[ProactorEventLoop]]
|
_loop_factory: ClassVar[type[ProactorEventLoop]]
|
||||||
def get_child_watcher(self) -> NoReturn: ...
|
def get_child_watcher(self) -> NoReturn:
|
||||||
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
|
"""Get the watcher for child processes.
|
||||||
|
"""
|
||||||
|
def set_child_watcher(self, watcher: Any) -> NoReturn:
|
||||||
|
"""Set the watcher for child processes.
|
||||||
|
"""
|
||||||
|
|
||||||
if sys.version_info >= (3, 14):
|
if sys.version_info >= (3, 14):
|
||||||
_DefaultEventLoopPolicy = _WindowsProactorEventLoopPolicy
|
_DefaultEventLoopPolicy = _WindowsProactorEventLoopPolicy
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
"""Various Windows specific bits and pieces.
|
||||||
|
"""
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
|
|
@ -11,9 +13,15 @@ if sys.platform == "win32":
|
||||||
BUFSIZE: Final = 8192
|
BUFSIZE: Final = 8192
|
||||||
PIPE: Final = subprocess.PIPE
|
PIPE: Final = subprocess.PIPE
|
||||||
STDOUT: Final = subprocess.STDOUT
|
STDOUT: Final = subprocess.STDOUT
|
||||||
def pipe(*, duplex: bool = False, overlapped: tuple[bool, bool] = (True, True), bufsize: int = 8192) -> tuple[int, int]: ...
|
def pipe(*, duplex: bool = False, overlapped: tuple[bool, bool] = (True, True), bufsize: int = 8192) -> tuple[int, int]:
|
||||||
|
"""Like os.pipe() but with overlapped support and using handles not fds.
|
||||||
|
"""
|
||||||
|
|
||||||
class PipeHandle:
|
class PipeHandle:
|
||||||
|
"""Wrapper for an overlapped pipe handle which is vaguely file-object like.
|
||||||
|
|
||||||
|
The IOCP event loop can use these instead of socket objects.
|
||||||
|
"""
|
||||||
def __init__(self, handle: int) -> None: ...
|
def __init__(self, handle: int) -> None: ...
|
||||||
def __del__(self) -> None: ...
|
def __del__(self) -> None: ...
|
||||||
def __enter__(self) -> Self: ...
|
def __enter__(self) -> Self: ...
|
||||||
|
|
@ -24,6 +32,10 @@ if sys.platform == "win32":
|
||||||
def close(self, *, CloseHandle: Callable[[int], object] = ...) -> None: ...
|
def close(self, *, CloseHandle: Callable[[int], object] = ...) -> None: ...
|
||||||
|
|
||||||
class Popen(subprocess.Popen[AnyStr]):
|
class Popen(subprocess.Popen[AnyStr]):
|
||||||
|
"""Replacement for subprocess.Popen using overlapped pipe handles.
|
||||||
|
|
||||||
|
The stdin, stdout, stderr are None or instances of PipeHandle.
|
||||||
|
"""
|
||||||
stdin: PipeHandle | None # type: ignore[assignment]
|
stdin: PipeHandle | None # type: ignore[assignment]
|
||||||
stdout: PipeHandle | None # type: ignore[assignment]
|
stdout: PipeHandle | None # type: ignore[assignment]
|
||||||
stderr: PipeHandle | None # type: ignore[assignment]
|
stderr: PipeHandle | None # type: ignore[assignment]
|
||||||
|
|
|
||||||
|
|
@ -121,8 +121,16 @@ reacquires it afterwards.
|
||||||
def __getitem__(self, name_or_ordinal: str) -> _NamedFuncPointer: ...
|
def __getitem__(self, name_or_ordinal: str) -> _NamedFuncPointer: ...
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
class OleDLL(CDLL): ...
|
class OleDLL(CDLL):
|
||||||
class WinDLL(CDLL): ...
|
"""This class represents a dll exporting functions using the
|
||||||
|
Windows stdcall calling convention, and returning HRESULT.
|
||||||
|
HRESULT error values are automatically raised as OSError
|
||||||
|
exceptions.
|
||||||
|
"""
|
||||||
|
class WinDLL(CDLL):
|
||||||
|
"""This class represents a dll exporting functions using the
|
||||||
|
Windows stdcall calling convention.
|
||||||
|
"""
|
||||||
|
|
||||||
class PyDLL(CDLL):
|
class PyDLL(CDLL):
|
||||||
"""This class represents the Python library itself. It allows
|
"""This class represents the Python library itself. It allows
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@ import sys
|
||||||
def find_library(name: str) -> str | None: ...
|
def find_library(name: str) -> str | None: ...
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
def find_msvcrt() -> str | None: ...
|
def find_msvcrt() -> str | None:
|
||||||
|
"""Return the name of the VC runtime dll
|
||||||
|
"""
|
||||||
|
|
||||||
if sys.version_info >= (3, 14):
|
if sys.version_info >= (3, 14):
|
||||||
def dllist() -> list[str]:
|
def dllist() -> list[str]:
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,11 @@
|
||||||
|
"""distutils._msvccompiler
|
||||||
|
|
||||||
|
Contains MSVCCompiler, an implementation of the abstract CCompiler class
|
||||||
|
for Microsoft Visual Studio 2015.
|
||||||
|
|
||||||
|
The module is compatible with VS 2015 and later. You can find legacy support
|
||||||
|
for older versions in distutils.msvc9compiler and distutils.msvccompiler.
|
||||||
|
"""
|
||||||
from _typeshed import Incomplete
|
from _typeshed import Incomplete
|
||||||
from distutils.ccompiler import CCompiler
|
from distutils.ccompiler import CCompiler
|
||||||
from typing import ClassVar, Final
|
from typing import ClassVar, Final
|
||||||
|
|
@ -6,6 +14,9 @@ PLAT_SPEC_TO_RUNTIME: Final[dict[str, str]]
|
||||||
PLAT_TO_VCVARS: Final[dict[str, str]]
|
PLAT_TO_VCVARS: Final[dict[str, str]]
|
||||||
|
|
||||||
class MSVCCompiler(CCompiler):
|
class MSVCCompiler(CCompiler):
|
||||||
|
"""Concrete class that implements an interface to Microsoft Visual C++,
|
||||||
|
as defined by the CCompiler abstract class.
|
||||||
|
"""
|
||||||
compiler_type: ClassVar[str]
|
compiler_type: ClassVar[str]
|
||||||
executables: ClassVar[dict[Incomplete, Incomplete]]
|
executables: ClassVar[dict[Incomplete, Incomplete]]
|
||||||
res_extension: ClassVar[str]
|
res_extension: ClassVar[str]
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
"""
|
||||||
|
Implements the bdist_msi command.
|
||||||
|
"""
|
||||||
import sys
|
import sys
|
||||||
from _typeshed import Incomplete
|
from _typeshed import Incomplete
|
||||||
from typing import ClassVar, Literal
|
from typing import ClassVar, Literal
|
||||||
|
|
@ -8,12 +11,42 @@ if sys.platform == "win32":
|
||||||
from msilib import Control, Dialog
|
from msilib import Control, Dialog
|
||||||
|
|
||||||
class PyDialog(Dialog):
|
class PyDialog(Dialog):
|
||||||
def __init__(self, *args, **kw) -> None: ...
|
"""Dialog class with a fixed layout: controls at the top, then a ruler,
|
||||||
def title(self, title) -> None: ...
|
then a list of buttons: back, next, cancel. Optionally a bitmap at the
|
||||||
def back(self, title, next, name: str = "Back", active: bool | Literal[0, 1] = 1) -> Control: ...
|
left.
|
||||||
def cancel(self, title, next, name: str = "Cancel", active: bool | Literal[0, 1] = 1) -> Control: ...
|
"""
|
||||||
def next(self, title, next, name: str = "Next", active: bool | Literal[0, 1] = 1) -> Control: ...
|
def __init__(self, *args, **kw) -> None:
|
||||||
def xbutton(self, name, title, next, xpos) -> Control: ...
|
"""Dialog(database, name, x, y, w, h, attributes, title, first,
|
||||||
|
default, cancel, bitmap=true)
|
||||||
|
"""
|
||||||
|
def title(self, title) -> None:
|
||||||
|
"""Set the title text of the dialog at the top.
|
||||||
|
"""
|
||||||
|
def back(self, title, next, name: str = "Back", active: bool | Literal[0, 1] = 1) -> Control:
|
||||||
|
"""Add a back button with a given title, the tab-next button,
|
||||||
|
its name in the Control table, possibly initially disabled.
|
||||||
|
|
||||||
|
Return the button, so that events can be associated
|
||||||
|
"""
|
||||||
|
def cancel(self, title, next, name: str = "Cancel", active: bool | Literal[0, 1] = 1) -> Control:
|
||||||
|
"""Add a cancel button with a given title, the tab-next button,
|
||||||
|
its name in the Control table, possibly initially disabled.
|
||||||
|
|
||||||
|
Return the button, so that events can be associated
|
||||||
|
"""
|
||||||
|
def next(self, title, next, name: str = "Next", active: bool | Literal[0, 1] = 1) -> Control:
|
||||||
|
"""Add a Next button with a given title, the tab-next button,
|
||||||
|
its name in the Control table, possibly initially disabled.
|
||||||
|
|
||||||
|
Return the button, so that events can be associated
|
||||||
|
"""
|
||||||
|
def xbutton(self, name, title, next, xpos) -> Control:
|
||||||
|
"""Add a button with a given title, the tab-next button,
|
||||||
|
its name in the Control table, giving its x position; the
|
||||||
|
y-position is aligned with the other buttons.
|
||||||
|
|
||||||
|
Return the button, so that events can be associated
|
||||||
|
"""
|
||||||
|
|
||||||
class bdist_msi(Command):
|
class bdist_msi(Command):
|
||||||
description: str
|
description: str
|
||||||
|
|
@ -39,7 +72,17 @@ if sys.platform == "win32":
|
||||||
db: Incomplete
|
db: Incomplete
|
||||||
def run(self) -> None: ...
|
def run(self) -> None: ...
|
||||||
def add_files(self) -> None: ...
|
def add_files(self) -> None: ...
|
||||||
def add_find_python(self) -> None: ...
|
def add_find_python(self) -> None:
|
||||||
|
"""Adds code to the installer to compute the location of Python.
|
||||||
|
|
||||||
|
Properties PYTHON.MACHINE.X.Y and PYTHON.USER.X.Y will be set from the
|
||||||
|
registry for each version of Python.
|
||||||
|
|
||||||
|
Properties TARGETDIRX.Y will be set from PYTHON.USER.X.Y if defined,
|
||||||
|
else from PYTHON.MACHINE.X.Y.
|
||||||
|
|
||||||
|
Properties PYTHONX.Y will be set to TARGETDIRX.Y\\python.exe
|
||||||
|
"""
|
||||||
def add_scripts(self) -> None: ...
|
def add_scripts(self) -> None: ...
|
||||||
def add_ui(self) -> None: ...
|
def add_ui(self) -> None: ...
|
||||||
def get_installer_filename(self, fullname): ...
|
def get_installer_filename(self, fullname): ...
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,12 @@
|
||||||
|
"""Python 'mbcs' Codec for Windows
|
||||||
|
|
||||||
|
|
||||||
|
Cloned by Mark Hammond (mhammond@skippinet.com.au) from ascii.py,
|
||||||
|
which was written by Marc-Andre Lemburg (mal@lemburg.com).
|
||||||
|
|
||||||
|
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
|
||||||
|
|
||||||
|
"""
|
||||||
import codecs
|
import codecs
|
||||||
import sys
|
import sys
|
||||||
from _typeshed import ReadableBuffer
|
from _typeshed import ReadableBuffer
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
"""Python 'oem' Codec for Windows
|
||||||
|
|
||||||
|
"""
|
||||||
import codecs
|
import codecs
|
||||||
import sys
|
import sys
|
||||||
from _typeshed import ReadableBuffer
|
from _typeshed import ReadableBuffer
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,9 @@ if sys.platform == "win32":
|
||||||
action: str,
|
action: str,
|
||||||
seqno: int | type[_Unspecified] = ...,
|
seqno: int | type[_Unspecified] = ...,
|
||||||
cond: str | type[_Unspecified] = ...,
|
cond: str | type[_Unspecified] = ...,
|
||||||
) -> None: ...
|
) -> None:
|
||||||
|
"""Change the sequence number of an action in a sequence list
|
||||||
|
"""
|
||||||
def add_data(db: _Database, table: str, values: Iterable[tuple[Any, ...]]) -> None: ...
|
def add_data(db: _Database, table: str, values: Iterable[tuple[Any, ...]]) -> None: ...
|
||||||
def add_stream(db: _Database, name: str, path: str) -> None: ...
|
def add_stream(db: _Database, name: str, path: str) -> None: ...
|
||||||
def init_database(
|
def init_database(
|
||||||
|
|
@ -80,7 +82,16 @@ if sys.platform == "win32":
|
||||||
_logical: str,
|
_logical: str,
|
||||||
default: str,
|
default: str,
|
||||||
componentflags: int | None = None,
|
componentflags: int | None = None,
|
||||||
) -> None: ...
|
) -> None:
|
||||||
|
"""Create a new directory in the Directory table. There is a current component
|
||||||
|
at each point in time for the directory, which is either explicitly created
|
||||||
|
through start_component, or implicitly when files are added for the first
|
||||||
|
time. Files are added into the current component, and into the cab file.
|
||||||
|
To create a directory, a base directory object needs to be specified (can be
|
||||||
|
None), the path to the physical directory, and a logical directory name.
|
||||||
|
Default specifies the DefaultDir slot in the directory table. componentflags
|
||||||
|
specifies the default flags that new components get.
|
||||||
|
"""
|
||||||
def start_component(
|
def start_component(
|
||||||
self,
|
self,
|
||||||
component: str | None = None,
|
component: str | None = None,
|
||||||
|
|
@ -88,11 +99,28 @@ if sys.platform == "win32":
|
||||||
flags: int | None = None,
|
flags: int | None = None,
|
||||||
keyfile: str | None = None,
|
keyfile: str | None = None,
|
||||||
uuid: str | None = None,
|
uuid: str | None = None,
|
||||||
) -> None: ...
|
) -> None:
|
||||||
|
"""Add an entry to the Component table, and make this component the current for this
|
||||||
|
directory. If no component name is given, the directory name is used. If no feature
|
||||||
|
is given, the current feature is used. If no flags are given, the directory's default
|
||||||
|
flags are used. If no keyfile is given, the KeyPath is left null in the Component
|
||||||
|
table.
|
||||||
|
"""
|
||||||
def make_short(self, file: str) -> str: ...
|
def make_short(self, file: str) -> str: ...
|
||||||
def add_file(self, file: str, src: str | None = None, version: str | None = None, language: str | None = None) -> str: ...
|
def add_file(self, file: str, src: str | None = None, version: str | None = None, language: str | None = None) -> str:
|
||||||
def glob(self, pattern: str, exclude: Container[str] | None = None) -> list[str]: ...
|
"""Add a file to the current component of the directory, starting a new one
|
||||||
def remove_pyc(self) -> None: ...
|
if there is no current component. By default, the file name in the source
|
||||||
|
and the file table will be identical. If the src file is specified, it is
|
||||||
|
interpreted relative to the current directory. Optionally, a version and a
|
||||||
|
language can be specified for the entry in the File table.
|
||||||
|
"""
|
||||||
|
def glob(self, pattern: str, exclude: Container[str] | None = None) -> list[str]:
|
||||||
|
"""Add a list of files to the current component as specified in the
|
||||||
|
glob pattern. Individual files can be excluded in the exclude list.
|
||||||
|
"""
|
||||||
|
def remove_pyc(self) -> None:
|
||||||
|
"""Remove .pyc files on uninstall
|
||||||
|
"""
|
||||||
|
|
||||||
class Binary:
|
class Binary:
|
||||||
name: str
|
name: str
|
||||||
|
|
|
||||||
|
|
@ -13,20 +13,83 @@ if sys.platform == "win32":
|
||||||
SEM_NOALIGNMENTFAULTEXCEPT: Final = 0x0004
|
SEM_NOALIGNMENTFAULTEXCEPT: Final = 0x0004
|
||||||
SEM_NOGPFAULTERRORBOX: Final = 0x0002
|
SEM_NOGPFAULTERRORBOX: Final = 0x0002
|
||||||
SEM_NOOPENFILEERRORBOX: Final = 0x8000
|
SEM_NOOPENFILEERRORBOX: Final = 0x8000
|
||||||
def locking(fd: int, mode: int, nbytes: int, /) -> None: ...
|
def locking(fd: int, mode: int, nbytes: int, /) -> None:
|
||||||
def setmode(fd: int, mode: int, /) -> int: ...
|
"""Lock part of a file based on file descriptor fd from the C runtime.
|
||||||
def open_osfhandle(handle: int, flags: int, /) -> int: ...
|
|
||||||
def get_osfhandle(fd: int, /) -> int: ...
|
Raises OSError on failure. The locked region of the file extends from
|
||||||
def kbhit() -> bool: ...
|
the current file position for nbytes bytes, and may continue beyond
|
||||||
def getch() -> bytes: ...
|
the end of the file. mode must be one of the LK_* constants listed
|
||||||
def getwch() -> str: ...
|
below. Multiple regions in a file may be locked at the same time, but
|
||||||
def getche() -> bytes: ...
|
may not overlap. Adjacent regions are not merged; they must be unlocked
|
||||||
def getwche() -> str: ...
|
individually.
|
||||||
def putch(char: bytes | bytearray, /) -> None: ...
|
"""
|
||||||
def putwch(unicode_char: str, /) -> None: ...
|
def setmode(fd: int, mode: int, /) -> int:
|
||||||
def ungetch(char: bytes | bytearray, /) -> None: ...
|
"""Set the line-end translation mode for the file descriptor fd.
|
||||||
def ungetwch(unicode_char: str, /) -> None: ...
|
|
||||||
def heapmin() -> None: ...
|
To set it to text mode, flags should be os.O_TEXT; for binary, it
|
||||||
def SetErrorMode(mode: int, /) -> int: ...
|
should be os.O_BINARY.
|
||||||
|
|
||||||
|
Return value is the previous mode.
|
||||||
|
"""
|
||||||
|
def open_osfhandle(handle: int, flags: int, /) -> int:
|
||||||
|
"""Create a C runtime file descriptor from the file handle handle.
|
||||||
|
|
||||||
|
The flags parameter should be a bitwise OR of os.O_APPEND, os.O_RDONLY,
|
||||||
|
and os.O_TEXT. The returned file descriptor may be used as a parameter
|
||||||
|
to os.fdopen() to create a file object.
|
||||||
|
"""
|
||||||
|
def get_osfhandle(fd: int, /) -> int:
|
||||||
|
"""Return the file handle for the file descriptor fd.
|
||||||
|
|
||||||
|
Raises OSError if fd is not recognized.
|
||||||
|
"""
|
||||||
|
def kbhit() -> bool:
|
||||||
|
"""Returns a nonzero value if a keypress is waiting to be read. Otherwise, return 0.
|
||||||
|
"""
|
||||||
|
def getch() -> bytes:
|
||||||
|
"""Read a keypress and return the resulting character as a byte string.
|
||||||
|
|
||||||
|
Nothing is echoed to the console. This call will block if a keypress is
|
||||||
|
not already available, but will not wait for Enter to be pressed. If the
|
||||||
|
pressed key was a special function key, this will return '\\000' or
|
||||||
|
'\\xe0'; the next call will return the keycode. The Control-C keypress
|
||||||
|
cannot be read with this function.
|
||||||
|
"""
|
||||||
|
def getwch() -> str:
|
||||||
|
"""Wide char variant of getch(), returning a Unicode value.
|
||||||
|
"""
|
||||||
|
def getche() -> bytes:
|
||||||
|
"""Similar to getch(), but the keypress will be echoed if possible.
|
||||||
|
"""
|
||||||
|
def getwche() -> str:
|
||||||
|
"""Wide char variant of getche(), returning a Unicode value.
|
||||||
|
"""
|
||||||
|
def putch(char: bytes | bytearray, /) -> None:
|
||||||
|
"""Print the byte string char to the console without buffering.
|
||||||
|
"""
|
||||||
|
def putwch(unicode_char: str, /) -> None:
|
||||||
|
"""Wide char variant of putch(), accepting a Unicode value.
|
||||||
|
"""
|
||||||
|
def ungetch(char: bytes | bytearray, /) -> None:
|
||||||
|
"""Opposite of getch.
|
||||||
|
|
||||||
|
Cause the byte string char to be "pushed back" into the
|
||||||
|
console buffer; it will be the next character read by
|
||||||
|
getch() or getche().
|
||||||
|
"""
|
||||||
|
def ungetwch(unicode_char: str, /) -> None:
|
||||||
|
"""Wide char variant of ungetch(), accepting a Unicode value.
|
||||||
|
"""
|
||||||
|
def heapmin() -> None:
|
||||||
|
"""Minimize the malloc() heap.
|
||||||
|
|
||||||
|
Force the malloc() heap to clean itself up and return unused blocks
|
||||||
|
to the operating system. On failure, this raises OSError.
|
||||||
|
"""
|
||||||
|
def SetErrorMode(mode: int, /) -> int:
|
||||||
|
"""Wrapper around SetErrorMode.
|
||||||
|
"""
|
||||||
if sys.version_info >= (3, 10):
|
if sys.version_info >= (3, 10):
|
||||||
def GetErrorMode() -> int: ... # undocumented
|
def GetErrorMode() -> int: # undocumented
|
||||||
|
"""Wrapper around GetErrorMode.
|
||||||
|
"""
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,12 @@ a socket handle (Windows).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
class PipeConnection(_ConnectionBase[_SendT_contra, _RecvT_co]): ...
|
class PipeConnection(_ConnectionBase[_SendT_contra, _RecvT_co]):
|
||||||
|
"""
|
||||||
|
Connection class based on a Windows named pipe.
|
||||||
|
Overlapped I/O is used, so the handles must have been created
|
||||||
|
with FILE_FLAG_OVERLAPPED.
|
||||||
|
"""
|
||||||
|
|
||||||
class Listener:
|
class Listener:
|
||||||
"""
|
"""
|
||||||
|
|
@ -134,4 +139,7 @@ Returns pair of connection objects at either end of a pipe
|
||||||
"""
|
"""
|
||||||
|
|
||||||
else:
|
else:
|
||||||
def Pipe(duplex: bool = True) -> tuple[PipeConnection[Any, Any], PipeConnection[Any, Any]]: ...
|
def Pipe(duplex: bool = True) -> tuple[PipeConnection[Any, Any], PipeConnection[Any, Any]]:
|
||||||
|
"""
|
||||||
|
Returns pair of connection objects at either end of a pipe
|
||||||
|
"""
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,9 @@ can be used to create shared objects.
|
||||||
"""Returns two connection object connected by a pipe
|
"""Returns two connection object connected by a pipe
|
||||||
"""
|
"""
|
||||||
else:
|
else:
|
||||||
def Pipe(self, duplex: bool = True) -> tuple[PipeConnection[Any, Any], PipeConnection[Any, Any]]: ...
|
def Pipe(self, duplex: bool = True) -> tuple[PipeConnection[Any, Any], PipeConnection[Any, Any]]:
|
||||||
|
"""Returns two connection object connected by a pipe
|
||||||
|
"""
|
||||||
|
|
||||||
def Barrier(
|
def Barrier(
|
||||||
self, parties: int, action: Callable[..., object] | None = None, timeout: float | None = None
|
self, parties: int, action: Callable[..., object] | None = None, timeout: float | None = None
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,9 @@ if sys.platform == "win32":
|
||||||
WINENV: Final[bool]
|
WINENV: Final[bool]
|
||||||
|
|
||||||
class Popen:
|
class Popen:
|
||||||
|
"""
|
||||||
|
Start a subprocess to run the code of a process object
|
||||||
|
"""
|
||||||
finalizer: Finalize
|
finalizer: Finalize
|
||||||
method: ClassVar[str]
|
method: ClassVar[str]
|
||||||
pid: int
|
pid: int
|
||||||
|
|
|
||||||
|
|
@ -39,14 +39,26 @@ def dump(obj: Any, file: SupportsWrite[bytes], protocol: int | None = None) -> N
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
def duplicate(
|
def duplicate(
|
||||||
handle: int, target_process: int | None = None, inheritable: bool = False, *, source_process: int | None = None
|
handle: int, target_process: int | None = None, inheritable: bool = False, *, source_process: int | None = None
|
||||||
) -> int: ...
|
) -> int:
|
||||||
def steal_handle(source_pid: int, handle: int) -> int: ...
|
"""Duplicate a handle. (target_process is a handle not a pid!)
|
||||||
def send_handle(conn: connection.PipeConnection[DupHandle, Any], handle: int, destination_pid: int) -> None: ...
|
"""
|
||||||
def recv_handle(conn: connection.PipeConnection[Any, DupHandle]) -> int: ...
|
def steal_handle(source_pid: int, handle: int) -> int:
|
||||||
|
"""Steal a handle from process identified by source_pid.
|
||||||
|
"""
|
||||||
|
def send_handle(conn: connection.PipeConnection[DupHandle, Any], handle: int, destination_pid: int) -> None:
|
||||||
|
"""Send a handle over a local connection.
|
||||||
|
"""
|
||||||
|
def recv_handle(conn: connection.PipeConnection[Any, DupHandle]) -> int:
|
||||||
|
"""Receive a handle over a local connection.
|
||||||
|
"""
|
||||||
|
|
||||||
class DupHandle:
|
class DupHandle:
|
||||||
|
"""Picklable wrapper for a handle.
|
||||||
|
"""
|
||||||
def __init__(self, handle: int, access: int, pid: int | None = None) -> None: ...
|
def __init__(self, handle: int, access: int, pid: int | None = None) -> None: ...
|
||||||
def detach(self) -> int: ...
|
def detach(self) -> int:
|
||||||
|
"""Get the handle. This should only be called once.
|
||||||
|
"""
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if sys.version_info < (3, 14):
|
if sys.version_info < (3, 14):
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,12 @@ if sys.platform == "win32":
|
||||||
__all__ += ["DupSocket"]
|
__all__ += ["DupSocket"]
|
||||||
|
|
||||||
class DupSocket:
|
class DupSocket:
|
||||||
|
"""Picklable wrapper for a socket.
|
||||||
|
"""
|
||||||
def __init__(self, sock: socket) -> None: ...
|
def __init__(self, sock: socket) -> None: ...
|
||||||
def detach(self) -> socket: ...
|
def detach(self) -> socket:
|
||||||
|
"""Get the socket. This should only be called once.
|
||||||
|
"""
|
||||||
|
|
||||||
else:
|
else:
|
||||||
__all__ += ["DupFd"]
|
__all__ += ["DupFd"]
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
"""This module provides access to operating system functionality that is
|
||||||
|
standardized by the C Standard and the POSIX standard (a thinly
|
||||||
|
disguised Unix interface). Refer to the library manual and
|
||||||
|
corresponding Unix manual entries for more information on calls.
|
||||||
|
"""
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
|
|
|
||||||
|
|
@ -870,7 +870,9 @@ See os.stat for more information.
|
||||||
Use st_birthtime instead to retrieve the file creation time. \
|
Use st_birthtime instead to retrieve the file creation time. \
|
||||||
In the future, this property will contain the last metadata change time."""
|
In the future, this property will contain the last metadata change time."""
|
||||||
)
|
)
|
||||||
def st_ctime(self) -> float: ...
|
def st_ctime(self) -> float:
|
||||||
|
"""time of last change
|
||||||
|
"""
|
||||||
else:
|
else:
|
||||||
@property
|
@property
|
||||||
def st_ctime(self) -> float:
|
def st_ctime(self) -> float:
|
||||||
|
|
@ -892,14 +894,22 @@ In the future, this property will contain the last metadata change time."""
|
||||||
"""
|
"""
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
@property
|
@property
|
||||||
def st_file_attributes(self) -> int: ...
|
def st_file_attributes(self) -> int:
|
||||||
|
"""Windows file attribute bits
|
||||||
|
"""
|
||||||
@property
|
@property
|
||||||
def st_reparse_tag(self) -> int: ...
|
def st_reparse_tag(self) -> int:
|
||||||
|
"""Windows reparse tag
|
||||||
|
"""
|
||||||
if sys.version_info >= (3, 12):
|
if sys.version_info >= (3, 12):
|
||||||
@property
|
@property
|
||||||
def st_birthtime(self) -> float: ... # time of file creation in seconds
|
def st_birthtime(self) -> float: # time of file creation in seconds
|
||||||
|
"""time of creation
|
||||||
|
"""
|
||||||
@property
|
@property
|
||||||
def st_birthtime_ns(self) -> int: ... # time of file creation in nanoseconds
|
def st_birthtime_ns(self) -> int: # time of file creation in nanoseconds
|
||||||
|
"""time of creation in nanoseconds
|
||||||
|
"""
|
||||||
else:
|
else:
|
||||||
@property
|
@property
|
||||||
def st_blocks(self) -> int: # number of blocks allocated for file
|
def st_blocks(self) -> int: # number of blocks allocated for file
|
||||||
|
|
@ -1257,8 +1267,12 @@ key, default and the result are bytes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
else:
|
else:
|
||||||
def putenv(name: str, value: str, /) -> None: ...
|
def putenv(name: str, value: str, /) -> None:
|
||||||
def unsetenv(name: str, /) -> None: ...
|
"""Change or add an environment variable.
|
||||||
|
"""
|
||||||
|
def unsetenv(name: str, /) -> None:
|
||||||
|
"""Delete an environment variable.
|
||||||
|
"""
|
||||||
|
|
||||||
_Opener: TypeAlias = Callable[[str, int], int]
|
_Opener: TypeAlias = Callable[[str, int], int]
|
||||||
|
|
||||||
|
|
@ -1648,8 +1662,12 @@ def set_inheritable(fd: int, inheritable: bool, /) -> None:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
def get_handle_inheritable(handle: int, /) -> bool: ...
|
def get_handle_inheritable(handle: int, /) -> bool:
|
||||||
def set_handle_inheritable(handle: int, inheritable: bool, /) -> None: ...
|
"""Get the close-on-exe flag of the specified file descriptor.
|
||||||
|
"""
|
||||||
|
def set_handle_inheritable(handle: int, inheritable: bool, /) -> None:
|
||||||
|
"""Set the inheritable flag of the specified handle.
|
||||||
|
"""
|
||||||
|
|
||||||
if sys.platform != "win32":
|
if sys.platform != "win32":
|
||||||
# Unix only
|
# Unix only
|
||||||
|
|
@ -2421,8 +2439,28 @@ otherwise return -SIG, where SIG is the signal that killed it.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
else:
|
else:
|
||||||
def spawnv(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, /) -> int: ...
|
def spawnv(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, /) -> int:
|
||||||
def spawnve(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, env: _ExecEnv, /) -> int: ...
|
"""Execute the program specified by path in a new process.
|
||||||
|
|
||||||
|
mode
|
||||||
|
Mode of process creation.
|
||||||
|
path
|
||||||
|
Path of executable file.
|
||||||
|
argv
|
||||||
|
Tuple or list of strings.
|
||||||
|
"""
|
||||||
|
def spawnve(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, env: _ExecEnv, /) -> int:
|
||||||
|
"""Execute the program specified by path in a new process.
|
||||||
|
|
||||||
|
mode
|
||||||
|
Mode of process creation.
|
||||||
|
path
|
||||||
|
Path of executable file.
|
||||||
|
argv
|
||||||
|
Tuple or list of strings.
|
||||||
|
env
|
||||||
|
Dictionary of strings mapping to strings.
|
||||||
|
"""
|
||||||
|
|
||||||
def system(command: StrOrBytesPath) -> int:
|
def system(command: StrOrBytesPath) -> int:
|
||||||
"""Execute the command in a subshell.
|
"""Execute the command in a subshell.
|
||||||
|
|
@ -2486,9 +2524,53 @@ if sys.platform == "win32":
|
||||||
arguments: str = "",
|
arguments: str = "",
|
||||||
cwd: StrOrBytesPath | None = None,
|
cwd: StrOrBytesPath | None = None,
|
||||||
show_cmd: int = 1,
|
show_cmd: int = 1,
|
||||||
) -> None: ...
|
) -> None:
|
||||||
|
"""Start a file with its associated application.
|
||||||
|
|
||||||
|
When "operation" is not specified or "open", this acts like
|
||||||
|
double-clicking the file in Explorer, or giving the file name as an
|
||||||
|
argument to the DOS "start" command: the file is opened with whatever
|
||||||
|
application (if any) its extension is associated.
|
||||||
|
When another "operation" is given, it specifies what should be done with
|
||||||
|
the file. A typical operation is "print".
|
||||||
|
|
||||||
|
"arguments" is passed to the application, but should be omitted if the
|
||||||
|
file is a document.
|
||||||
|
|
||||||
|
"cwd" is the working directory for the operation. If "filepath" is
|
||||||
|
relative, it will be resolved against this directory. This argument
|
||||||
|
should usually be an absolute path.
|
||||||
|
|
||||||
|
"show_cmd" can be used to override the recommended visibility option.
|
||||||
|
See the Windows ShellExecute documentation for values.
|
||||||
|
|
||||||
|
startfile returns as soon as the associated application is launched.
|
||||||
|
There is no option to wait for the application to close, and no way
|
||||||
|
to retrieve the application's exit status.
|
||||||
|
|
||||||
|
The filepath is relative to the current directory. If you want to use
|
||||||
|
an absolute path, make sure the first character is not a slash ("/");
|
||||||
|
the underlying Win32 ShellExecute function doesn't work if it is.
|
||||||
|
"""
|
||||||
else:
|
else:
|
||||||
def startfile(filepath: StrOrBytesPath, operation: str = ...) -> None: ...
|
def startfile(filepath: StrOrBytesPath, operation: str = ...) -> None:
|
||||||
|
"""Start a file with its associated application.
|
||||||
|
|
||||||
|
When "operation" is not specified or "open", this acts like
|
||||||
|
double-clicking the file in Explorer, or giving the file name as an
|
||||||
|
argument to the DOS "start" command: the file is opened with whatever
|
||||||
|
application (if any) its extension is associated.
|
||||||
|
When another "operation" is given, it specifies what should be done with
|
||||||
|
the file. A typical operation is "print".
|
||||||
|
|
||||||
|
startfile returns as soon as the associated application is launched.
|
||||||
|
There is no option to wait for the application to close, and no way
|
||||||
|
to retrieve the application's exit status.
|
||||||
|
|
||||||
|
The filepath is relative to the current directory. If you want to use
|
||||||
|
an absolute path, make sure the first character is not a slash ("/");
|
||||||
|
the underlying Win32 ShellExecute function doesn't work if it is.
|
||||||
|
"""
|
||||||
|
|
||||||
else:
|
else:
|
||||||
def spawnlp(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int:
|
def spawnlp(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int:
|
||||||
|
|
@ -2855,7 +2937,11 @@ Return the number of logical CPUs usable by the calling thread of the
|
||||||
current process. Return None if indeterminable.
|
current process. Return None if indeterminable.
|
||||||
"""
|
"""
|
||||||
else:
|
else:
|
||||||
def process_cpu_count() -> int | None: ...
|
def process_cpu_count() -> int | None:
|
||||||
|
"""Return the number of logical CPUs in the system.
|
||||||
|
|
||||||
|
Return None if indeterminable.
|
||||||
|
"""
|
||||||
|
|
||||||
if sys.platform != "win32":
|
if sys.platform != "win32":
|
||||||
# Unix only
|
# Unix only
|
||||||
|
|
@ -2910,7 +2996,16 @@ if sys.platform == "win32":
|
||||||
def __enter__(self) -> Self: ...
|
def __enter__(self) -> Self: ...
|
||||||
def __exit__(self, *args: Unused) -> None: ...
|
def __exit__(self, *args: Unused) -> None: ...
|
||||||
|
|
||||||
def add_dll_directory(path: str) -> _AddedDllDirectory: ...
|
def add_dll_directory(path: str) -> _AddedDllDirectory:
|
||||||
|
"""Add a path to the DLL search path.
|
||||||
|
|
||||||
|
This search path is used when resolving dependencies for imported
|
||||||
|
extension modules (the module itself is resolved through sys.path),
|
||||||
|
and also by ctypes.
|
||||||
|
|
||||||
|
Remove the directory by calling close() on the returned object or
|
||||||
|
using it in a with statement.
|
||||||
|
"""
|
||||||
|
|
||||||
if sys.platform == "linux":
|
if sys.platform == "linux":
|
||||||
MFD_CLOEXEC: Final[int]
|
MFD_CLOEXEC: Final[int]
|
||||||
|
|
@ -2977,9 +3072,21 @@ if sys.version_info >= (3, 12) and sys.platform == "linux":
|
||||||
PIDFD_NONBLOCK: Final = 2048
|
PIDFD_NONBLOCK: Final = 2048
|
||||||
|
|
||||||
if sys.version_info >= (3, 12) and sys.platform == "win32":
|
if sys.version_info >= (3, 12) and sys.platform == "win32":
|
||||||
def listdrives() -> list[str]: ...
|
def listdrives() -> list[str]:
|
||||||
def listmounts(volume: str) -> list[str]: ...
|
"""Return a list containing the names of drives in the system.
|
||||||
def listvolumes() -> list[str]: ...
|
|
||||||
|
A drive name typically looks like 'C:\\\\'.
|
||||||
|
"""
|
||||||
|
def listmounts(volume: str) -> list[str]:
|
||||||
|
"""Return a list containing mount points for a particular volume.
|
||||||
|
|
||||||
|
'volume' should be a GUID path as returned from os.listvolumes.
|
||||||
|
"""
|
||||||
|
def listvolumes() -> list[str]:
|
||||||
|
"""Return a list containing the volumes in the system.
|
||||||
|
|
||||||
|
Volumes are typically represented as a GUID path.
|
||||||
|
"""
|
||||||
|
|
||||||
if sys.version_info >= (3, 10) and sys.platform == "linux":
|
if sys.version_info >= (3, 10) and sys.platform == "linux":
|
||||||
EFD_CLOEXEC: Final[int]
|
EFD_CLOEXEC: Final[int]
|
||||||
|
|
@ -3173,4 +3280,9 @@ Equivalent to os.chmod(fd, mode).
|
||||||
if sys.platform != "linux":
|
if sys.platform != "linux":
|
||||||
if sys.version_info >= (3, 13) or sys.platform != "win32":
|
if sys.version_info >= (3, 13) or sys.platform != "win32":
|
||||||
# Added to Windows in 3.13.
|
# Added to Windows in 3.13.
|
||||||
def lchmod(path: StrOrBytesPath, mode: int) -> None: ...
|
def lchmod(path: StrOrBytesPath, mode: int) -> None:
|
||||||
|
"""Change the access permissions of a file, without following symbolic links.
|
||||||
|
|
||||||
|
If path is a symlink, this affects the link itself rather than the target.
|
||||||
|
Equivalent to chmod(path, mode, follow_symlinks=False)."
|
||||||
|
"""
|
||||||
|
|
|
||||||
|
|
@ -546,11 +546,23 @@ the built-in open() function does.
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
if sys.version_info >= (3, 13):
|
if sys.version_info >= (3, 13):
|
||||||
# raises UnsupportedOperation:
|
# raises UnsupportedOperation:
|
||||||
def owner(self: Never, *, follow_symlinks: bool = True) -> str: ... # type: ignore[misc]
|
def owner(self: Never, *, follow_symlinks: bool = True) -> str: # type: ignore[misc]
|
||||||
def group(self: Never, *, follow_symlinks: bool = True) -> str: ... # type: ignore[misc]
|
"""
|
||||||
|
Return the login name of the file owner.
|
||||||
|
"""
|
||||||
|
def group(self: Never, *, follow_symlinks: bool = True) -> str: # type: ignore[misc]
|
||||||
|
"""
|
||||||
|
Return the group name of the file gid.
|
||||||
|
"""
|
||||||
else:
|
else:
|
||||||
def owner(self: Never) -> str: ... # type: ignore[misc]
|
def owner(self: Never) -> str: # type: ignore[misc]
|
||||||
def group(self: Never) -> str: ... # type: ignore[misc]
|
"""
|
||||||
|
Return the login name of the file owner.
|
||||||
|
"""
|
||||||
|
def group(self: Never) -> str: # type: ignore[misc]
|
||||||
|
"""
|
||||||
|
Return the group name of the file gid.
|
||||||
|
"""
|
||||||
else:
|
else:
|
||||||
if sys.version_info >= (3, 13):
|
if sys.version_info >= (3, 13):
|
||||||
def owner(self, *, follow_symlinks: bool = True) -> str:
|
def owner(self, *, follow_symlinks: bool = True) -> str:
|
||||||
|
|
@ -574,7 +586,10 @@ Return the group name of the file gid.
|
||||||
# This method does "exist" on Windows on <3.12, but always raises NotImplementedError
|
# This method does "exist" on Windows on <3.12, but always raises NotImplementedError
|
||||||
# On py312+, it works properly on Windows, as with all other platforms
|
# On py312+, it works properly on Windows, as with all other platforms
|
||||||
if sys.platform == "win32" and sys.version_info < (3, 12):
|
if sys.platform == "win32" and sys.version_info < (3, 12):
|
||||||
def is_mount(self: Never) -> bool: ... # type: ignore[misc]
|
def is_mount(self: Never) -> bool: # type: ignore[misc]
|
||||||
|
"""
|
||||||
|
Check if this path is a POSIX mount point
|
||||||
|
"""
|
||||||
else:
|
else:
|
||||||
def is_mount(self) -> bool:
|
def is_mount(self) -> bool:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,26 @@ information to the parser. 'flag' defaults to True if not provided.
|
||||||
"""
|
"""
|
||||||
if sys.version_info >= (3, 10):
|
if sys.version_info >= (3, 10):
|
||||||
# Added in Python 3.10.20, 3.11.15, 3.12.3, 3.13.10, 3.14.1
|
# Added in Python 3.10.20, 3.11.15, 3.12.3, 3.13.10, 3.14.1
|
||||||
def SetAllocTrackerActivationThreshold(self, threshold: int, /) -> None: ...
|
def SetAllocTrackerActivationThreshold(self, threshold: int, /) -> None:
|
||||||
def SetAllocTrackerMaximumAmplification(self, max_factor: float, /) -> None: ...
|
"""Sets the number of allocated bytes of dynamic memory needed to activate protection against disproportionate use of RAM.
|
||||||
|
|
||||||
|
By default, parser objects have an allocation activation threshold of 64 MiB.
|
||||||
|
"""
|
||||||
|
def SetAllocTrackerMaximumAmplification(self, max_factor: float, /) -> None:
|
||||||
|
"""Sets the maximum amplification factor between direct input and bytes of dynamic memory allocated.
|
||||||
|
|
||||||
|
The amplification factor is calculated as "allocated / direct" while parsing,
|
||||||
|
where "direct" is the number of bytes read from the primary document in parsing
|
||||||
|
and "allocated" is the number of bytes of dynamic memory allocated in the parser
|
||||||
|
hierarchy.
|
||||||
|
|
||||||
|
The 'max_factor' value must be a non-NaN floating point value greater than
|
||||||
|
or equal to 1.0. Amplification factors greater than 100.0 can be observed
|
||||||
|
near the start of parsing even with benign files in practice. In particular,
|
||||||
|
the activation threshold should be carefully chosen to avoid false positives.
|
||||||
|
|
||||||
|
By default, parser objects have a maximum amplification factor of 100.0.
|
||||||
|
"""
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def intern(self) -> dict[str, str]: ...
|
def intern(self) -> dict[str, str]: ...
|
||||||
|
|
|
||||||
|
|
@ -345,7 +345,16 @@ else:
|
||||||
if sys.platform == "win32" and sys.version_info < (3, 12):
|
if sys.platform == "win32" and sys.version_info < (3, 12):
|
||||||
@overload
|
@overload
|
||||||
@deprecated("On Windows before Python 3.12, using a PathLike as `cmd` would always fail or return `None`.")
|
@deprecated("On Windows before Python 3.12, using a PathLike as `cmd` would always fail or return `None`.")
|
||||||
def which(cmd: os.PathLike[str], mode: int = 1, path: StrPath | None = None) -> NoReturn: ...
|
def which(cmd: os.PathLike[str], mode: int = 1, path: StrPath | None = None) -> NoReturn:
|
||||||
|
"""Given a command, mode, and a PATH string, return the path which
|
||||||
|
conforms to the given mode on the PATH, or None if there is no such
|
||||||
|
file.
|
||||||
|
|
||||||
|
`mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
|
||||||
|
of os.environ.get("PATH"), or can be overridden with a custom search
|
||||||
|
path.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def which(cmd: StrPath, mode: int = 1, path: StrPath | None = None) -> str | None:
|
def which(cmd: StrPath, mode: int = 1, path: StrPath | None = None) -> str | None:
|
||||||
|
|
|
||||||
|
|
@ -1515,10 +1515,21 @@ data and a list containing the descriptors.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
def fromshare(info: bytes) -> socket: ...
|
def fromshare(info: bytes) -> socket:
|
||||||
|
"""fromshare(info) -> socket object
|
||||||
|
|
||||||
|
Create a socket object from the bytes object returned by
|
||||||
|
socket.share(pid).
|
||||||
|
"""
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
def socketpair(family: int = ..., type: int = ..., proto: int = 0) -> tuple[socket, socket]: ...
|
def socketpair(family: int = ..., type: int = ..., proto: int = 0) -> tuple[socket, socket]:
|
||||||
|
"""socketpair([family[, type[, proto]]]) -> (socket object, socket object)
|
||||||
|
Create a pair of socket objects from the sockets returned by the platform
|
||||||
|
socketpair() function.
|
||||||
|
The arguments are the same as for socket() except the default family is AF_UNIX
|
||||||
|
if defined on the platform; otherwise, the default is AF_INET.
|
||||||
|
"""
|
||||||
|
|
||||||
else:
|
else:
|
||||||
def socketpair(
|
def socketpair(
|
||||||
|
|
|
||||||
|
|
@ -740,7 +740,19 @@ if sys.platform == "win32":
|
||||||
@property
|
@property
|
||||||
def platform_version(self) -> tuple[int, int, int]: ...
|
def platform_version(self) -> tuple[int, int, int]: ...
|
||||||
|
|
||||||
def getwindowsversion() -> _WinVersion: ...
|
def getwindowsversion() -> _WinVersion:
|
||||||
|
"""Return info about the running version of Windows as a named tuple.
|
||||||
|
|
||||||
|
The members are named: major, minor, build, platform, service_pack,
|
||||||
|
service_pack_major, service_pack_minor, suite_mask, product_type and
|
||||||
|
platform_version. For backward compatibility, only the first 5 items
|
||||||
|
are available by indexing. All elements are numbers, except
|
||||||
|
service_pack and platform_type which are strings, and platform_version
|
||||||
|
which is a 3-tuple. Platform is always 2. Product_type may be 1 for a
|
||||||
|
workstation, 2 for a domain controller, 3 for a server.
|
||||||
|
Platform_version is a 3-tuple containing a version number that is
|
||||||
|
intended for identifying the OS rather than feature detection.
|
||||||
|
"""
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def intern(string: LiteralString, /) -> LiteralString:
|
def intern(string: LiteralString, /) -> LiteralString:
|
||||||
|
|
@ -867,9 +879,25 @@ if sys.platform == "win32":
|
||||||
"Deprecated since Python 3.13; will be removed in Python 3.16. "
|
"Deprecated since Python 3.13; will be removed in Python 3.16. "
|
||||||
"Use the `PYTHONLEGACYWINDOWSFSENCODING` environment variable instead."
|
"Use the `PYTHONLEGACYWINDOWSFSENCODING` environment variable instead."
|
||||||
)
|
)
|
||||||
def _enablelegacywindowsfsencoding() -> None: ...
|
def _enablelegacywindowsfsencoding() -> None:
|
||||||
|
"""Changes the default filesystem encoding to mbcs:replace.
|
||||||
|
|
||||||
|
This is done for consistency with earlier versions of Python. See PEP
|
||||||
|
529 for more information.
|
||||||
|
|
||||||
|
This is equivalent to defining the PYTHONLEGACYWINDOWSFSENCODING
|
||||||
|
environment variable before launching Python.
|
||||||
|
"""
|
||||||
else:
|
else:
|
||||||
def _enablelegacywindowsfsencoding() -> None: ...
|
def _enablelegacywindowsfsencoding() -> None:
|
||||||
|
"""Changes the default filesystem encoding to mbcs:replace.
|
||||||
|
|
||||||
|
This is done for consistency with earlier versions of Python. See PEP
|
||||||
|
529 for more information.
|
||||||
|
|
||||||
|
This is equivalent to defining the PYTHONLEGACYWINDOWSFSENCODING
|
||||||
|
environment variable before launching Python.
|
||||||
|
"""
|
||||||
|
|
||||||
def get_coroutine_origin_tracking_depth() -> int:
|
def get_coroutine_origin_tracking_depth() -> int:
|
||||||
"""Check status of origin tracking for coroutine objects in this thread.
|
"""Check status of origin tracking for coroutine objects in this thread.
|
||||||
|
|
@ -916,7 +944,9 @@ If no stack profiler is activated, this function has no effect.
|
||||||
"""Activate stack profiler trampoline *backend*.
|
"""Activate stack profiler trampoline *backend*.
|
||||||
"""
|
"""
|
||||||
else:
|
else:
|
||||||
def activate_stack_trampoline(backend: str, /) -> NoReturn: ...
|
def activate_stack_trampoline(backend: str, /) -> NoReturn:
|
||||||
|
"""Activate stack profiler trampoline *backend*.
|
||||||
|
"""
|
||||||
|
|
||||||
from . import _monitoring
|
from . import _monitoring
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -907,7 +907,11 @@ at targetpath.
|
||||||
def makedev(self, tarinfo: TarInfo, targetpath: StrOrBytesPath) -> None: # undocumented
|
def makedev(self, tarinfo: TarInfo, targetpath: StrOrBytesPath) -> None: # undocumented
|
||||||
"""Make a character or block device called targetpath.
|
"""Make a character or block device called targetpath.
|
||||||
"""
|
"""
|
||||||
def makelink(self, tarinfo: TarInfo, targetpath: StrOrBytesPath) -> None: ... # undocumented
|
def makelink(self, tarinfo: TarInfo, targetpath: StrOrBytesPath) -> None: # undocumented
|
||||||
|
"""Make a (symbolic) link called targetpath. If it cannot be created
|
||||||
|
(platform limitation), we try to make a copy of the referenced file
|
||||||
|
instead of a link.
|
||||||
|
"""
|
||||||
def makelink_with_filter(
|
def makelink_with_filter(
|
||||||
self, tarinfo: TarInfo, targetpath: StrOrBytesPath, filter_function: _FilterFunction, extraction_root: str
|
self, tarinfo: TarInfo, targetpath: StrOrBytesPath, filter_function: _FilterFunction, extraction_root: str
|
||||||
) -> None: # undocumented
|
) -> None: # undocumented
|
||||||
|
|
|
||||||
|
|
@ -1665,7 +1665,19 @@ corresponding attributes.
|
||||||
def wm_attributes(self, option: Literal["-type"], /) -> str: ...
|
def wm_attributes(self, option: Literal["-type"], /) -> str: ...
|
||||||
elif sys.platform == "win32":
|
elif sys.platform == "win32":
|
||||||
@overload
|
@overload
|
||||||
def wm_attributes(self, option: Literal["-transparentcolor"], /) -> str: ...
|
def wm_attributes(self, option: Literal["-transparentcolor"], /) -> str:
|
||||||
|
"""Return or sets platform specific attributes.
|
||||||
|
|
||||||
|
When called with a single argument return_python_dict=True,
|
||||||
|
return a dict of the platform specific attributes and their values.
|
||||||
|
When called without arguments or with a single argument
|
||||||
|
return_python_dict=False, return a tuple containing intermixed
|
||||||
|
attribute names with the minus prefix and their values.
|
||||||
|
|
||||||
|
When called with a single string value, return the value for the
|
||||||
|
specific option. When called with keyword arguments, set the
|
||||||
|
corresponding attributes.
|
||||||
|
"""
|
||||||
@overload
|
@overload
|
||||||
def wm_attributes(self, option: Literal["-disabled"], /) -> bool: ...
|
def wm_attributes(self, option: Literal["-disabled"], /) -> bool: ...
|
||||||
@overload
|
@overload
|
||||||
|
|
@ -1720,7 +1732,19 @@ corresponding attributes.
|
||||||
def wm_attributes(self, option: Literal["type"], /) -> str: ...
|
def wm_attributes(self, option: Literal["type"], /) -> str: ...
|
||||||
elif sys.platform == "win32":
|
elif sys.platform == "win32":
|
||||||
@overload
|
@overload
|
||||||
def wm_attributes(self, option: Literal["transparentcolor"], /) -> str: ...
|
def wm_attributes(self, option: Literal["transparentcolor"], /) -> str:
|
||||||
|
"""Return or sets platform specific attributes.
|
||||||
|
|
||||||
|
When called with a single argument return_python_dict=True,
|
||||||
|
return a dict of the platform specific attributes and their values.
|
||||||
|
When called without arguments or with a single argument
|
||||||
|
return_python_dict=False, return a tuple containing intermixed
|
||||||
|
attribute names with the minus prefix and their values.
|
||||||
|
|
||||||
|
When called with a single string value, return the value for the
|
||||||
|
specific option. When called with keyword arguments, set the
|
||||||
|
corresponding attributes.
|
||||||
|
"""
|
||||||
@overload
|
@overload
|
||||||
def wm_attributes(self, option: Literal["disabled"], /) -> bool: ...
|
def wm_attributes(self, option: Literal["disabled"], /) -> bool: ...
|
||||||
@overload
|
@overload
|
||||||
|
|
@ -1763,7 +1787,19 @@ corresponding attributes.
|
||||||
def wm_attributes(self, option: Literal["-transparent"], value: bool, /) -> Literal[""]: ...
|
def wm_attributes(self, option: Literal["-transparent"], value: bool, /) -> Literal[""]: ...
|
||||||
elif sys.platform == "win32":
|
elif sys.platform == "win32":
|
||||||
@overload
|
@overload
|
||||||
def wm_attributes(self, option: Literal["-transparentcolor"], value: str, /) -> Literal[""]: ...
|
def wm_attributes(self, option: Literal["-transparentcolor"], value: str, /) -> Literal[""]:
|
||||||
|
"""Return or sets platform specific attributes.
|
||||||
|
|
||||||
|
When called with a single argument return_python_dict=True,
|
||||||
|
return a dict of the platform specific attributes and their values.
|
||||||
|
When called without arguments or with a single argument
|
||||||
|
return_python_dict=False, return a tuple containing intermixed
|
||||||
|
attribute names with the minus prefix and their values.
|
||||||
|
|
||||||
|
When called with a single string value, return the value for the
|
||||||
|
specific option. When called with keyword arguments, set the
|
||||||
|
corresponding attributes.
|
||||||
|
"""
|
||||||
@overload
|
@overload
|
||||||
def wm_attributes(self, option: Literal["-disabled"], value: bool, /) -> Literal[""]: ...
|
def wm_attributes(self, option: Literal["-disabled"], value: bool, /) -> Literal[""]: ...
|
||||||
@overload
|
@overload
|
||||||
|
|
@ -1814,7 +1850,19 @@ corresponding attributes.
|
||||||
fullscreen: bool = ...,
|
fullscreen: bool = ...,
|
||||||
toolwindow: bool = ...,
|
toolwindow: bool = ...,
|
||||||
topmost: bool = ...,
|
topmost: bool = ...,
|
||||||
) -> None: ...
|
) -> None:
|
||||||
|
"""Return or sets platform specific attributes.
|
||||||
|
|
||||||
|
When called with a single argument return_python_dict=True,
|
||||||
|
return a dict of the platform specific attributes and their values.
|
||||||
|
When called without arguments or with a single argument
|
||||||
|
return_python_dict=False, return a tuple containing intermixed
|
||||||
|
attribute names with the minus prefix and their values.
|
||||||
|
|
||||||
|
When called with a single string value, return the value for the
|
||||||
|
specific option. When called with keyword arguments, set the
|
||||||
|
corresponding attributes.
|
||||||
|
"""
|
||||||
else:
|
else:
|
||||||
# X11
|
# X11
|
||||||
@overload
|
@overload
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,9 @@ LAYOUTS
|
||||||
/,
|
/,
|
||||||
*,
|
*,
|
||||||
padding: _Padding = ...,
|
padding: _Padding = ...,
|
||||||
) -> None: ...
|
) -> None:
|
||||||
|
"""Create a new element in the current theme of given etype.
|
||||||
|
"""
|
||||||
@overload
|
@overload
|
||||||
def element_create(
|
def element_create(
|
||||||
self,
|
self,
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,13 @@ def parse_keqv_list(l: list[str]) -> dict[str, str]:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if sys.platform == "win32" or sys.platform == "darwin":
|
if sys.platform == "win32" or sys.platform == "darwin":
|
||||||
def proxy_bypass(host: str) -> Any: ... # undocumented
|
def proxy_bypass(host: str) -> Any: # undocumented
|
||||||
|
"""Return True, if host should be bypassed.
|
||||||
|
|
||||||
|
Checks proxy settings gathered from the environment, if specified,
|
||||||
|
or the registry.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
else:
|
else:
|
||||||
def proxy_bypass(host: str, proxies: Mapping[str, str] | None = None) -> Any: # undocumented
|
def proxy_bypass(host: str, proxies: Mapping[str, str] | None = None) -> Any: # undocumented
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,42 @@
|
||||||
|
"""This module provides access to the Windows registry API.
|
||||||
|
|
||||||
|
Functions:
|
||||||
|
|
||||||
|
CloseKey() - Closes a registry key.
|
||||||
|
ConnectRegistry() - Establishes a connection to a predefined registry handle
|
||||||
|
on another computer.
|
||||||
|
CreateKey() - Creates the specified key, or opens it if it already exists.
|
||||||
|
DeleteKey() - Deletes the specified key.
|
||||||
|
DeleteValue() - Removes a named value from the specified registry key.
|
||||||
|
DeleteTree() - Deletes the specified key and all its subkeys and values recursively.
|
||||||
|
EnumKey() - Enumerates subkeys of the specified open registry key.
|
||||||
|
EnumValue() - Enumerates values of the specified open registry key.
|
||||||
|
ExpandEnvironmentStrings() - Expand the env strings in a REG_EXPAND_SZ
|
||||||
|
string.
|
||||||
|
FlushKey() - Writes all the attributes of the specified key to the registry.
|
||||||
|
LoadKey() - Creates a subkey under HKEY_USER or HKEY_LOCAL_MACHINE and
|
||||||
|
stores registration information from a specified file into that
|
||||||
|
subkey.
|
||||||
|
OpenKey() - Opens the specified key.
|
||||||
|
OpenKeyEx() - Alias of OpenKey().
|
||||||
|
QueryValue() - Retrieves the value associated with the unnamed value for a
|
||||||
|
specified key in the registry.
|
||||||
|
QueryValueEx() - Retrieves the type and data for a specified value name
|
||||||
|
associated with an open registry key.
|
||||||
|
QueryInfoKey() - Returns information about the specified key.
|
||||||
|
SaveKey() - Saves the specified key, and all its subkeys a file.
|
||||||
|
SetValue() - Associates a value with a specified key.
|
||||||
|
SetValueEx() - Stores data in the value field of an open registry key.
|
||||||
|
|
||||||
|
Special objects:
|
||||||
|
|
||||||
|
HKEYType -- type object for HKEY objects
|
||||||
|
error -- exception raised for Win32 errors
|
||||||
|
|
||||||
|
Integer constants:
|
||||||
|
Many constants are defined - see the documentation for each function
|
||||||
|
to see what constants are used, and where.
|
||||||
|
"""
|
||||||
import sys
|
import sys
|
||||||
from _typeshed import ReadableBuffer, Unused
|
from _typeshed import ReadableBuffer, Unused
|
||||||
from types import TracebackType
|
from types import TracebackType
|
||||||
|
|
@ -6,29 +45,346 @@ from typing_extensions import Self, TypeAlias
|
||||||
|
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
_KeyType: TypeAlias = HKEYType | int
|
_KeyType: TypeAlias = HKEYType | int
|
||||||
def CloseKey(hkey: _KeyType, /) -> None: ...
|
def CloseKey(hkey: _KeyType, /) -> None:
|
||||||
def ConnectRegistry(computer_name: str | None, key: _KeyType, /) -> HKEYType: ...
|
"""Closes a previously opened registry key.
|
||||||
def CreateKey(key: _KeyType, sub_key: str | None, /) -> HKEYType: ...
|
|
||||||
def CreateKeyEx(key: _KeyType, sub_key: str | None, reserved: int = 0, access: int = 131078) -> HKEYType: ...
|
hkey
|
||||||
def DeleteKey(key: _KeyType, sub_key: str, /) -> None: ...
|
A previously opened key.
|
||||||
def DeleteKeyEx(key: _KeyType, sub_key: str, access: int = 256, reserved: int = 0) -> None: ...
|
|
||||||
def DeleteValue(key: _KeyType, value: str, /) -> None: ...
|
Note that if the key is not closed using this method, it will be
|
||||||
def EnumKey(key: _KeyType, index: int, /) -> str: ...
|
closed when the hkey object is destroyed by Python.
|
||||||
def EnumValue(key: _KeyType, index: int, /) -> tuple[str, Any, int]: ...
|
"""
|
||||||
def ExpandEnvironmentStrings(string: str, /) -> str: ...
|
def ConnectRegistry(computer_name: str | None, key: _KeyType, /) -> HKEYType:
|
||||||
def FlushKey(key: _KeyType, /) -> None: ...
|
"""Establishes a connection to the registry on another computer.
|
||||||
def LoadKey(key: _KeyType, sub_key: str, file_name: str, /) -> None: ...
|
|
||||||
def OpenKey(key: _KeyType, sub_key: str | None, reserved: int = 0, access: int = 131097) -> HKEYType: ...
|
computer_name
|
||||||
def OpenKeyEx(key: _KeyType, sub_key: str | None, reserved: int = 0, access: int = 131097) -> HKEYType: ...
|
The name of the remote computer, of the form r"\\\\computername". If
|
||||||
def QueryInfoKey(key: _KeyType, /) -> tuple[int, int, int]: ...
|
None, the local computer is used.
|
||||||
def QueryValue(key: _KeyType, sub_key: str | None, /) -> str: ...
|
key
|
||||||
def QueryValueEx(key: _KeyType, name: str, /) -> tuple[Any, int]: ...
|
The predefined key to connect to.
|
||||||
def SaveKey(key: _KeyType, file_name: str, /) -> None: ...
|
|
||||||
def SetValue(key: _KeyType, sub_key: str | None, type: int, value: str, /) -> None: ...
|
The return value is the handle of the opened key.
|
||||||
|
If the function fails, an OSError exception is raised.
|
||||||
|
"""
|
||||||
|
def CreateKey(key: _KeyType, sub_key: str | None, /) -> HKEYType:
|
||||||
|
"""Creates or opens the specified key.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or one of the predefined HKEY_* constants.
|
||||||
|
sub_key
|
||||||
|
The name of the key this method opens or creates.
|
||||||
|
|
||||||
|
If key is one of the predefined keys, sub_key may be None. In that case,
|
||||||
|
the handle returned is the same key handle passed in to the function.
|
||||||
|
|
||||||
|
If the key already exists, this function opens the existing key.
|
||||||
|
|
||||||
|
The return value is the handle of the opened key.
|
||||||
|
If the function fails, an OSError exception is raised.
|
||||||
|
"""
|
||||||
|
def CreateKeyEx(key: _KeyType, sub_key: str | None, reserved: int = 0, access: int = 131078) -> HKEYType:
|
||||||
|
"""Creates or opens the specified key.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or one of the predefined HKEY_* constants.
|
||||||
|
sub_key
|
||||||
|
The name of the key this method opens or creates.
|
||||||
|
reserved
|
||||||
|
A reserved integer, and must be zero. Default is zero.
|
||||||
|
access
|
||||||
|
An integer that specifies an access mask that describes the
|
||||||
|
desired security access for the key. Default is KEY_WRITE.
|
||||||
|
|
||||||
|
If key is one of the predefined keys, sub_key may be None. In that case,
|
||||||
|
the handle returned is the same key handle passed in to the function.
|
||||||
|
|
||||||
|
If the key already exists, this function opens the existing key
|
||||||
|
|
||||||
|
The return value is the handle of the opened key.
|
||||||
|
If the function fails, an OSError exception is raised.
|
||||||
|
"""
|
||||||
|
def DeleteKey(key: _KeyType, sub_key: str, /) -> None:
|
||||||
|
"""Deletes the specified key.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
sub_key
|
||||||
|
A string that must be the name of a subkey of the key identified by
|
||||||
|
the key parameter. This value must not be None, and the key may not
|
||||||
|
have subkeys.
|
||||||
|
|
||||||
|
This method can not delete keys with subkeys.
|
||||||
|
|
||||||
|
If the function succeeds, the entire key, including all of its values,
|
||||||
|
is removed. If the function fails, an OSError exception is raised.
|
||||||
|
"""
|
||||||
|
def DeleteKeyEx(key: _KeyType, sub_key: str, access: int = 256, reserved: int = 0) -> None:
|
||||||
|
"""Deletes the specified key (intended for 64-bit OS).
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
sub_key
|
||||||
|
A string that must be the name of a subkey of the key identified by
|
||||||
|
the key parameter. This value must not be None, and the key may not
|
||||||
|
have subkeys.
|
||||||
|
access
|
||||||
|
An integer that specifies an access mask that describes the
|
||||||
|
desired security access for the key. Default is KEY_WOW64_64KEY.
|
||||||
|
reserved
|
||||||
|
A reserved integer, and must be zero. Default is zero.
|
||||||
|
|
||||||
|
While this function is intended to be used for 64-bit OS, it is also
|
||||||
|
available on 32-bit systems.
|
||||||
|
|
||||||
|
This method can not delete keys with subkeys.
|
||||||
|
|
||||||
|
If the function succeeds, the entire key, including all of its values,
|
||||||
|
is removed. If the function fails, an OSError exception is raised.
|
||||||
|
On unsupported Windows versions, NotImplementedError is raised.
|
||||||
|
"""
|
||||||
|
def DeleteValue(key: _KeyType, value: str, /) -> None:
|
||||||
|
"""Removes a named value from a registry key.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
value
|
||||||
|
A string that identifies the value to remove.
|
||||||
|
"""
|
||||||
|
def EnumKey(key: _KeyType, index: int, /) -> str:
|
||||||
|
"""Enumerates subkeys of an open registry key.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
index
|
||||||
|
An integer that identifies the index of the key to retrieve.
|
||||||
|
|
||||||
|
The function retrieves the name of one subkey each time it is called.
|
||||||
|
It is typically called repeatedly until an OSError exception is
|
||||||
|
raised, indicating no more values are available.
|
||||||
|
"""
|
||||||
|
def EnumValue(key: _KeyType, index: int, /) -> tuple[str, Any, int]:
|
||||||
|
"""Enumerates values of an open registry key.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
index
|
||||||
|
An integer that identifies the index of the value to retrieve.
|
||||||
|
|
||||||
|
The function retrieves the name of one subkey each time it is called.
|
||||||
|
It is typically called repeatedly, until an OSError exception
|
||||||
|
is raised, indicating no more values.
|
||||||
|
|
||||||
|
The result is a tuple of 3 items:
|
||||||
|
value_name
|
||||||
|
A string that identifies the value.
|
||||||
|
value_data
|
||||||
|
An object that holds the value data, and whose type depends
|
||||||
|
on the underlying registry type.
|
||||||
|
data_type
|
||||||
|
An integer that identifies the type of the value data.
|
||||||
|
"""
|
||||||
|
def ExpandEnvironmentStrings(string: str, /) -> str:
|
||||||
|
"""Expand environment vars.
|
||||||
|
"""
|
||||||
|
def FlushKey(key: _KeyType, /) -> None:
|
||||||
|
"""Writes all the attributes of a key to the registry.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
|
||||||
|
It is not necessary to call FlushKey to change a key. Registry changes
|
||||||
|
are flushed to disk by the registry using its lazy flusher. Registry
|
||||||
|
changes are also flushed to disk at system shutdown. Unlike
|
||||||
|
CloseKey(), the FlushKey() method returns only when all the data has
|
||||||
|
been written to the registry.
|
||||||
|
|
||||||
|
An application should only call FlushKey() if it requires absolute
|
||||||
|
certainty that registry changes are on disk. If you don't know whether
|
||||||
|
a FlushKey() call is required, it probably isn't.
|
||||||
|
"""
|
||||||
|
def LoadKey(key: _KeyType, sub_key: str, file_name: str, /) -> None:
|
||||||
|
"""Insert data into the registry from a file.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
sub_key
|
||||||
|
A string that identifies the sub-key to load.
|
||||||
|
file_name
|
||||||
|
The name of the file to load registry data from. This file must
|
||||||
|
have been created with the SaveKey() function. Under the file
|
||||||
|
allocation table (FAT) file system, the filename may not have an
|
||||||
|
extension.
|
||||||
|
|
||||||
|
Creates a subkey under the specified key and stores registration
|
||||||
|
information from a specified file into that subkey.
|
||||||
|
|
||||||
|
A call to LoadKey() fails if the calling process does not have the
|
||||||
|
SE_RESTORE_PRIVILEGE privilege.
|
||||||
|
|
||||||
|
If key is a handle returned by ConnectRegistry(), then the path
|
||||||
|
specified in fileName is relative to the remote computer.
|
||||||
|
|
||||||
|
The MSDN docs imply key must be in the HKEY_USER or HKEY_LOCAL_MACHINE
|
||||||
|
tree.
|
||||||
|
"""
|
||||||
|
def OpenKey(key: _KeyType, sub_key: str | None, reserved: int = 0, access: int = 131097) -> HKEYType:
|
||||||
|
"""Opens the specified key.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
sub_key
|
||||||
|
A string that identifies the sub_key to open.
|
||||||
|
reserved
|
||||||
|
A reserved integer that must be zero. Default is zero.
|
||||||
|
access
|
||||||
|
An integer that specifies an access mask that describes the desired
|
||||||
|
security access for the key. Default is KEY_READ.
|
||||||
|
|
||||||
|
The result is a new handle to the specified key.
|
||||||
|
If the function fails, an OSError exception is raised.
|
||||||
|
"""
|
||||||
|
def OpenKeyEx(key: _KeyType, sub_key: str | None, reserved: int = 0, access: int = 131097) -> HKEYType:
|
||||||
|
"""Opens the specified key.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
sub_key
|
||||||
|
A string that identifies the sub_key to open.
|
||||||
|
reserved
|
||||||
|
A reserved integer that must be zero. Default is zero.
|
||||||
|
access
|
||||||
|
An integer that specifies an access mask that describes the desired
|
||||||
|
security access for the key. Default is KEY_READ.
|
||||||
|
|
||||||
|
The result is a new handle to the specified key.
|
||||||
|
If the function fails, an OSError exception is raised.
|
||||||
|
"""
|
||||||
|
def QueryInfoKey(key: _KeyType, /) -> tuple[int, int, int]:
|
||||||
|
"""Returns information about a key.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
|
||||||
|
The result is a tuple of 3 items:
|
||||||
|
An integer that identifies the number of sub keys this key has.
|
||||||
|
An integer that identifies the number of values this key has.
|
||||||
|
An integer that identifies when the key was last modified (if available)
|
||||||
|
as 100's of nanoseconds since Jan 1, 1600.
|
||||||
|
"""
|
||||||
|
def QueryValue(key: _KeyType, sub_key: str | None, /) -> str:
|
||||||
|
"""Retrieves the unnamed value for a key.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
sub_key
|
||||||
|
A string that holds the name of the subkey with which the value
|
||||||
|
is associated. If this parameter is None or empty, the function
|
||||||
|
retrieves the value set by the SetValue() method for the key
|
||||||
|
identified by key.
|
||||||
|
|
||||||
|
Values in the registry have name, type, and data components. This method
|
||||||
|
retrieves the data for a key's first value that has a NULL name.
|
||||||
|
But since the underlying API call doesn't return the type, you'll
|
||||||
|
probably be happier using QueryValueEx; this function is just here for
|
||||||
|
completeness.
|
||||||
|
"""
|
||||||
|
def QueryValueEx(key: _KeyType, name: str, /) -> tuple[Any, int]:
|
||||||
|
"""Retrieves the type and value of a specified sub-key.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
name
|
||||||
|
A string indicating the value to query.
|
||||||
|
|
||||||
|
Behaves mostly like QueryValue(), but also returns the type of the
|
||||||
|
specified value name associated with the given open registry key.
|
||||||
|
|
||||||
|
The return value is a tuple of the value and the type_id.
|
||||||
|
"""
|
||||||
|
def SaveKey(key: _KeyType, file_name: str, /) -> None:
|
||||||
|
"""Saves the specified key, and all its subkeys to the specified file.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
file_name
|
||||||
|
The name of the file to save registry data to. This file cannot
|
||||||
|
already exist. If this filename includes an extension, it cannot be
|
||||||
|
used on file allocation table (FAT) file systems by the LoadKey(),
|
||||||
|
ReplaceKey() or RestoreKey() methods.
|
||||||
|
|
||||||
|
If key represents a key on a remote computer, the path described by
|
||||||
|
file_name is relative to the remote computer.
|
||||||
|
|
||||||
|
The caller of this method must possess the SeBackupPrivilege
|
||||||
|
security privilege. This function passes NULL for security_attributes
|
||||||
|
to the API.
|
||||||
|
"""
|
||||||
|
def SetValue(key: _KeyType, sub_key: str | None, type: int, value: str, /) -> None:
|
||||||
|
"""Associates a value with a specified key.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
sub_key
|
||||||
|
A string that names the subkey with which the value is associated.
|
||||||
|
type
|
||||||
|
An integer that specifies the type of the data. Currently this must
|
||||||
|
be REG_SZ, meaning only strings are supported.
|
||||||
|
value
|
||||||
|
A string that specifies the new value.
|
||||||
|
|
||||||
|
If the key specified by the sub_key parameter does not exist, the
|
||||||
|
SetValue function creates it.
|
||||||
|
|
||||||
|
Value lengths are limited by available memory. Long values (more than
|
||||||
|
2048 bytes) should be stored as files with the filenames stored in
|
||||||
|
the configuration registry to help the registry perform efficiently.
|
||||||
|
|
||||||
|
The key identified by the key parameter must have been opened with
|
||||||
|
KEY_SET_VALUE access.
|
||||||
|
"""
|
||||||
@overload # type=REG_DWORD|REG_QWORD
|
@overload # type=REG_DWORD|REG_QWORD
|
||||||
def SetValueEx(
|
def SetValueEx(
|
||||||
key: _KeyType, value_name: str | None, reserved: Unused, type: Literal[4, 5], value: int | None, /
|
key: _KeyType, value_name: str | None, reserved: Unused, type: Literal[4, 5], value: int | None, /
|
||||||
) -> None: ...
|
) -> None:
|
||||||
|
"""Stores data in the value field of an open registry key.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
value_name
|
||||||
|
A string containing the name of the value to set, or None.
|
||||||
|
reserved
|
||||||
|
Can be anything - zero is always passed to the API.
|
||||||
|
type
|
||||||
|
An integer that specifies the type of the data, one of:
|
||||||
|
REG_BINARY -- Binary data in any form.
|
||||||
|
REG_DWORD -- A 32-bit number.
|
||||||
|
REG_DWORD_LITTLE_ENDIAN -- A 32-bit number in little-endian format. Equivalent to REG_DWORD
|
||||||
|
REG_DWORD_BIG_ENDIAN -- A 32-bit number in big-endian format.
|
||||||
|
REG_EXPAND_SZ -- A null-terminated string that contains unexpanded
|
||||||
|
references to environment variables (for example,
|
||||||
|
%PATH%).
|
||||||
|
REG_LINK -- A Unicode symbolic link.
|
||||||
|
REG_MULTI_SZ -- A sequence of null-terminated strings, terminated
|
||||||
|
by two null characters. Note that Python handles
|
||||||
|
this termination automatically.
|
||||||
|
REG_NONE -- No defined value type.
|
||||||
|
REG_QWORD -- A 64-bit number.
|
||||||
|
REG_QWORD_LITTLE_ENDIAN -- A 64-bit number in little-endian format. Equivalent to REG_QWORD.
|
||||||
|
REG_RESOURCE_LIST -- A device-driver resource list.
|
||||||
|
REG_SZ -- A null-terminated string.
|
||||||
|
value
|
||||||
|
A string that specifies the new value.
|
||||||
|
|
||||||
|
This method can also set additional value and type information for the
|
||||||
|
specified key. The key identified by the key parameter must have been
|
||||||
|
opened with KEY_SET_VALUE access.
|
||||||
|
|
||||||
|
To open the key, use the CreateKeyEx() or OpenKeyEx() methods.
|
||||||
|
|
||||||
|
Value lengths are limited by available memory. Long values (more than
|
||||||
|
2048 bytes) should be stored as files with the filenames stored in
|
||||||
|
the configuration registry to help the registry perform efficiently.
|
||||||
|
"""
|
||||||
@overload # type=REG_SZ|REG_EXPAND_SZ
|
@overload # type=REG_SZ|REG_EXPAND_SZ
|
||||||
def SetValueEx(
|
def SetValueEx(
|
||||||
key: _KeyType, value_name: str | None, reserved: Unused, type: Literal[1, 2], value: str | None, /
|
key: _KeyType, value_name: str | None, reserved: Unused, type: Literal[1, 2], value: str | None, /
|
||||||
|
|
@ -55,9 +411,36 @@ if sys.platform == "win32":
|
||||||
value: int | str | list[str] | ReadableBuffer | None,
|
value: int | str | list[str] | ReadableBuffer | None,
|
||||||
/,
|
/,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def DisableReflectionKey(key: _KeyType, /) -> None: ...
|
def DisableReflectionKey(key: _KeyType, /) -> None:
|
||||||
def EnableReflectionKey(key: _KeyType, /) -> None: ...
|
"""Disables registry reflection for 32bit processes running on a 64bit OS.
|
||||||
def QueryReflectionKey(key: _KeyType, /) -> bool: ...
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
|
||||||
|
Will generally raise NotImplementedError if executed on a 32bit OS.
|
||||||
|
|
||||||
|
If the key is not on the reflection list, the function succeeds but has
|
||||||
|
no effect. Disabling reflection for a key does not affect reflection
|
||||||
|
of any subkeys.
|
||||||
|
"""
|
||||||
|
def EnableReflectionKey(key: _KeyType, /) -> None:
|
||||||
|
"""Restores registry reflection for the specified disabled key.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
|
||||||
|
Will generally raise NotImplementedError if executed on a 32bit OS.
|
||||||
|
Restoring reflection for a key does not affect reflection of any
|
||||||
|
subkeys.
|
||||||
|
"""
|
||||||
|
def QueryReflectionKey(key: _KeyType, /) -> bool:
|
||||||
|
"""Returns the reflection state for the specified key as a bool.
|
||||||
|
|
||||||
|
key
|
||||||
|
An already open key, or any one of the predefined HKEY_* constants.
|
||||||
|
|
||||||
|
Will generally raise NotImplementedError if executed on a 32bit OS.
|
||||||
|
"""
|
||||||
|
|
||||||
HKEY_CLASSES_ROOT: Final[int]
|
HKEY_CLASSES_ROOT: Final[int]
|
||||||
HKEY_CURRENT_USER: Final[int]
|
HKEY_CURRENT_USER: Final[int]
|
||||||
|
|
@ -119,14 +502,54 @@ if sys.platform == "win32":
|
||||||
# Though this class has a __name__ of PyHKEY, it's exposed as HKEYType for some reason
|
# Though this class has a __name__ of PyHKEY, it's exposed as HKEYType for some reason
|
||||||
@final
|
@final
|
||||||
class HKEYType:
|
class HKEYType:
|
||||||
def __bool__(self) -> bool: ...
|
"""PyHKEY Object - A Python object, representing a win32 registry key.
|
||||||
def __int__(self) -> int: ...
|
|
||||||
|
This object wraps a Windows HKEY object, automatically closing it when
|
||||||
|
the object is destroyed. To guarantee cleanup, you can call either
|
||||||
|
the Close() method on the PyHKEY, or the CloseKey() method.
|
||||||
|
|
||||||
|
All functions which accept a handle object also accept an integer --
|
||||||
|
however, use of the handle object is encouraged.
|
||||||
|
|
||||||
|
Functions:
|
||||||
|
Close() - Closes the underlying handle.
|
||||||
|
Detach() - Returns the integer Win32 handle, detaching it from the object
|
||||||
|
|
||||||
|
Properties:
|
||||||
|
handle - The integer Win32 handle.
|
||||||
|
|
||||||
|
Operations:
|
||||||
|
__bool__ - Handles with an open object return true, otherwise false.
|
||||||
|
__int__ - Converting a handle to an integer returns the Win32 handle.
|
||||||
|
__enter__, __exit__ - Context manager support for 'with' statement,
|
||||||
|
automatically closes handle.
|
||||||
|
"""
|
||||||
|
def __bool__(self) -> bool:
|
||||||
|
"""True if self else False
|
||||||
|
"""
|
||||||
|
def __int__(self) -> int:
|
||||||
|
"""int(self)
|
||||||
|
"""
|
||||||
def __enter__(self) -> Self: ...
|
def __enter__(self) -> Self: ...
|
||||||
def __exit__(
|
def __exit__(
|
||||||
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None, /
|
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None, /
|
||||||
) -> bool | None: ...
|
) -> bool | None: ...
|
||||||
def Close(self) -> None: ...
|
def Close(self) -> None:
|
||||||
def Detach(self) -> int: ...
|
"""Closes the underlying Windows handle.
|
||||||
|
|
||||||
|
If the handle is already closed, no error is raised.
|
||||||
|
"""
|
||||||
|
def Detach(self) -> int:
|
||||||
|
"""Detaches the Windows handle from the handle object.
|
||||||
|
|
||||||
|
The result is the value of the handle before it is detached. If the
|
||||||
|
handle is already detached, this will return zero.
|
||||||
|
|
||||||
|
After calling this function, the handle is effectively invalidated,
|
||||||
|
but the handle is not closed. You would call this function when you
|
||||||
|
need the underlying win32 handle to exist beyond the lifetime of the
|
||||||
|
handle object.
|
||||||
|
"""
|
||||||
def __hash__(self) -> int: ...
|
def __hash__(self) -> int: ...
|
||||||
@property
|
@property
|
||||||
def handle(self) -> int: ...
|
def handle(self) -> int: ...
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,21 @@
|
||||||
|
"""PlaySound(sound, flags) - play a sound
|
||||||
|
SND_FILENAME - sound is a wav file name
|
||||||
|
SND_ALIAS - sound is a registry sound association name
|
||||||
|
SND_LOOP - Play the sound repeatedly; must also specify SND_ASYNC
|
||||||
|
SND_MEMORY - sound is a memory image of a wav file
|
||||||
|
SND_PURGE - stop all instances of the specified sound
|
||||||
|
SND_ASYNC - PlaySound returns immediately
|
||||||
|
SND_NODEFAULT - Do not play a default beep if the sound can not be found
|
||||||
|
SND_NOSTOP - Do not interrupt any sounds currently playing
|
||||||
|
SND_NOWAIT - Return immediately if the sound driver is busy
|
||||||
|
SND_APPLICATION - sound is an application-specific alias in the registry.
|
||||||
|
SND_SENTRY - Triggers a SoundSentry event when the sound is played.
|
||||||
|
SND_SYNC - Play the sound synchronously, default behavior.
|
||||||
|
SND_SYSTEM - Assign sound to the audio session for system notification sounds.
|
||||||
|
|
||||||
|
Beep(frequency, duration) - Make a beep through the PC speaker.
|
||||||
|
MessageBeep(type) - Call Windows MessageBeep.
|
||||||
|
"""
|
||||||
import sys
|
import sys
|
||||||
from _typeshed import ReadableBuffer
|
from _typeshed import ReadableBuffer
|
||||||
from typing import Final, Literal, overload
|
from typing import Final, Literal, overload
|
||||||
|
|
@ -29,10 +47,29 @@ if sys.platform == "win32":
|
||||||
MB_ICONSTOP: Final = 16
|
MB_ICONSTOP: Final = 16
|
||||||
MB_ICONWARNING: Final = 48
|
MB_ICONWARNING: Final = 48
|
||||||
|
|
||||||
def Beep(frequency: int, duration: int) -> None: ...
|
def Beep(frequency: int, duration: int) -> None:
|
||||||
|
"""A wrapper around the Windows Beep API.
|
||||||
|
|
||||||
|
frequency
|
||||||
|
Frequency of the sound in hertz.
|
||||||
|
Must be in the range 37 through 32,767.
|
||||||
|
duration
|
||||||
|
How long the sound should play, in milliseconds.
|
||||||
|
"""
|
||||||
# Can actually accept anything ORed with 4, and if not it's definitely str, but that's inexpressible
|
# Can actually accept anything ORed with 4, and if not it's definitely str, but that's inexpressible
|
||||||
@overload
|
@overload
|
||||||
def PlaySound(sound: ReadableBuffer | None, flags: Literal[4]) -> None: ...
|
def PlaySound(sound: ReadableBuffer | None, flags: Literal[4]) -> None:
|
||||||
|
"""A wrapper around the Windows PlaySound API.
|
||||||
|
|
||||||
|
sound
|
||||||
|
The sound to play; a filename, data, or None.
|
||||||
|
flags
|
||||||
|
Flag values, ored together. See module documentation.
|
||||||
|
"""
|
||||||
@overload
|
@overload
|
||||||
def PlaySound(sound: str | ReadableBuffer | None, flags: int) -> None: ...
|
def PlaySound(sound: str | ReadableBuffer | None, flags: int) -> None: ...
|
||||||
def MessageBeep(type: int = 0) -> None: ...
|
def MessageBeep(type: int = 0) -> None:
|
||||||
|
"""Call Windows MessageBeep(x).
|
||||||
|
|
||||||
|
x defaults to MB_OK.
|
||||||
|
"""
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,23 @@ else:
|
||||||
>>> translate('**/*')
|
>>> translate('**/*')
|
||||||
'.*/[^/]*'
|
'.*/[^/]*'
|
||||||
"""
|
"""
|
||||||
def match_dirs(pattern: str) -> str: ...
|
def match_dirs(pattern: str) -> str:
|
||||||
def translate_core(pattern: str) -> str: ...
|
"""
|
||||||
|
Ensure that zipfile.Path directory names are matched.
|
||||||
|
|
||||||
|
zipfile.Path directory names always end in a slash.
|
||||||
|
"""
|
||||||
|
def translate_core(pattern: str) -> str:
|
||||||
|
"""
|
||||||
|
Given a glob pattern, produce a regex that matches it.
|
||||||
|
|
||||||
|
>>> translate('*.txt')
|
||||||
|
'[^/]*\\\\.txt'
|
||||||
|
>>> translate('a?txt')
|
||||||
|
'a.txt'
|
||||||
|
>>> translate('**/*')
|
||||||
|
'.*/[^/]*'
|
||||||
|
"""
|
||||||
def replace(match: Match[str]) -> str:
|
def replace(match: Match[str]) -> str:
|
||||||
"""
|
"""
|
||||||
Perform the replacements for a match from :func:`separate`.
|
Perform the replacements for a match from :func:`separate`.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue