From 99ebff96b0289266d3d413be4f18acb3a3f6bbfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Collonval?= Date: Tue, 17 Dec 2024 10:35:02 +0100 Subject: [PATCH] Revert "Use multithreading flag (#14)" (#15) This reverts commit 32045b371efb00b5132127458844b8995fff229d. --- jupyter_nbmodel_client/model.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/jupyter_nbmodel_client/model.py b/jupyter_nbmodel_client/model.py index 817db84..2c8b5c2 100644 --- a/jupyter_nbmodel_client/model.py +++ b/jupyter_nbmodel_client/model.py @@ -43,6 +43,8 @@ def output_hook(outputs: list[dict[str, t.Any]], message: dict[str, t.Any]) -> s return set() + + class KernelClient(t.Protocol): """Interface to be implemented by the kernel client.""" @@ -119,9 +121,7 @@ class NotebookModel(MutableSequence): # FIXME add API to clear code cell; aka execution count and outputs def __init__(self) -> None: - self._doc: YNotebook - # Initialize _doc - self._reset_y_model() + self._doc = YNotebook() def __delitem__(self, index: int) -> NotebookNode: raw_ycell = self._doc.ycells.pop(index) @@ -312,6 +312,4 @@ def set_cell_source(self, index: int, source: str) -> None: def _reset_y_model(self) -> None: """Reset the Y model.""" - # Use allow_multithreading=True to ensure blocking document transactions - # https://jupyter-server.github.io/pycrdt/usage/#Transactions - self._doc = YNotebook(ydoc=pycrdt.Doc(allow_multithreading=True)) + self._doc = YNotebook()