Skip to content

Commit 39c4337

Browse files
committed
!squash more
1 parent c9f16de commit 39c4337

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

src/libvcs/_internal/run.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,21 +237,15 @@ def progress_cb(output: t.AnyStr, timestamp: datetime.datetime) -> None:
237237
callback(output="\r", timestamp=datetime.datetime.now())
238238

239239
# Read full stdout lines after process finishes
240-
if proc.stdout is not None:
241-
raw_stdout = proc.stdout.readlines()
242-
else:
243-
raw_stdout = []
240+
raw_stdout = proc.stdout.readlines() if proc.stdout is not None else []
244241

245242
lines: t.Iterator[str] = (ln.strip() for ln in raw_stdout if ln.strip())
246243
# Join lines with newlines, then decode
247244
all_output = console_to_str(b"\n".join(ln.encode() for ln in lines))
248245

249246
# If return code is non-zero, read stderr lines and override all_output
250247
if code:
251-
if proc.stderr is not None:
252-
raw_stderr = proc.stderr.readlines()
253-
else:
254-
raw_stderr = []
248+
raw_stderr = proc.stderr.readlines() if proc.stderr is not None else []
255249

256250
stderr_lines: t.Iterator[str] = (ln.strip() for ln in raw_stderr if ln.strip())
257251
all_output = console_to_str(b"".join(ln.encode() for ln in stderr_lines))

src/libvcs/_internal/subprocess.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def Popen(
258258
args: _CMD | None = ...,
259259
universal_newlines: t.Literal[False] = ...,
260260
*,
261-
text: t.Literal[None, False] = ...,
261+
text: t.Literal[False] | None = ...,
262262
encoding: None = ...,
263263
errors: None = ...,
264264
) -> subprocess.Popen[bytes]: ...
@@ -370,7 +370,7 @@ def check_output(
370370
input: str | bytes | None = ...,
371371
encoding: None = ...,
372372
errors: None = ...,
373-
text: t.Literal[None, False] = ...,
373+
text: t.Literal[False] | None = ...,
374374
**kwargs: t.Any,
375375
) -> bytes: ...
376376

@@ -484,7 +484,7 @@ def run(
484484
encoding: None = ...,
485485
errors: None = ...,
486486
input: bytes | None = ...,
487-
text: t.Literal[None, False] = ...,
487+
text: t.Literal[False] | None = ...,
488488
) -> subprocess.CompletedProcess[bytes]: ...
489489

490490
def run(

0 commit comments

Comments
 (0)