Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions jupyter_ydoc/ybasedoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ async def aset_progressively(
self,
value: Any,
initialized: anyio.Event | asyncio.Event | None = None,
finish: anyio.Event | asyncio.Event | None = None,
**kwargs: Any,
) -> None:
"""
Sets the content of the document progressively, if supported by the document.
Expand Down
6 changes: 6 additions & 0 deletions jupyter_ydoc/ynotebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,9 @@ async def aset_progressively(
self,
value: dict,
initialized: anyio.Event | asyncio.Event | None = None,
finish: anyio.Event | asyncio.Event | None = None,
delay_outputs_above_mb: float | None = None,
**kwargs: Any,
) -> None:
"""
Sets notebook content progressively in multiple transactions.
Expand All @@ -520,6 +522,8 @@ async def aset_progressively(
:type delay_outputs_above_mb: float, optional
:param initialized: An optional event to set when the notebook metada has been set.
:type value: Event
:param finish: An optional event set when to start setting the notebook cells.
:type value: Event
"""
if delay_outputs_above_mb is not None and delay_outputs_above_mb < 0:
msg = "delay_outputs_above_mb must be greater than or equal to 0"
Expand All @@ -532,6 +536,8 @@ async def aset_progressively(
try:
if next(gen) and initialized is not None:
initialized.set()
if finish is not None:
await finish.wait()
except StopIteration:
done = True
await anyio.lowlevel.checkpoint()
Expand Down
10 changes: 0 additions & 10 deletions tests/test_ydocs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

import re
from typing import Any

import pytest
Expand Down Expand Up @@ -59,15 +58,6 @@ async def test_ybasedoc_aset_progressively_falls_back_to_aset():
doc = SimpleYDoc()
value = {"cells": []}

with pytest.raises(
TypeError,
match=re.escape(
"YBaseDoc.aset_progressively() got an unexpected keyword argument "
"'delay_outputs_above_mb'"
),
):
await doc.aset_progressively(value, delay_outputs_above_mb=0)

await doc.aset_progressively(value)

assert doc.aset_values == [value]
Expand Down
Loading