Skip to content

Commit dd8d96f

Browse files
committed
Fixes typing errors
1 parent 1eeebed commit dd8d96f

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

jupyter_ai_tools/toolkits/notebook.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ async def get_cell_id_from_index(file_path: str, cell_index: int) -> str:
211211

212212
async def add_cell(
213213
file_path: str,
214-
content: str | None = None,
215-
cell_id: str | None = None,
214+
content: Optional[str] = None,
215+
cell_id: Optional[str] = None,
216216
add_above: bool = False,
217217
cell_type: Literal["code", "markdown", "raw"] = "code",
218218
):
@@ -295,8 +295,8 @@ async def add_cell(
295295

296296
async def insert_cell(
297297
file_path: str,
298-
content: str | None = None,
299-
insert_index: int | None = None,
298+
content: Optional[str] = None,
299+
insert_index: Optional[int] = None,
300300
cell_type: Literal["code", "markdown", "raw"] = "code",
301301
):
302302
"""Inserts a new cell to the Jupyter notebook at the specified cell index.
@@ -887,7 +887,7 @@ def read_cell_nbformat(file_path: str, cell_id: str) -> Dict[str, Any]:
887887
raise ValueError(f"Cell with {cell_id=} not found in notebook at {file_path=}")
888888

889889

890-
def _get_cell_index_from_id_json(notebook_json, cell_id: str) -> int | None:
890+
def _get_cell_index_from_id_json(notebook_json, cell_id: str) -> Optional[int]:
891891
"""Get cell index from cell_id by notebook json dict.
892892
893893
Args:
@@ -905,7 +905,7 @@ def _get_cell_index_from_id_json(notebook_json, cell_id: str) -> int | None:
905905
return None
906906

907907

908-
def _get_cell_index_from_id_ydoc(ydoc, cell_id: str) -> int | None:
908+
def _get_cell_index_from_id_ydoc(ydoc, cell_id: str) -> Optional[int]:
909909
"""Get cell index from cell_id using YDoc interface.
910910
911911
Args:
@@ -924,7 +924,7 @@ def _get_cell_index_from_id_ydoc(ydoc, cell_id: str) -> int | None:
924924
return None
925925

926926

927-
def _get_cell_index_from_id_nbformat(notebook, cell_id: str) -> int | None:
927+
def _get_cell_index_from_id_nbformat(notebook, cell_id: str) -> Optional[int]:
928928
"""Get cell index from cell_id using nbformat interface.
929929
930930
Args:

jupyter_ai_tools/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import inspect
33
import os
44
from pathlib import Path
5-
from typing import Optional
5+
from typing import Dict, List, Optional
66
from urllib.parse import unquote
77

88
from jupyter_server.auth.identity import User
@@ -269,7 +269,7 @@ def notebook_json_to_md(notebook_json: dict, include_outputs: bool = True) -> st
269269
return "\n\n".join(md_parts)
270270

271271

272-
def metadata_to_md(metadata_json: dict) -> str:
272+
def metadata_to_md(metadata_json: Dict) -> str:
273273
"""Converts notebook or cell metadata to markdown string in YAML format.
274274
275275
Args:
@@ -339,7 +339,7 @@ def cell_to_md(cell_json: dict, index: int = 0, include_outputs: bool = True) ->
339339
return "\n\n".join(md_parts)
340340

341341

342-
def format_outputs(outputs: list) -> str:
342+
def format_outputs(outputs: List) -> str:
343343
"""Formats cell outputs into markdown.
344344
345345
Args:

0 commit comments

Comments
 (0)