Skip to content

Commit f424458

Browse files
[pexpect] Accept dict for env parameter, not just os.environ (#15270)
1 parent 0664473 commit f424458

File tree

5 files changed

+12
-14
lines changed

5 files changed

+12
-14
lines changed

stubs/pexpect/pexpect/popen_spawn.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import subprocess
22
from _typeshed import StrOrBytesPath
33
from collections.abc import Callable
4-
from os import _Environ
54
from typing import AnyStr
65

76
from .spawnbase import SpawnBase, _Logfile
@@ -17,7 +16,7 @@ class PopenSpawn(SpawnBase[AnyStr]):
1716
searchwindowsize: int | None = None,
1817
logfile: _Logfile | None = None,
1918
cwd: StrOrBytesPath | None = None,
20-
env: _Environ[str] | None = None,
19+
env: subprocess._ENV | None = None,
2120
encoding: str | None = None,
2221
codec_errors: str = "strict",
2322
preexec_fn: Callable[[], None] | None = None,

stubs/pexpect/pexpect/pty_spawn.pyi

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from _typeshed import FileDescriptorOrPath
2-
from collections.abc import Callable
3-
from os import _Environ
2+
from collections.abc import Callable, Mapping
43
from typing import AnyStr
54

65
from .spawnbase import SpawnBase, _Logfile
@@ -14,7 +13,7 @@ class spawn(SpawnBase[AnyStr]):
1413
STDERR_FILENO: int
1514
str_last_chars: int
1615
cwd: FileDescriptorOrPath | None
17-
env: _Environ[str]
16+
env: Mapping[str, str] | None
1817
echo: bool
1918
ignore_sighup: bool
2019
command: str
@@ -30,7 +29,7 @@ class spawn(SpawnBase[AnyStr]):
3029
searchwindowsize: int | None = None,
3130
logfile: _Logfile | None = None,
3231
cwd: FileDescriptorOrPath | None = None,
33-
env: _Environ[str] | None = None,
32+
env: Mapping[str, str] | None = None,
3433
ignore_sighup: bool = False,
3534
echo: bool = True,
3635
preexec_fn: Callable[[], None] | None = None,
@@ -84,7 +83,7 @@ def spawnu(
8483
searchwindowsize: int | None = None,
8584
logfile: _Logfile | None = None,
8685
cwd: FileDescriptorOrPath | None = None,
87-
env: _Environ[str] | None = None,
86+
env: Mapping[str, str] | None = None,
8887
ignore_sighup: bool = False,
8988
echo: bool = True,
9089
preexec_fn: Callable[[], None] | None = None,

stubs/pexpect/pexpect/pxssh.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from _typeshed import FileDescriptorOrPath
2-
from os import _Environ
2+
from collections.abc import Mapping
33
from typing import AnyStr, Literal
44

55
from .exceptions import ExceptionPexpect
@@ -28,7 +28,7 @@ class pxssh(spawn[AnyStr]):
2828
searchwindowsize: int | None = None,
2929
logfile: _Logfile | None = None,
3030
cwd: FileDescriptorOrPath | None = None,
31-
env: _Environ[str] | None = None,
31+
env: Mapping[str, str] | None = None,
3232
ignore_sighup: bool = True,
3333
echo: bool = True,
3434
options: dict[str, str] = {},

stubs/pexpect/pexpect/run.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from _typeshed import FileDescriptorOrPath
2-
from os import _Environ
2+
from collections.abc import Mapping
33
from typing import AnyStr
44

55
from .spawnbase import _InputRePattern, _Logfile
@@ -12,7 +12,7 @@ def run(
1212
extra_args: None = None,
1313
logfile: _Logfile | None = None,
1414
cwd: FileDescriptorOrPath | None = None,
15-
env: _Environ[str] | None = None,
15+
env: Mapping[str, str] | None = None,
1616
**kwargs,
1717
) -> AnyStr | tuple[AnyStr, int]: ...
1818
def runu(
@@ -23,6 +23,6 @@ def runu(
2323
extra_args: None = None,
2424
logfile: _Logfile | None = None,
2525
cwd: FileDescriptorOrPath | None = None,
26-
env: _Environ[str] | None = None,
26+
env: Mapping[str, str] | None = None,
2727
**kwargs,
2828
) -> AnyStr | tuple[AnyStr, int]: ...

stubs/pexpect/pexpect/utils.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
from os import _Environ
1+
from collections.abc import Mapping
22

33
InterruptedError: type
44
string_types: tuple[type, ...]
55

66
def is_executable_file(path): ...
7-
def which(filename, env: _Environ[str] | None = None): ...
7+
def which(filename, env: Mapping[str, str] | None = None): ...
88
def split_command_line(command_line): ...
99
def select_ignore_interrupts(iwtd, owtd, ewtd, timeout: float | None = None): ...
1010
def poll_ignore_interrupts(fds, timeout: float | None = None): ...

0 commit comments

Comments
 (0)