Skip to content

Commit

Permalink
feat: let display hook handle clear_output (#1135)
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenbreddels authored Jul 20, 2023
1 parent 1abb019 commit 58e9d15
Showing 1 changed file with 9 additions and 3 deletions.
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

0 comments on commit 58e9d15

Please sign in to comment.