Skip to content

Commit dfd954c

Browse files
authored
Bump pexpect to 4.9 (#11287)
1 parent e6e2f22 commit dfd954c

File tree

13 files changed

+325
-186
lines changed

13 files changed

+325
-186
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# python2 shim
2+
pexpect.utils.InterruptedError

stubs/pexpect/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version = "4.8.*"
1+
version = "4.9.*"
22
upstream_repository = "https://github.com/pexpect/pexpect"

stubs/pexpect/pexpect/_async.pyi

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import asyncio
2-
from _typeshed import Incomplete
2+
from typing import AnyStr, Generic
33

4-
async def expect_async(expecter, timeout: Incomplete | None = None): ...
5-
async def repl_run_command_async(repl, cmdlines, timeout: int = -1): ...
4+
from .expect import Expecter
65

7-
class PatternWaiter(asyncio.Protocol):
8-
transport: Incomplete
9-
expecter: Incomplete
10-
fut: Incomplete
11-
def set_expecter(self, expecter) -> None: ...
12-
def found(self, result) -> None: ...
13-
def error(self, exc) -> None: ...
14-
def connection_made(self, transport) -> None: ...
15-
def data_received(self, data) -> None: ...
6+
async def expect_async(expecter: Expecter[AnyStr], timeout: float | None = None) -> int: ...
7+
async def repl_run_command_async(repl, cmdlines, timeout: float | None = -1): ...
8+
9+
class PatternWaiter(asyncio.Protocol, Generic[AnyStr]):
10+
transport: asyncio.ReadTransport | None
11+
expecter: Expecter[AnyStr]
12+
fut: asyncio.Future[int]
13+
def set_expecter(self, expecter: Expecter[AnyStr]) -> None: ...
14+
def found(self, result: int) -> None: ...
15+
def error(self, exc: BaseException | type[BaseException]) -> None: ...
16+
def connection_made(self, transport: asyncio.BaseTransport) -> None: ...
17+
def data_received(self, data: bytes) -> None: ...
1618
def eof_received(self) -> None: ...
17-
def connection_lost(self, exc) -> None: ...
19+
def connection_lost(self, exc: BaseException | type[BaseException] | None) -> None: ...

stubs/pexpect/pexpect/expect.pyi

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
from _typeshed import Incomplete
2-
from io import BytesIO, StringIO
1+
import re
2+
from collections.abc import Iterable
3+
from typing import AnyStr, Generic
34

4-
from .exceptions import EOF, TIMEOUT
5-
from .spawnbase import SpawnBase
5+
from .spawnbase import SpawnBase, _CompiledRePattern, _CompiledStringPattern, _Searcher
66

7-
class searcher_string:
7+
class searcher_string(Generic[AnyStr]):
88
eof_index: int
99
timeout_index: int
1010
longest_string: int
11-
def __init__(self, strings) -> None: ...
12-
match: Incomplete
13-
start: Incomplete
14-
end: Incomplete
15-
def search(self, buffer, freshlen, searchwindowsize: Incomplete | None = None): ...
11+
def __init__(self, strings: Iterable[_CompiledStringPattern[AnyStr]]) -> None: ...
12+
match: AnyStr
13+
start: int
14+
end: int
15+
def search(self, buffer: AnyStr, freshlen: int, searchwindowsize: int | None = None): ...
1616

17-
class searcher_re:
17+
class searcher_re(Generic[AnyStr]):
1818
eof_index: int
1919
timeout_index: int
20-
def __init__(self, patterns) -> None: ...
21-
start: Incomplete
22-
match: Incomplete
23-
end: Incomplete
24-
def search(self, buffer, freshlen: int, searchwindowsize: int | None = None): ...
20+
def __init__(self, patterns: Iterable[_CompiledRePattern[AnyStr]]) -> None: ...
21+
match: re.Match[AnyStr]
22+
start: int
23+
end: int
24+
def search(self, buffer: AnyStr, freshlen: int, searchwindowsize: int | None = None): ...
2525

26-
class Expecter:
27-
spawn: BytesIO | StringIO
28-
searcher: searcher_re | searcher_string
26+
class Expecter(Generic[AnyStr]):
27+
spawn: SpawnBase[AnyStr]
28+
searcher: _Searcher[AnyStr]
2929
searchwindowsize: int | None
30-
lookback: searcher_string | searcher_re | int | None
31-
def __init__(self, spawn: SpawnBase, searcher: searcher_re | searcher_string, searchwindowsize: int = -1) -> None: ...
32-
def do_search(self, window: str, freshlen: int): ...
33-
def existing_data(self): ...
34-
def new_data(self, data: Incomplete): ...
35-
def eof(self, err: Incomplete | None = None) -> int | EOF: ...
36-
def timeout(self, err: object | None = None) -> int | TIMEOUT: ...
30+
lookback: _Searcher[AnyStr] | int | None
31+
def __init__(self, spawn: SpawnBase[AnyStr], searcher: _Searcher[AnyStr], searchwindowsize: int | None = -1) -> None: ...
32+
def do_search(self, window: AnyStr, freshlen: int) -> int: ...
33+
def existing_data(self) -> int: ...
34+
def new_data(self, data: AnyStr) -> int: ...
35+
def eof(self, err: object = None) -> int: ...
36+
def timeout(self, err: object = None) -> int: ...
3737
def errored(self) -> None: ...
38-
def expect_loop(self, timeout: int = -1): ...
38+
def expect_loop(self, timeout: float | None = -1) -> int: ...

stubs/pexpect/pexpect/fdpexpect.pyi

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
1-
from _typeshed import Incomplete
1+
from _typeshed import FileDescriptorLike
2+
from collections.abc import Iterable
3+
from typing import AnyStr
24

35
from .spawnbase import SpawnBase, _Logfile
46

5-
class fdspawn(SpawnBase):
6-
args: Incomplete
7-
command: Incomplete
8-
child_fd: Incomplete
7+
__all__ = ["fdspawn"]
8+
9+
class fdspawn(SpawnBase[AnyStr]):
10+
args: None
11+
command: None
12+
child_fd: int
913
own_fd: bool
1014
closed: bool
11-
name: Incomplete
12-
use_poll: Incomplete
15+
name: str
16+
use_poll: bool
1317
def __init__(
1418
self,
15-
fd,
16-
args: Incomplete | None = None,
17-
timeout: int = 30,
19+
fd: FileDescriptorLike,
20+
args: None = None,
21+
timeout: float | None = 30,
1822
maxread: int = 2000,
19-
searchwindowsize: Incomplete | None = None,
23+
searchwindowsize: int | None = None,
2024
logfile: _Logfile | None = None,
21-
encoding: Incomplete | None = None,
25+
encoding: str | None = None,
2226
codec_errors: str = "strict",
2327
use_poll: bool = False,
2428
) -> None: ...
2529
def close(self) -> None: ...
2630
def isalive(self) -> bool: ...
2731
def terminate(self, force: bool = False) -> None: ...
28-
def send(self, s: str | bytes) -> bytes: ...
29-
def sendline(self, s: str | bytes) -> bytes: ...
32+
def send(self, s: str | bytes) -> int: ...
33+
def sendline(self, s: str | bytes) -> int: ...
3034
def write(self, s) -> None: ...
31-
def writelines(self, sequence) -> None: ...
32-
def read_nonblocking(self, size: int = 1, timeout: int | None = -1) -> bytes: ...
35+
def writelines(self, sequence: Iterable[str | bytes]) -> None: ...
36+
def read_nonblocking(self, size: int = 1, timeout: float | None = -1) -> AnyStr: ...

stubs/pexpect/pexpect/popen_spawn.pyi

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
from _typeshed import Incomplete
1+
import subprocess
2+
from _typeshed import StrOrBytesPath
3+
from collections.abc import Callable
4+
from os import _Environ
5+
from typing import AnyStr
26

37
from .spawnbase import SpawnBase, _Logfile
48

5-
class PopenSpawn(SpawnBase):
6-
crlf: Incomplete
7-
proc: Incomplete
8-
pid: Incomplete
9+
class PopenSpawn(SpawnBase[AnyStr]):
10+
proc: subprocess.Popen[AnyStr]
911
closed: bool
1012
def __init__(
1113
self,
1214
cmd,
13-
timeout: int = 30,
15+
timeout: float | None = 30,
1416
maxread: int = 2000,
15-
searchwindowsize: Incomplete | None = None,
17+
searchwindowsize: int | None = None,
1618
logfile: _Logfile | None = None,
17-
cwd: Incomplete | None = None,
18-
env: Incomplete | None = None,
19-
encoding: Incomplete | None = None,
19+
cwd: StrOrBytesPath | None = None,
20+
env: _Environ[str] | None = None,
21+
encoding: str | None = None,
2022
codec_errors: str = "strict",
21-
preexec_fn: Incomplete | None = None,
23+
preexec_fn: Callable[[], None] | None = None,
2224
) -> None: ...
2325
flag_eof: bool
2426
def read_nonblocking(self, size, timeout): ...
2527
def write(self, s) -> None: ...
2628
def writelines(self, sequence) -> None: ...
2729
def send(self, s): ...
2830
def sendline(self, s: str = ""): ...
29-
exitstatus: Incomplete
30-
signalstatus: Incomplete
3131
terminated: bool
3232
def wait(self): ...
3333
def kill(self, sig) -> None: ...

stubs/pexpect/pexpect/pty_spawn.pyi

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1-
from _typeshed import Incomplete
1+
from _typeshed import FileDescriptorOrPath
22
from collections.abc import Callable
33
from os import _Environ
4+
from typing import AnyStr
45

56
from .spawnbase import SpawnBase, _Logfile
67

7-
PY3: Incomplete
8+
PY3: bool
89

9-
class spawn(SpawnBase):
10+
class spawn(SpawnBase[AnyStr]):
1011
use_native_pty_fork: bool
11-
STDIN_FILENO: Incomplete
12-
STDOUT_FILENO: Incomplete
13-
STDERR_FILENO: Incomplete
12+
STDIN_FILENO: int
13+
STDOUT_FILENO: int
14+
STDERR_FILENO: int
1415
str_last_chars: int
15-
env: Incomplete
16+
cwd: FileDescriptorOrPath | None
17+
env: _Environ[str]
18+
echo: bool
19+
ignore_sighup: bool
20+
command: str
21+
args: list[str]
1622
name: str
23+
use_poll: bool
1724
def __init__(
1825
self,
1926
command: str,
@@ -22,11 +29,11 @@ class spawn(SpawnBase):
2229
maxread: int = 2000,
2330
searchwindowsize: int | None = None,
2431
logfile: _Logfile | None = None,
25-
cwd: str | bytes | None = None,
26-
env: _Environ[Incomplete] | None = None,
32+
cwd: FileDescriptorOrPath | None = None,
33+
env: _Environ[str] | None = None,
2734
ignore_sighup: bool = False,
2835
echo: bool = True,
29-
preexec_fn: Callable[[Incomplete], Incomplete] | None = None,
36+
preexec_fn: Callable[[], None] | None = None,
3037
encoding: str | None = None,
3138
codec_errors: str = "strict",
3239
dimensions: tuple[int, int] | None = None,
@@ -35,24 +42,24 @@ class spawn(SpawnBase):
3542
child_fd: int
3643
closed: bool
3744
def close(self, force: bool = True) -> None: ...
38-
def isatty(self): ...
39-
def waitnoecho(self, timeout: int = -1): ...
40-
def getecho(self): ...
41-
def setecho(self, state: bool): ...
42-
def read_nonblocking(self, size: int = 1, timeout: int | None = -1) -> bytes: ...
45+
def isatty(self) -> bool: ...
46+
def waitnoecho(self, timeout: float | None = -1) -> None: ...
47+
def getecho(self) -> bool: ...
48+
def setecho(self, state: bool) -> None: ...
49+
def read_nonblocking(self, size: int = 1, timeout: float | None = -1) -> AnyStr: ...
4350
def write(self, s: str | bytes) -> None: ...
4451
def writelines(self, sequence: list[str | bytes]) -> None: ...
45-
def send(self, s: str | bytes): ...
46-
def sendline(self, s: str | bytes = ""): ...
47-
def sendcontrol(self, char: str): ...
52+
def send(self, s: str | bytes) -> int: ...
53+
def sendline(self, s: str | bytes = "") -> int: ...
54+
def sendcontrol(self, char: str) -> int: ...
4855
def sendeof(self) -> None: ...
4956
def sendintr(self) -> None: ...
5057
@property
5158
def flag_eof(self) -> bool: ...
5259
@flag_eof.setter
5360
def flag_eof(self, value: bool) -> None: ...
5461
def eof(self) -> bool: ...
55-
def terminate(self, force: bool = False): ...
62+
def terminate(self, force: bool = False) -> bool: ...
5663
status: int | None
5764
exitstatus: bool | None
5865
signalstatus: int | None
@@ -65,8 +72,24 @@ class spawn(SpawnBase):
6572
def interact(
6673
self,
6774
escape_character="\x1d",
68-
input_filter: Callable[[Incomplete], Incomplete] | None = None,
69-
output_filter: Callable[[Incomplete], Incomplete] | None = None,
75+
input_filter: Callable[[AnyStr], AnyStr] | None = None,
76+
output_filter: Callable[[AnyStr], AnyStr] | None = None,
7077
) -> None: ...
7178

72-
def spawnu(*args: str, **kwargs: str): ...
79+
def spawnu(
80+
command: str,
81+
args: list[str] = [],
82+
timeout: float | None = 30,
83+
maxread: int = 2000,
84+
searchwindowsize: int | None = None,
85+
logfile: _Logfile | None = None,
86+
cwd: FileDescriptorOrPath | None = None,
87+
env: _Environ[str] | None = None,
88+
ignore_sighup: bool = False,
89+
echo: bool = True,
90+
preexec_fn: Callable[[], None] | None = None,
91+
encoding: str | None = "utf-8",
92+
codec_errors: str = "strict",
93+
dimensions: tuple[int, int] | None = None,
94+
use_poll: bool = False,
95+
) -> spawn[str]: ...

0 commit comments

Comments
 (0)