stdlib: add argument default values (#9501)

This commit is contained in:
Jelle Zijlstra
2023-01-18 00:37:34 -08:00
committed by GitHub
parent 6cb934291f
commit ddfaca3200
272 changed files with 2529 additions and 2467 deletions

View File

@@ -91,14 +91,7 @@ class CompletedProcess(Generic[_T]):
# and writing all the overloads would be horrific.
stdout: _T
stderr: _T
# pyright ignore on __init__ because the TypeVar can technically be unsolved, but see comment above
def __init__(
self,
args: _CMD,
returncode: int,
stdout: _T | None = ..., # pyright: ignore[reportInvalidTypeVarUse]
stderr: _T | None = ...,
) -> None: ...
def __init__(self, args: _CMD, returncode: int, stdout: _T | None = None, stderr: _T | None = None) -> None: ...
def check_returncode(self) -> None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
@@ -902,7 +895,7 @@ if sys.version_info >= (3, 11):
start_new_session: bool = ...,
pass_fds: Collection[int] = ...,
*,
timeout: float | None = ...,
timeout: float | None = None,
text: bool | None = ...,
user: str | int | None = ...,
group: str | int | None = ...,
@@ -1822,7 +1815,9 @@ DEVNULL: int
class SubprocessError(Exception): ...
class TimeoutExpired(SubprocessError):
def __init__(self, cmd: _CMD, timeout: float, output: str | bytes | None = ..., stderr: str | bytes | None = ...) -> None: ...
def __init__(
self, cmd: _CMD, timeout: float, output: str | bytes | None = None, stderr: str | bytes | None = None
) -> None: ...
# morally: _CMD
cmd: Any
timeout: float
@@ -1842,7 +1837,7 @@ class CalledProcessError(SubprocessError):
stdout: Any
stderr: Any
def __init__(
self, returncode: int, cmd: _CMD, output: str | bytes | None = ..., stderr: str | bytes | None = ...
self, returncode: int, cmd: _CMD, output: str | bytes | None = None, stderr: str | bytes | None = None
) -> None: ...
class Popen(Generic[AnyStr]):
@@ -2557,11 +2552,11 @@ class Popen(Generic[AnyStr]):
) -> None: ...
def poll(self) -> int | None: ...
def wait(self, timeout: float | None = ...) -> int: ...
def wait(self, timeout: float | None = None) -> int: ...
# morally the members of the returned tuple should be optional
# TODO this should allow ReadableBuffer for Popen[bytes], but adding
# overloads for that runs into a mypy bug (python/mypy#14070).
def communicate(self, input: AnyStr | None = ..., timeout: float | None = ...) -> tuple[AnyStr, AnyStr]: ...
def communicate(self, input: AnyStr | None = None, timeout: float | None = None) -> tuple[AnyStr, AnyStr]: ...
def send_signal(self, sig: int) -> None: ...
def terminate(self) -> None: ...
def kill(self) -> None: ...
@@ -2574,8 +2569,8 @@ class Popen(Generic[AnyStr]):
# The result really is always a str.
if sys.version_info >= (3, 11):
def getstatusoutput(cmd: str | bytes, *, encoding: str | None = ..., errors: str | None = ...) -> tuple[int, str]: ...
def getoutput(cmd: str | bytes, *, encoding: str | None = ..., errors: str | None = ...) -> str: ...
def getstatusoutput(cmd: str | bytes, *, encoding: str | None = None, errors: str | None = None) -> tuple[int, str]: ...
def getoutput(cmd: str | bytes, *, encoding: str | None = None, errors: str | None = None) -> str: ...
else:
def getstatusoutput(cmd: str | bytes) -> tuple[int, str]: ...