mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-08 04:23:24 +08:00
Use overlapped signatures of _winapi functions (#2723)
For python/mypy#6148
This commit is contained in:
committed by
Sebastian Rittau
parent
eb6dbe510d
commit
ad304cb9ee
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Union, Tuple, Optional, Dict, NoReturn, Sequence
|
||||
from typing import Any, Union, Tuple, Optional, overload, Dict, NoReturn, Sequence
|
||||
|
||||
CREATE_NEW_CONSOLE: int
|
||||
CREATE_NEW_PROCESS_GROUP: int
|
||||
@@ -45,7 +45,13 @@ WAIT_OBJECT_0: int
|
||||
WAIT_TIMEOUT: int
|
||||
|
||||
def CloseHandle(handle: int) -> None: ...
|
||||
def ConnectNamedPipe(handle: int, overlapped: Union[int, bool] = ...) -> None: ...
|
||||
|
||||
# TODO: once literal types are supported, overload with Literal[True/False]
|
||||
@overload
|
||||
def ConnectNamedPipe(handle: int, overlapped: Union[int, bool]) -> Any: ...
|
||||
@overload
|
||||
def ConnectNamedPipe(handle: int) -> None: ...
|
||||
|
||||
def CreateFile(file_name: str, desired_access: int, share_mode: int, security_attributes: int, creation_disposition: int, flags_and_attributes: int, template_file: int) -> int: ...
|
||||
def CreateJunction(src_path: str, dest_path: str) -> None: ...
|
||||
def CreateNamedPipe(name: str, open_mode: int, pipe_mode: int, max_instances: int, out_buffer_size: int, in_buffer_size: int, default_timeout: int, security_attributes: int) -> int: ...
|
||||
@@ -63,13 +69,25 @@ def GetStdHandle(std_handle: int) -> int: ...
|
||||
def GetVersion() -> int: ...
|
||||
def OpenProcess(desired_access: int, inherit_handle: bool, process_id: int) -> int: ...
|
||||
def PeekNamedPipe(handle: int, size: int = ...) -> Union[Tuple[int, int], Tuple[bytes, int, int]]: ...
|
||||
def ReadFile(handle: int, size: int, overlapped: Union[int, bool] = ...) -> Tuple[bytes, int]: ...
|
||||
|
||||
# TODO: once literal types are supported, overload with Literal[True/False]
|
||||
@overload
|
||||
def ReadFile(handle: int, size: int, overlapped: Union[int, bool]) -> Any: ...
|
||||
@overload
|
||||
def ReadFile(handle: int, size: int) -> Tuple[int, int]: ...
|
||||
|
||||
def SetNamedPipeHandleState(named_pipe: int, mode: Optional[int], max_collection_count: Optional[int], collect_data_timeout: Optional[int]) -> None: ...
|
||||
def TerminateProcess(handle: int, exit_code: int) -> None: ...
|
||||
def WaitForMultipleObjects(handle_seq: Sequence[int], wait_flag: bool, milliseconds: int = ...) -> int: ...
|
||||
def WaitForSingleObject(handle: int, milliseconds: int) -> int: ...
|
||||
def WaitNamedPipe(name: str, timeout: int) -> None: ...
|
||||
def WriteFile(handle: int, buffer: bytes, overlapped: Union[int, bool] = ...): ...
|
||||
|
||||
# TODO: once literal types are supported, overload with Literal[True/False]
|
||||
@overload
|
||||
def WriteFile(handle: int, buffer: bytes, overlapped: Union[int, bool]) -> Any: ...
|
||||
@overload
|
||||
def WriteFile(handle: int, buffer: bytes) -> Tuple[bytes, int]: ...
|
||||
|
||||
|
||||
class Overlapped:
|
||||
event: int = ...
|
||||
|
||||
Reference in New Issue
Block a user