We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ccea571 commit 1d8ccbbCopy full SHA for 1d8ccbb
gbmi/utils/images.py
@@ -55,10 +55,16 @@ def forward_output(
55
stream: io.BufferedReader,
56
write_func: Callable[[str], None],
57
trim_func: Optional[Callable[[str], Optional[str]]] = None,
58
+ suppress_repeated_newlines: bool = True,
59
) -> None:
60
buffer = ""
61
+ prev_newline = False
62
for char in iter(lambda: stream.read(1), b""):
63
decoded_char = char.decode()
64
+ cur_newline = decoded_char == "\n"
65
+ if suppress_repeated_newlines and prev_newline and cur_newline:
66
+ continue
67
+ prev_newline = cur_newline
68
if trim_func is None:
69
write_func(decoded_char, end="")
70
else:
0 commit comments