Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: let display hook handle clear_output #1135

Merged
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: 9 additions & 3 deletions ipykernel/zmqshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,17 @@ def clear_output(self, wait=False):
"""
content = dict(wait=wait)
self._flush_streams()
msg = self.session.msg("clear_output", json_clean(content), parent=self.parent_header)

# see publish() for details on how this works
for hook in self._hooks:
msg = hook(msg)
if msg is None:
return

self.session.send(
self.pub_socket,
"clear_output",
content,
parent=self.parent_header,
msg,
ident=self.topic,
)

Expand Down