| 1 | import sys |
| 2 | from collections.abc import Callable, Iterable |
| 3 | from typing import Final |
| 4 | from typing_extensions import TypeAlias, deprecated |
| 5 | |
| 6 | if sys.platform != "win32": |
| 7 | __all__ = ["openpty", "fork", "spawn"] |
| 8 | _Reader: TypeAlias = Callable[[int], bytes] |
| 9 | |
| 10 | STDIN_FILENO: Final = 0 |
| 11 | STDOUT_FILENO: Final = 1 |
| 12 | STDERR_FILENO: Final = 2 |
| 13 | |
| 14 | CHILD: Final = 0 |
| 15 | def openpty() -> tuple[int, int]: ... |
| 16 | |
| 17 | if sys.version_info < (3, 14): |
| 18 | if sys.version_info >= (3, 12): |
| 19 | @deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `openpty()` instead.") |
| 20 | def master_open() -> tuple[int, str]: ... |
| 21 | @deprecated("Deprecated since Python 3.12; removed in Python 3.14. Use `openpty()` instead.") |
| 22 | def slave_open(tty_name: str) -> int: ... |
| 23 | else: |
| 24 | def master_open() -> tuple[int, str]: ... |
| 25 | def slave_open(tty_name: str) -> int: ... |
| 26 | |
| 27 | def fork() -> tuple[int, int]: ... |
| 28 | def spawn(argv: str | Iterable[str], master_read: _Reader = ..., stdin_read: _Reader = ...) -> int: ... |