codekingpro/portable-devtools
114k
1# -*- coding: utf-8 -*-
2
3"""Stub typing declarations for the native PTY object."""
4
5# Standard library imports
6from typing import Optional
7
8# Local imports
9from .enums import Backend, Encoding, MouseMode, AgentConfig
10
11
12class PTY:
13 def __init__(self, cols: int, rows: int,
14 backend: Optional[int] = None,
15 encoding: Optional[str] = Encoding.UTF8,
16 mouse_mode: int = MouseMode.WINPTY_MOUSE_MODE_NONE,
17 timeout: int = 30000,
18 agent_config: int = AgentConfig.WINPTY_FLAG_COLOR_ESCAPES):
19 ...
20
21 def spawn(self,
22 appname: bytes,
23 cmdline: Optional[bytes] = None,
24 cwd: Optional[bytes] = None,
25 env: Optional[bytes] = None) -> bool:
26 ...
27
28 def set_size(self, cols: int, rows: int): ...
29
30 def read(self,
31 length: Optional[int] = 1000,
32 blocking: bool = False) -> bytes:
33 ...
34
35 def read_stderr(self,
36 length: Optional[int] = 1000,
37 blocking: bool = False) -> bytes:
38 ...
39
40 def write(self, to_write: bytes) -> int: ...
41
42 def isalive(self) -> bool: ...
43
44 def get_exitstatus(self) -> Optional[int]: ...
45
46 def iseof(self) -> bool: ...
47
48 @property
49 def pid(self) -> Optional[int]: ...
50
51 @property
52 def fd(self) -> Optional[int]: ...
53 