Skip to content

Commit

Permalink
Remove output trailing newline
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed Apr 18, 2024
1 parent c15709a commit 99442c0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions plugins/kernels/fps_kernels/kernel_driver/driver.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import time
import uuid
from typing import Any, Dict, Optional, cast
Expand Down Expand Up @@ -258,6 +259,9 @@ async def _handle_outputs(self, outputs: Array, msg: Dict[str, Any]):
if msg_type == "stream":
with outputs.doc.transaction():
# TODO: uncomment when changes are made in jupyter-ydoc
text = content["text"]
if text.endswith(os.linesep):
text = text[:-1]
if (not outputs) or (outputs[-1]["name"] != content["name"]): # type: ignore
outputs.append(
# Map(
Expand All @@ -270,13 +274,13 @@ async def _handle_outputs(self, outputs: Array, msg: Dict[str, Any]):
{
"name": content["name"],
"output_type": msg_type,
"text": [content["text"]],
"text": [text],
}
)
else:
# outputs[-1]["text"].append(content["text"]) # type: ignore
last_output = outputs[-1]
last_output["text"].append(content["text"]) # type: ignore
last_output["text"].append(text) # type: ignore
outputs[-1] = last_output
elif msg_type in ("display_data", "execute_result"):
if "application/vnd.jupyter.ywidget-view+json" in content["data"]:
Expand Down

0 comments on commit 99442c0

Please sign in to comment.