Skip to content
Merged
Changes from 1 commit
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
20 changes: 6 additions & 14 deletions jupyterlab_magic_wand/agents/tools/show_diff.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

from typing import Literal, Optional
from typing import Literal
from typing_extensions import TypedDict
from nbdime.diffing.generic import diff
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can drop nbdime here since it's a dependency of https://github.com/jupyter-ai-contrib/jupyterlab-cell-diff, and the diffing logic is already handled in jupyterlab-cell-diff.



COMMAND_NAME = "jupyterlab-cell-diff:show-nbdime"
Expand All @@ -19,18 +17,12 @@ class ShowDiff(TypedDict):
args: MergeDiff


def show_diff(
cell_id: str,
original_source: str,
new_source: str
) -> ShowDiff:
diff_results = diff(original_source, new_source)
def show_diff(cell_id: str, original_source: str, new_source: str) -> ShowDiff:
return {
"name": COMMAND_NAME,
"args": {
"cell_id": cell_id,
"original_source": original_source,
"diff": diff_results
}
"cellId": cell_id,
"originalSource": original_source,
"newSource": new_source,
},
}

Loading