Skip to content
Prev Previous commit
Next Next commit
replace _TXT alias
  • Loading branch information
JelleZijlstra committed Nov 5, 2022
commit aaf2a2f1c1947fbd9056c834a73a8dbd9578bbdb
76 changes: 38 additions & 38 deletions stdlib/subprocess.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ if sys.platform == "win32":
# except TimeoutError as e:
# reveal_type(e.cmd) # Any, but morally is _CMD
_FILE: TypeAlias = None | int | IO[Any]
_TXT: TypeAlias = ReadableBuffer | str
_InputString: TypeAlias = ReadableBuffer | str
if sys.version_info >= (3, 8):
_CMD: TypeAlias = StrOrBytesPath | Sequence[StrOrBytesPath]
else:
Expand Down Expand Up @@ -300,7 +300,7 @@ if sys.version_info >= (3, 11):
check: bool = ...,
encoding: str | None = ...,
errors: str | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
text: bool | None = ...,
timeout: float | None = ...,
user: str | int | None = ...,
Expand Down Expand Up @@ -503,7 +503,7 @@ elif sys.version_info >= (3, 10):
check: bool = ...,
encoding: str | None = ...,
errors: str | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
text: bool | None = ...,
timeout: float | None = ...,
user: str | int | None = ...,
Expand Down Expand Up @@ -700,7 +700,7 @@ elif sys.version_info >= (3, 9):
check: bool = ...,
encoding: str | None = ...,
errors: str | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
text: bool | None = ...,
timeout: float | None = ...,
user: str | int | None = ...,
Expand Down Expand Up @@ -875,7 +875,7 @@ else:
check: bool = ...,
encoding: str | None = ...,
errors: str | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
text: bool | None = ...,
timeout: float | None = ...,
) -> CompletedProcess[Any]: ...
Expand Down Expand Up @@ -1132,7 +1132,7 @@ if sys.version_info >= (3, 11):
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
text: Literal[True],
Expand Down Expand Up @@ -1163,7 +1163,7 @@ if sys.version_info >= (3, 11):
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str,
errors: str | None = ...,
text: bool | None = ...,
Expand Down Expand Up @@ -1194,7 +1194,7 @@ if sys.version_info >= (3, 11):
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str | None = ...,
errors: str,
text: bool | None = ...,
Expand Down Expand Up @@ -1226,7 +1226,7 @@ if sys.version_info >= (3, 11):
pass_fds: Any = ...,
# where the real keyword only ones start
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
text: bool | None = ...,
Expand Down Expand Up @@ -1257,7 +1257,7 @@ if sys.version_info >= (3, 11):
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: None = ...,
errors: None = ...,
text: Literal[None, False] = ...,
Expand Down Expand Up @@ -1288,7 +1288,7 @@ if sys.version_info >= (3, 11):
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
text: bool | None = ...,
Expand All @@ -1298,7 +1298,7 @@ if sys.version_info >= (3, 11):
umask: int = ...,
pipesize: int = ...,
process_group: int | None = ...,
) -> Any: ... # morally: -> _TXT
) -> Any: ... # morally: -> str | bytes

elif sys.version_info >= (3, 10):
# 3.10 adds "pipesize" argument
Expand All @@ -1322,7 +1322,7 @@ elif sys.version_info >= (3, 10):
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
text: Literal[True],
Expand Down Expand Up @@ -1352,7 +1352,7 @@ elif sys.version_info >= (3, 10):
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str,
errors: str | None = ...,
text: bool | None = ...,
Expand Down Expand Up @@ -1382,7 +1382,7 @@ elif sys.version_info >= (3, 10):
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str | None = ...,
errors: str,
text: bool | None = ...,
Expand Down Expand Up @@ -1413,7 +1413,7 @@ elif sys.version_info >= (3, 10):
pass_fds: Any = ...,
# where the real keyword only ones start
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
text: bool | None = ...,
Expand Down Expand Up @@ -1443,7 +1443,7 @@ elif sys.version_info >= (3, 10):
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: None = ...,
errors: None = ...,
text: Literal[None, False] = ...,
Expand Down Expand Up @@ -1473,7 +1473,7 @@ elif sys.version_info >= (3, 10):
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
text: bool | None = ...,
Expand All @@ -1482,7 +1482,7 @@ elif sys.version_info >= (3, 10):
extra_groups: Iterable[str | int] | None = ...,
umask: int = ...,
pipesize: int = ...,
) -> Any: ... # morally: -> _TXT
) -> Any: ... # morally: -> str | bytes

