mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Clean up signal.pyi (#6504)
This PR proposes purely cosmetic changes to make `signal.pyi` a bit neater.
This commit is contained in:
@@ -3,56 +3,36 @@ from enum import IntEnum
|
||||
from types import FrameType
|
||||
from typing import Any, Callable, Iterable, Optional, Tuple, Union
|
||||
|
||||
if sys.platform != "win32":
|
||||
class ItimerError(IOError): ...
|
||||
ITIMER_PROF: int
|
||||
ITIMER_REAL: int
|
||||
ITIMER_VIRTUAL: int
|
||||
|
||||
NSIG: int
|
||||
|
||||
class Signals(IntEnum):
|
||||
SIGABRT: int
|
||||
if sys.platform != "win32":
|
||||
SIGALRM: int
|
||||
SIGEMT: int
|
||||
SIGFPE: int
|
||||
SIGILL: int
|
||||
SIGINFO: int
|
||||
SIGINT: int
|
||||
SIGSEGV: int
|
||||
SIGTERM: int
|
||||
|
||||
if sys.platform == "win32":
|
||||
SIGBREAK: int
|
||||
CTRL_C_EVENT: int
|
||||
CTRL_BREAK_EVENT: int
|
||||
if sys.platform != "win32":
|
||||
else:
|
||||
SIGALRM: int
|
||||
SIGBUS: int
|
||||
SIGCHLD: int
|
||||
if sys.platform != "darwin" and sys.platform != "win32":
|
||||
SIGCLD: int
|
||||
if sys.platform != "win32":
|
||||
SIGCONT: int
|
||||
SIGEMT: int
|
||||
SIGFPE: int
|
||||
if sys.platform != "win32":
|
||||
SIGHUP: int
|
||||
SIGILL: int
|
||||
SIGINFO: int
|
||||
SIGINT: int
|
||||
if sys.platform != "win32":
|
||||
SIGIO: int
|
||||
SIGIOT: int
|
||||
SIGKILL: int
|
||||
SIGPIPE: int
|
||||
if sys.platform != "darwin" and sys.platform != "win32":
|
||||
SIGPOLL: int
|
||||
SIGPWR: int
|
||||
if sys.platform != "win32":
|
||||
SIGPROF: int
|
||||
SIGQUIT: int
|
||||
if sys.platform != "darwin" and sys.platform != "win32":
|
||||
SIGRTMAX: int
|
||||
SIGRTMIN: int
|
||||
SIGSEGV: int
|
||||
if sys.platform != "win32":
|
||||
SIGSTOP: int
|
||||
SIGSYS: int
|
||||
SIGTERM: int
|
||||
if sys.platform != "win32":
|
||||
SIGTRAP: int
|
||||
SIGTSTP: int
|
||||
SIGTTIN: int
|
||||
@@ -64,65 +44,54 @@ class Signals(IntEnum):
|
||||
SIGWINCH: int
|
||||
SIGXCPU: int
|
||||
SIGXFSZ: int
|
||||
if sys.platform != "darwin":
|
||||
SIGCLD: int
|
||||
SIGPOLL: int
|
||||
SIGPWR: int
|
||||
SIGRTMAX: int
|
||||
SIGRTMIN: int
|
||||
|
||||
class Handlers(IntEnum):
|
||||
SIG_DFL: int
|
||||
SIG_IGN: int
|
||||
|
||||
SIG_DFL = Handlers.SIG_DFL
|
||||
SIG_IGN = Handlers.SIG_IGN
|
||||
|
||||
if sys.platform != "win32":
|
||||
class Sigmasks(IntEnum):
|
||||
SIG_BLOCK: int
|
||||
SIG_UNBLOCK: int
|
||||
SIG_SETMASK: int
|
||||
SIG_BLOCK = Sigmasks.SIG_BLOCK
|
||||
SIG_UNBLOCK = Sigmasks.SIG_UNBLOCK
|
||||
SIG_SETMASK = Sigmasks.SIG_SETMASK
|
||||
SIG_DFL: Handlers
|
||||
SIG_IGN: Handlers
|
||||
|
||||
_SIGNUM = Union[int, Signals]
|
||||
_HANDLER = Union[Callable[[int, Optional[FrameType]], Any], int, Handlers, None]
|
||||
|
||||
def default_int_handler(signum: int, frame: FrameType) -> None: ...
|
||||
def getsignal(__signalnum: _SIGNUM) -> _HANDLER: ...
|
||||
def signal(__signalnum: _SIGNUM, __handler: _HANDLER) -> _HANDLER: ...
|
||||
|
||||
SIGABRT: Signals
|
||||
if sys.platform != "win32":
|
||||
SIGALRM: Signals
|
||||
if sys.platform == "win32":
|
||||
SIGBREAK: Signals
|
||||
if sys.platform != "win32":
|
||||
SIGBUS: Signals
|
||||
SIGCHLD: Signals
|
||||
if sys.platform != "darwin" and sys.platform != "win32":
|
||||
SIGCLD: Signals
|
||||
if sys.platform != "win32":
|
||||
SIGCONT: Signals
|
||||
SIGEMT: Signals
|
||||
SIGFPE: Signals
|
||||
if sys.platform != "win32":
|
||||
SIGHUP: Signals
|
||||
SIGILL: Signals
|
||||
SIGINFO: Signals
|
||||
SIGINT: Signals
|
||||
if sys.platform != "win32":
|
||||
SIGSEGV: Signals
|
||||
SIGTERM: Signals
|
||||
|
||||
if sys.platform == "win32":
|
||||
SIGBREAK: Signals
|
||||
CTRL_C_EVENT: Signals
|
||||
CTRL_BREAK_EVENT: Signals
|
||||
else:
|
||||
SIGALRM: Signals
|
||||
SIGBUS: Signals
|
||||
SIGCHLD: Signals
|
||||
SIGCONT: Signals
|
||||
SIGHUP: Signals
|
||||
SIGIO: Signals
|
||||
SIGIOT: Signals
|
||||
SIGKILL: Signals
|
||||
SIGPIPE: Signals
|
||||
if sys.platform != "darwin" and sys.platform != "win32":
|
||||
SIGPOLL: Signals
|
||||
SIGPWR: Signals
|
||||
if sys.platform != "win32":
|
||||
SIGPROF: Signals
|
||||
SIGQUIT: Signals
|
||||
if sys.platform != "darwin" and sys.platform != "win32":
|
||||
SIGRTMAX: Signals
|
||||
SIGRTMIN: Signals
|
||||
SIGSEGV: Signals
|
||||
if sys.platform != "win32":
|
||||
SIGSTOP: Signals
|
||||
SIGSYS: Signals
|
||||
SIGTERM: Signals
|
||||
if sys.platform != "win32":
|
||||
SIGTRAP: Signals
|
||||
SIGTSTP: Signals
|
||||
SIGTTIN: Signals
|
||||
@@ -134,64 +103,58 @@ if sys.platform != "win32":
|
||||
SIGWINCH: Signals
|
||||
SIGXCPU: Signals
|
||||
SIGXFSZ: Signals
|
||||
|
||||
if sys.platform == "win32":
|
||||
CTRL_C_EVENT: Signals
|
||||
CTRL_BREAK_EVENT: Signals
|
||||
|
||||
if sys.platform != "win32" and sys.platform != "darwin":
|
||||
class struct_siginfo(Tuple[int, int, int, int, int, int, int]):
|
||||
def __init__(self, sequence: Iterable[int]) -> None: ...
|
||||
@property
|
||||
def si_signo(self) -> int: ...
|
||||
@property
|
||||
def si_code(self) -> int: ...
|
||||
@property
|
||||
def si_errno(self) -> int: ...
|
||||
@property
|
||||
def si_pid(self) -> int: ...
|
||||
@property
|
||||
def si_uid(self) -> int: ...
|
||||
@property
|
||||
def si_status(self) -> int: ...
|
||||
@property
|
||||
def si_band(self) -> int: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
class ItimerError(IOError): ...
|
||||
ITIMER_PROF: int
|
||||
ITIMER_REAL: int
|
||||
ITIMER_VIRTUAL: int
|
||||
class Sigmasks(IntEnum):
|
||||
SIG_BLOCK: int
|
||||
SIG_UNBLOCK: int
|
||||
SIG_SETMASK: int
|
||||
SIG_BLOCK = Sigmasks.SIG_BLOCK
|
||||
SIG_UNBLOCK = Sigmasks.SIG_UNBLOCK
|
||||
SIG_SETMASK = Sigmasks.SIG_SETMASK
|
||||
def alarm(__seconds: int) -> int: ...
|
||||
|
||||
def default_int_handler(signum: int, frame: FrameType) -> None: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
def getitimer(__which: int) -> tuple[float, float]: ...
|
||||
|
||||
def getsignal(__signalnum: _SIGNUM) -> _HANDLER: ...
|
||||
def pause() -> None: ...
|
||||
def pthread_kill(__thread_id: int, __signalnum: int) -> None: ...
|
||||
def pthread_sigmask(__how: int, __mask: Iterable[int]) -> set[_SIGNUM]: ...
|
||||
def setitimer(__which: int, __seconds: float, __interval: float = ...) -> tuple[float, float]: ...
|
||||
def siginterrupt(__signalnum: int, __flag: bool) -> None: ...
|
||||
def sigpending() -> Any: ...
|
||||
def sigwait(__sigset: Iterable[int]) -> _SIGNUM: ...
|
||||
if sys.platform != "darwin":
|
||||
SIGCLD: Signals
|
||||
SIGPOLL: Signals
|
||||
SIGPWR: Signals
|
||||
SIGRTMAX: Signals
|
||||
SIGRTMIN: Signals
|
||||
class struct_siginfo(Tuple[int, int, int, int, int, int, int]):
|
||||
def __init__(self, sequence: Iterable[int]) -> None: ...
|
||||
@property
|
||||
def si_signo(self) -> int: ...
|
||||
@property
|
||||
def si_code(self) -> int: ...
|
||||
@property
|
||||
def si_errno(self) -> int: ...
|
||||
@property
|
||||
def si_pid(self) -> int: ...
|
||||
@property
|
||||
def si_uid(self) -> int: ...
|
||||
@property
|
||||
def si_status(self) -> int: ...
|
||||
@property
|
||||
def si_band(self) -> int: ...
|
||||
def sigtimedwait(sigset: Iterable[int], timeout: float) -> struct_siginfo | None: ...
|
||||
def sigwaitinfo(sigset: Iterable[int]) -> struct_siginfo: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
def strsignal(__signalnum: _SIGNUM) -> str | None: ...
|
||||
def valid_signals() -> set[Signals]: ...
|
||||
def raise_signal(__signalnum: _SIGNUM) -> None: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
def pause() -> None: ...
|
||||
def pthread_kill(__thread_id: int, __signalnum: int) -> None: ...
|
||||
def pthread_sigmask(__how: int, __mask: Iterable[int]) -> set[_SIGNUM]: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
def set_wakeup_fd(fd: int, *, warn_on_full_buffer: bool = ...) -> int: ...
|
||||
|
||||
else:
|
||||
def set_wakeup_fd(fd: int) -> int: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
def setitimer(__which: int, __seconds: float, __interval: float = ...) -> tuple[float, float]: ...
|
||||
def siginterrupt(__signalnum: int, __flag: bool) -> None: ...
|
||||
|
||||
def signal(__signalnum: _SIGNUM, __handler: _HANDLER) -> _HANDLER: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
def sigpending() -> Any: ...
|
||||
def sigwait(__sigset: Iterable[int]) -> _SIGNUM: ...
|
||||
if sys.platform != "darwin":
|
||||
def sigtimedwait(sigset: Iterable[int], timeout: float) -> struct_siginfo | None: ...
|
||||
def sigwaitinfo(sigset: Iterable[int]) -> struct_siginfo: ...
|
||||
|
||||
Reference in New Issue
Block a user