Skip to content

Commit 44ae52f

Browse files
committed
fix pre_code generation
1 parent c1bd78d commit 44ae52f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

jupyterlab_leetcode/utils/notebook_generator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,13 @@ def __populate_code(self, q):
134134

135135
types = self.__extract_type(snippet)
136136
typing_import = f"from typing import {', '.join(set(types))}" if types else None
137-
source = ["\n\n".join(filter(None, [typing_import, pre_solution.strip(" \n")]))]
137+
source = "\n\n".join(filter(None, [typing_import, pre_solution.strip(" \n")]))
138138
if source:
139139
pre_code_cell = first(
140140
self.template["cells"], lambda c: c["metadata"]["id"] == "pre_code"
141141
)
142142
if pre_code_cell:
143-
pre_code_cell["source"] = source
143+
pre_code_cell["source"] = [source]
144144
else:
145145
code_cell_index = first(
146146
enumerate(self.template["cells"]),
@@ -154,7 +154,7 @@ def __populate_code(self, q):
154154
"execution_count": None,
155155
"metadata": {"id": "pre_code"},
156156
"outputs": [],
157-
"source": source,
157+
"source": [source],
158158
},
159159
)
160160

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jupyterlab-leetcode",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "Integrate LeetCode into beloved Jupyter.",
55
"keywords": [
66
"jupyter",

0 commit comments

Comments
 (0)