elif sys.version_info >= (3, 9):
# 3.9 adds arguments "user", "group", "extra_groups" and "umask"
Expand All @@ -1506,7 +1506,7 @@ elif sys.version_info >= (3, 9):
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
text: Literal[True],
Expand Down Expand Up @@ -1535,7 +1535,7 @@ elif sys.version_info >= (3, 9):
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str,
errors: str | None = ...,
text: bool | None = ...,
Expand Down Expand Up @@ -1564,7 +1564,7 @@ elif sys.version_info >= (3, 9):
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str | None = ...,
errors: str,
text: bool | None = ...,
Expand Down Expand Up @@ -1594,7 +1594,7 @@ elif sys.version_info >= (3, 9):
pass_fds: Any = ...,
# where the real keyword only ones start
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
text: bool | None = ...,
Expand Down Expand Up @@ -1623,7 +1623,7 @@ elif sys.version_info >= (3, 9):
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: None = ...,
errors: None = ...,
text: Literal[None, False] = ...,
Expand Down Expand Up @@ -1652,15 +1652,15 @@ elif sys.version_info >= (3, 9):
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
text: bool | None = ...,
user: str | int | None = ...,
group: str | int | None = ...,
extra_groups: Iterable[str | int] | None = ...,
umask: int = ...,
) -> Any: ... # morally: -> _TXT
) -> Any: ... # morally: -> str | bytes

else:
@overload
Expand All @@ -1683,7 +1683,7 @@ else:
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
text: Literal[True],
Expand All @@ -1708,7 +1708,7 @@ else:
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str,
errors: str | None = ...,
text: bool | None = ...,
Expand All @@ -1733,7 +1733,7 @@ else:
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str | None = ...,
errors: str,
text: bool | None = ...,
Expand All @@ -1759,7 +1759,7 @@ else:
pass_fds: Any = ...,
# where the real keyword only ones start
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
text: bool | None = ...,
Expand All @@ -1784,7 +1784,7 @@ else:
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: None = ...,
errors: None = ...,
text: Literal[None, False] = ...,
Expand All @@ -1809,11 +1809,11 @@ else:
pass_fds: Any = ...,
*,
timeout: float | None = ...,
input: _TXT | None = ...,
input: _InputString | None = ...,
encoding: str | None = ...,
errors: str | None = ...,
text: bool | None = ...,
) -> Any: ... # morally: -> _TXT
) -> Any: ... # morally: -> str | bytes

PIPE: int
STDOUT: int
Expand All @@ -1822,11 +1822,11 @@ DEVNULL: int
class SubprocessError(Exception): ...

class TimeoutExpired(SubprocessError):
def __init__(self, cmd: _CMD, timeout: float, output: _TXT | None = ..., stderr: _TXT | None = ...) -> None: ...
def __init__(self, cmd: _CMD, timeout: float, output: str | bytes | None = ..., stderr: str | bytes | None = ...) -> None: ...
# morally: _CMD
cmd: Any
timeout: float
# morally: _TXT | None
# morally: str | bytes | None
output: Any
stdout: bytes | None
stderr: bytes | None
Expand All @@ -1835,13 +1835,13 @@ class CalledProcessError(SubprocessError):
returncode: int
# morally: _CMD
cmd: Any
# morally: _TXT | None
# morally: str | bytes | None
output: Any

# morally: _TXT | None
# morally: str | bytes | None
stdout: Any
stderr: Any
def __init__(self, returncode: int, cmd: _CMD, output: _TXT | None = ..., stderr: _TXT | None = ...) -> None: ...
def __init__(self, returncode: int, cmd: _CMD, output: str | bytes | None = ..., stderr: str | bytes | None = ...) -> None: ...

class Popen(Generic[AnyStr]):
args: _CMD
Expand Down