Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions mypy/dmypy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ def check_output(
sys.stdout.write(out)
sys.stdout.flush()
sys.stderr.write(err)
sys.stderr.flush()
if verbose:
show_stats(response)
if junit_xml:
Expand All @@ -588,13 +589,14 @@ def check_output(

def show_stats(response: Mapping[str, object]) -> None:
for key, value in sorted(response.items()):
if key not in ("out", "err"):
print("%-24s: %10s" % (key, "%.3f" % value if isinstance(value, float) else value))
else:
if key in ("out", "err", "stdout", "stderr"):
# Special case text output to display just 40 characters of text
value = repr(value)[1:-1]
if len(value) > 50:
value = value[:40] + " ..."
value = f"{value[:40]} ... {len(value)-40} more characters"
print("%-24s: %s" % (key, value))
continue
print("%-24s: %10s" % (key, "%.3f" % value if isinstance(value, float) else value))


@action(hang_parser)
Expand Down Expand Up @@ -668,6 +670,8 @@ def request(
# TODO: Other errors, e.g. ValueError, UnicodeError
else:
# Display debugging output written to stdout/stderr in the server process for convenience.
# This should not be confused with "out" and "err" fields in the response.
# Those fields hold the output of the "check" command, and are handled in check_output().
stdout = response.get("stdout")
if stdout:
sys.stdout.write(stdout)
Expand Down