Skip to content

Commit

Permalink
Bump pexpect to 4.9 (#11287)
Browse files Browse the repository at this point in the history
  • Loading branch information
tapple authored Feb 6, 2024
1 parent e6e2f22 commit dfd954c
Show file tree
Hide file tree
Showing 13 changed files with 325 additions and 186 deletions.
2 changes: 2 additions & 0 deletions stubs/pexpect/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# python2 shim
pexpect.utils.InterruptedError
2 changes: 1 addition & 1 deletion stubs/pexpect/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "4.8.*"
version = "4.9.*"
upstream_repository = "https://github.com/pexpect/pexpect"
28 changes: 15 additions & 13 deletions stubs/pexpect/pexpect/_async.pyi
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import asyncio
from _typeshed import Incomplete
from typing import AnyStr, Generic

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

class PatternWaiter(asyncio.Protocol):
transport: Incomplete
expecter: Incomplete
fut: Incomplete
def set_expecter(self, expecter) -> None: ...
def found(self, result) -> None: ...
def error(self, exc) -> None: ...
def connection_made(self, transport) -> None: ...
def data_received(self, data) -> None: ...
async def expect_async(expecter: Expecter[AnyStr], timeout: float | None = None) -> int: ...
async def repl_run_command_async(repl, cmdlines, timeout: float | None = -1): ...

class PatternWaiter(asyncio.Protocol, Generic[AnyStr]):
transport: asyncio.ReadTransport | None
expecter: Expecter[AnyStr]
fut: asyncio.Future[int]
def set_expecter(self, expecter: Expecter[AnyStr]) -> None: ...
def found(self, result: int) -> None: ...
def error(self, exc: BaseException | type[BaseException]) -> None: ...
def connection_made(self, transport: asyncio.BaseTransport) -> None: ...
def data_received(self, data: bytes) -> None: ...
def eof_received(self) -> None: ...
def connection_lost(self, exc) -> None: ...
def connection_lost(self, exc: BaseException | type[BaseException] | None) -> None: ...
54 changes: 27 additions & 27 deletions stubs/pexpect/pexpect/expect.pyi
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
from _typeshed import Incomplete
from io import BytesIO, StringIO
import re
from collections.abc import Iterable
from typing import AnyStr, Generic

from .exceptions import EOF, TIMEOUT
from .spawnbase import SpawnBase
from .spawnbase import SpawnBase, _CompiledRePattern, _CompiledStringPattern, _Searcher

class searcher_string:
class searcher_string(Generic[AnyStr]):
eof_index: int
timeout_index: int
longest_string: int
def __init__(self, strings) -> None: ...
match: Incomplete
start: Incomplete
end: Incomplete
def search(self, buffer, freshlen, searchwindowsize: Incomplete | None = None): ...
def __init__(self, strings: Iterable[_CompiledStringPattern[AnyStr]]) -> None: ...
match: AnyStr
start: int
end: int
def search(self, buffer: AnyStr, freshlen: int, searchwindowsize: int | None = None): ...

class searcher_re:
class searcher_re(Generic[AnyStr]):
eof_index: int
timeout_index: int
def __init__(self, patterns) -> None: ...
start: Incomplete
match: Incomplete
end: Incomplete
def search(self, buffer, freshlen: int, searchwindowsize: int | None = None): ...
def __init__(self, patterns: Iterable[_CompiledRePattern[AnyStr]]) -> None: ...
match: re.Match[AnyStr]
start: int
end: int
def search(self, buffer: AnyStr, freshlen: int, searchwindowsize: int | None = None): ...

class Expecter:
spawn: BytesIO | StringIO
searcher: searcher_re | searcher_string
class Expecter(Generic[AnyStr]):
spawn: SpawnBase[AnyStr]
searcher: _Searcher[AnyStr]
searchwindowsize: int | None
lookback: searcher_string | searcher_re | int | None
def __init__(self, spawn: SpawnBase, searcher: searcher_re | searcher_string, searchwindowsize: int = -1) -> None: ...
def do_search(self, window: str, freshlen: int): ...
def existing_data(self): ...
def new_data(self, data: Incomplete): ...
def eof(self, err: Incomplete | None = None) -> int | EOF: ...
def timeout(self, err: object | None = None) -> int | TIMEOUT: ...
lookback: _Searcher[AnyStr] | int | None
def __init__(self, spawn: SpawnBase[AnyStr], searcher: _Searcher[AnyStr], searchwindowsize: int | None = -1) -> None: ...
def do_search(self, window: AnyStr, freshlen: int) -> int: ...
def existing_data(self) -> int: ...
def new_data(self, data: AnyStr) -> int: ...
def eof(self, err: object = None) -> int: ...
def timeout(self, err: object = None) -> int: ...
def errored(self) -> None: ...
def expect_loop(self, timeout: int = -1): ...
def expect_loop(self, timeout: float | None = -1) -> int: ...
36 changes: 20 additions & 16 deletions stubs/pexpect/pexpect/fdpexpect.pyi
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
from _typeshed import Incomplete
from _typeshed import FileDescriptorLike
from collections.abc import Iterable
from typing import AnyStr

from .spawnbase import SpawnBase, _Logfile

class fdspawn(SpawnBase):
args: Incomplete
command: Incomplete
child_fd: Incomplete
__all__ = ["fdspawn"]

class fdspawn(SpawnBase[AnyStr]):
args: None
command: None
child_fd: int
own_fd: bool
closed: bool
name: Incomplete
use_poll: Incomplete
name: str
use_poll: bool
def __init__(
self,
fd,
args: Incomplete | None = None,
timeout: int = 30,
fd: FileDescriptorLike,
args: None = None,
timeout: float | None = 30,
maxread: int = 2000,
searchwindowsize: Incomplete | None = None,
searchwindowsize: int | None = None,
logfile: _Logfile | None = None,
encoding: Incomplete | None = None,
encoding: str | None = None,
codec_errors: str = "strict",
use_poll: bool = False,
) -> None: ...
def close(self) -> None: ...
def isalive(self) -> bool: ...
def terminate(self, force: bool = False) -> None: ...
def send(self, s: str | bytes) -> bytes: ...
def sendline(self, s: str | bytes) -> bytes: ...
def send(self, s: str | bytes) -> int: ...
def sendline(self, s: str | bytes) -> int: ...
def write(self, s) -> None: ...
def writelines(self, sequence) -> None: ...
def read_nonblocking(self, size: int = 1, timeout: int | None = -1) -> bytes: ...
def writelines(self, sequence: Iterable[str | bytes]) -> None: ...
def read_nonblocking(self, size: int = 1, timeout: float | None = -1) -> AnyStr: ...
26 changes: 13 additions & 13 deletions stubs/pexpect/pexpect/popen_spawn.pyi
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
from _typeshed import Incomplete
import subprocess
from _typeshed import StrOrBytesPath
from collections.abc import Callable
from os import _Environ
from typing import AnyStr

from .spawnbase import SpawnBase, _Logfile

class PopenSpawn(SpawnBase):
crlf: Incomplete
proc: Incomplete
pid: Incomplete
class PopenSpawn(SpawnBase[AnyStr]):
proc: subprocess.Popen[AnyStr]
closed: bool
def __init__(
self,
cmd,
timeout: int = 30,
timeout: float | None = 30,
maxread: int = 2000,
searchwindowsize: Incomplete | None = None,
searchwindowsize: int | None = None,
logfile: _Logfile | None = None,
cwd: Incomplete | None = None,
env: Incomplete | None = None,
encoding: Incomplete | None = None,
cwd: StrOrBytesPath | None = None,
env: _Environ[str] | None = None,
encoding: str | None = None,
codec_errors: str = "strict",
preexec_fn: Incomplete | None = None,
preexec_fn: Callable[[], None] | None = None,
) -> None: ...
flag_eof: bool
def read_nonblocking(self, size, timeout): ...
def write(self, s) -> None: ...
def writelines(self, sequence) -> None: ...
def send(self, s): ...
def sendline(self, s: str = ""): ...
exitstatus: Incomplete
signalstatus: Incomplete
terminated: bool
def wait(self): ...
def kill(self, sig) -> None: ...
Expand Down
67 changes: 45 additions & 22 deletions stubs/pexpect/pexpect/pty_spawn.pyi
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
from _typeshed import Incomplete
from _typeshed import FileDescriptorOrPath
from collections.abc import Callable
from os import _Environ
from typing import AnyStr

from .spawnbase import SpawnBase, _Logfile

PY3: Incomplete
PY3: bool

class spawn(SpawnBase):
class spawn(SpawnBase[AnyStr]):
use_native_pty_fork: bool
STDIN_FILENO: Incomplete
STDOUT_FILENO: Incomplete
STDERR_FILENO: Incomplete
STDIN_FILENO: int
STDOUT_FILENO: int
STDERR_FILENO: int
str_last_chars: int
env: Incomplete
cwd: FileDescriptorOrPath | None
env: _Environ[str]
echo: bool
ignore_sighup: bool
command: str
args: list[str]
name: str
use_poll: bool
def __init__(
self,
command: str,
Expand All @@ -22,11 +29,11 @@ class spawn(SpawnBase):
maxread: int = 2000,
searchwindowsize: int | None = None,
logfile: _Logfile | None = None,
cwd: str | bytes | None = None,
env: _Environ[Incomplete] | None = None,
cwd: FileDescriptorOrPath | None = None,
env: _Environ[str] | None = None,
ignore_sighup: bool = False,
echo: bool = True,
preexec_fn: Callable[[Incomplete], Incomplete] | None = None,
preexec_fn: Callable[[], None] | None = None,
encoding: str | None = None,
codec_errors: str = "strict",
dimensions: tuple[int, int] | None = None,
Expand All @@ -35,24 +42,24 @@ class spawn(SpawnBase):
child_fd: int
closed: bool
def close(self, force: bool = True) -> None: ...
def isatty(self): ...
def waitnoecho(self, timeout: int = -1): ...
def getecho(self): ...
def setecho(self, state: bool): ...
def read_nonblocking(self, size: int = 1, timeout: int | None = -1) -> bytes: ...
def isatty(self) -> bool: ...
def waitnoecho(self, timeout: float | None = -1) -> None: ...
def getecho(self) -> bool: ...
def setecho(self, state: bool) -> None: ...
def read_nonblocking(self, size: int = 1, timeout: float | None = -1) -> AnyStr: ...
def write(self, s: str | bytes) -> None: ...
def writelines(self, sequence: list[str | bytes]) -> None: ...
def send(self, s: str | bytes): ...
def sendline(self, s: str | bytes = ""): ...
def sendcontrol(self, char: str): ...
def send(self, s: str | bytes) -> int: ...
def sendline(self, s: str | bytes = "") -> int: ...
def sendcontrol(self, char: str) -> int: ...
def sendeof(self) -> None: ...
def sendintr(self) -> None: ...
@property
def flag_eof(self) -> bool: ...
@flag_eof.setter
def flag_eof(self, value: bool) -> None: ...
def eof(self) -> bool: ...
def terminate(self, force: bool = False): ...
def terminate(self, force: bool = False) -> bool: ...
status: int | None
exitstatus: bool | None
signalstatus: int | None
Expand All @@ -65,8 +72,24 @@ class spawn(SpawnBase):
def interact(
self,
escape_character="\x1d",
input_filter: Callable[[Incomplete], Incomplete] | None = None,
output_filter: Callable[[Incomplete], Incomplete] | None = None,
input_filter: Callable[[AnyStr], AnyStr] | None = None,
output_filter: Callable[[AnyStr], AnyStr] | None = None,
) -> None: ...

def spawnu(*args: str, **kwargs: str): ...
def spawnu(
command: str,
args: list[str] = [],
timeout: float | None = 30,
maxread: int = 2000,
searchwindowsize: int | None = None,
logfile: _Logfile | None = None,
cwd: FileDescriptorOrPath | None = None,
env: _Environ[str] | None = None,
ignore_sighup: bool = False,
echo: bool = True,
preexec_fn: Callable[[], None] | None = None,
encoding: str | None = "utf-8",
codec_errors: str = "strict",
dimensions: tuple[int, int] | None = None,
use_poll: bool = False,
) -> spawn[str]: ...
Loading

0 comments on commit dfd954c

Please sign in to comment.