Switch to PEP-604 syntax in python2 stubs (#5915)

Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
Oleg Höfling
2021-08-14 11:12:30 +02:00
committed by GitHub
parent 431c4f7fc1
commit ff63953188
235 changed files with 2473 additions and 2768 deletions

View File

@@ -16,8 +16,8 @@ def call(
preexec_fn: Callable[[], Any] = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: Optional[_TXT] = ...,
env: Optional[_ENV] = ...,
cwd: _TXT | None = ...,
env: _ENV | None = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
@@ -32,8 +32,8 @@ def check_call(
preexec_fn: Callable[[], Any] = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: Optional[_TXT] = ...,
env: Optional[_ENV] = ...,
cwd: _TXT | None = ...,
env: _ENV | None = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
@@ -49,8 +49,8 @@ def check_output(
preexec_fn: Callable[[], Any] = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: Optional[_TXT] = ...,
env: Optional[_ENV] = ...,
cwd: _TXT | None = ...,
env: _ENV | None = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
@@ -65,38 +65,38 @@ class CalledProcessError(Exception):
cmd: Any
# morally: Optional[bytes]
output: bytes
def __init__(self, returncode: int, cmd: _CMD, output: Optional[bytes] = ...) -> None: ...
def __init__(self, returncode: int, cmd: _CMD, output: bytes | None = ...) -> None: ...
# We use a dummy type variable used to make Popen generic like it is in python 3
_T = TypeVar("_T", bound=bytes)
class Popen(Generic[_T]):
stdin: Optional[IO[bytes]]
stdout: Optional[IO[bytes]]
stderr: Optional[IO[bytes]]
stdin: IO[bytes] | None
stdout: IO[bytes] | None
stderr: IO[bytes] | None
pid: int
returncode: int
def __new__(
cls,
args: _CMD,
bufsize: int = ...,
executable: Optional[_TXT] = ...,
stdin: Optional[_FILE] = ...,
stdout: Optional[_FILE] = ...,
stderr: Optional[_FILE] = ...,
preexec_fn: Optional[Callable[[], Any]] = ...,
executable: _TXT | None = ...,
stdin: _FILE | None = ...,
stdout: _FILE | None = ...,
stderr: _FILE | None = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
shell: bool = ...,
cwd: Optional[_TXT] = ...,
env: Optional[_ENV] = ...,
cwd: _TXT | None = ...,
env: _ENV | None = ...,
universal_newlines: bool = ...,
startupinfo: Optional[Any] = ...,
startupinfo: Any | None = ...,
creationflags: int = ...,
) -> Popen[bytes]: ...
def poll(self) -> Optional[int]: ...
def poll(self) -> int | None: ...
def wait(self) -> int: ...
# morally: -> Tuple[Optional[bytes], Optional[bytes]]
def communicate(self, input: Optional[_TXT] = ...) -> Tuple[bytes, bytes]: ...
def communicate(self, input: _TXT | None = ...) -> Tuple[bytes, bytes]: ...
def send_signal(self, signal: int) -> None: ...
def terminate(self) -> None: ...
def kill(self) -> None: ...