|
106 | 106 | { |
107 | 107 | "data": { |
108 | 108 | "text/plain": [ |
109 | | - "{'kernelspec': {'display_name': 'Python 3 (ipykernel)',\n", |
110 | | - " 'language': 'python',\n", |
111 | | - " 'name': 'python3'}}" |
| 109 | + "{'solveit_dialog_mode': 'learning', 'solveit_ver': 2}" |
112 | 110 | ] |
113 | 111 | }, |
114 | 112 | "execution_count": null, |
|
138 | 136 | "data": { |
139 | 137 | "text/plain": [ |
140 | 138 | "[{'cell_type': 'markdown',\n", |
| 139 | + " 'id': '801558df',\n", |
141 | 140 | " 'metadata': {},\n", |
142 | 141 | " 'source': ['## A minimal notebook']},\n", |
143 | 142 | " {'cell_type': 'code',\n", |
144 | 143 | " 'execution_count': None,\n", |
145 | | - " 'metadata': {},\n", |
| 144 | + " 'id': 'e2147a69',\n", |
| 145 | + " 'metadata': {'time_run': '2026-01-04T20:52:49.901559+00:00'},\n", |
146 | 146 | " 'outputs': [{'data': {'text/plain': ['2']},\n", |
147 | | - " 'execution_count': None,\n", |
| 147 | + " 'execution_count': 0,\n", |
148 | 148 | " 'metadata': {},\n", |
149 | 149 | " 'output_type': 'execute_result'}],\n", |
150 | 150 | " 'source': ['# Do some arithmetic\\n', '1+1']}]" |
|
176 | 176 | "source": [ |
177 | 177 | "#| export\n", |
178 | 178 | "class NbCell(AttrDict):\n", |
179 | | - " def __init__(self, idx, cell, id=None):\n", |
| 179 | + " def __init__(self, idx, cell):\n", |
180 | 180 | " super().__init__(cell)\n", |
181 | 181 | " self.idx_ = idx\n", |
182 | | - " self.id = id or rtoken_hex(4)\n", |
| 182 | + " if 'id' not in self: self.id = rtoken_hex(4)\n", |
183 | 183 | " if 'source' in self: self.set_source(self.source)\n", |
184 | 184 | "\n", |
185 | 185 | " def set_source(self, source):\n", |
|
248 | 248 | "```python\n", |
249 | 249 | "{ 'cell_type': 'code',\n", |
250 | 250 | " 'execution_count': None,\n", |
251 | | - " 'id': 'e525badc',\n", |
| 251 | + " 'id': 'e2147a69',\n", |
252 | 252 | " 'idx_': 1,\n", |
253 | | - " 'metadata': {},\n", |
| 253 | + " 'metadata': {'time_run': '2026-01-04T20:52:49.901559+00:00'},\n", |
254 | 254 | " 'outputs': [ { 'data': {'text/plain': ['2']},\n", |
255 | | - " 'execution_count': None,\n", |
| 255 | + " 'execution_count': 0,\n", |
256 | 256 | " 'metadata': {},\n", |
257 | 257 | " 'output_type': 'execute_result'}],\n", |
258 | 258 | " 'source': '# Do some arithmetic\\n1+1'}\n", |
|
261 | 261 | "text/plain": [ |
262 | 262 | "{'cell_type': 'code',\n", |
263 | 263 | " 'execution_count': None,\n", |
264 | | - " 'metadata': {},\n", |
| 264 | + " 'id': 'e2147a69',\n", |
| 265 | + " 'metadata': {'time_run': '2026-01-04T20:52:49.901559+00:00'},\n", |
265 | 266 | " 'outputs': [{'data': {'text/plain': ['2']},\n", |
266 | | - " 'execution_count': None,\n", |
| 267 | + " 'execution_count': 0,\n", |
267 | 268 | " 'metadata': {},\n", |
268 | 269 | " 'output_type': 'execute_result'}],\n", |
269 | 270 | " 'source': '# Do some arithmetic\\n1+1',\n", |
270 | | - " 'idx_': 1,\n", |
271 | | - " 'id': 'e525badc'}" |
| 271 | + " 'idx_': 1}" |
272 | 272 | ] |
273 | 273 | }, |
274 | 274 | "execution_count": null, |
|
343 | 343 | { |
344 | 344 | "data": { |
345 | 345 | "text/plain": [ |
346 | | - "\"{'cell_type': 'markdown', 'metadata': {}, 'source': '## A minimal notebook', 'idx_': 0, 'id': '3b935699'}\"" |
| 346 | + "\"{'cell_type': 'markdown', 'id': '801558df', 'metadata': {}, 'source': '## A minimal notebook', 'idx_': 0}\"" |
347 | 347 | ] |
348 | 348 | }, |
349 | 349 | "execution_count": null, |
|
426 | 426 | "{ 'cell_type': 'code',\n", |
427 | 427 | " 'directives_': {},\n", |
428 | 428 | " 'execution_count': 0,\n", |
429 | | - " 'id': 'ec06b0ff',\n", |
| 429 | + " 'id': 'f6ddf5a3',\n", |
430 | 430 | " 'idx_': 0,\n", |
431 | 431 | " 'metadata': {},\n", |
432 | 432 | " 'outputs': [],\n", |
|
441 | 441 | " 'metadata': {},\n", |
442 | 442 | " 'outputs': [],\n", |
443 | 443 | " 'idx_': 0,\n", |
444 | | - " 'id': 'ec06b0ff'}" |
| 444 | + " 'id': 'f6ddf5a3'}" |
445 | 445 | ] |
446 | 446 | }, |
447 | 447 | "execution_count": null, |
|
517 | 517 | "minimal_fn = Path('../tests/minimal.ipynb')\n", |
518 | 518 | "minimal = read_nb(minimal_fn)\n", |
519 | 519 | "minimal_dict = _read_json(minimal_fn)\n", |
520 | | - "# assert minimal_dict==nb2dict(minimal)" |
| 520 | + "assert minimal_dict==nb2dict(minimal)" |
521 | 521 | ] |
522 | 522 | }, |
523 | 523 | { |
|
599 | 599 | "try:\n", |
600 | 600 | " minimal_txt = minimal_fn.read_text()\n", |
601 | 601 | " write_nb(minimal, tmp)\n", |
602 | | - " # test_eq(minimal_txt, tmp.read_text())\n", |
| 602 | + " test_eq(minimal_txt, tmp.read_text())\n", |
603 | 603 | "finally: tmp.unlink()" |
604 | 604 | ] |
605 | 605 | }, |
|
621 | 621 | "name": "stdout", |
622 | 622 | "output_type": "stream", |
623 | 623 | "text": [ |
624 | | - "[{'cell_type': 'code', 'execution_count': 0, 'id': '8cbb61b0', 'metadata': {}, 'outputs': [], 'source': 'print(1)', 'idx_': 0}]\n" |
| 624 | + "[{'cell_type': 'code', 'execution_count': 0, 'id': '5e7ed95f', 'metadata': {}, 'outputs': [], 'source': 'print(1)', 'idx_': 0}]\n" |
625 | 625 | ] |
626 | 626 | } |
627 | 627 | ], |
|
0 commit comments