Файли
openidea/fixtures/python-app/notebooks/summary.ipynb
T
LU XIANGRUIтаwildcatDownstairs 24598e0dae feat(notebook): convert a notebook to a Python script and back (#6491)
Adds Convert to Python File to the Project view context menu of a .ipynb and Convert to Jupyter Notebook to that of a .py file, both also in Find Action for the active editor.

The script uses # %% cell markers; Markdown and raw cells become commented # %% [markdown] / # %% [raw] cells, and IPython-only lines (%magic, !shell) and whole %%cell-magic cells are commented out so the script runs with plain python. The result is written next to the source without overwriting (<name>-1.py, ...) and opened; an open notebook or script is converted as shown, unsaved edits included. Back to a notebook gives nbformat 4.5 with a Python 3 kernelspec, where # %% / #%% lines start cells and a script without markers becomes one code cell. A notebook that is not nbformat 4 reports an error and writes nothing.

Closes #6372

Co-authored-by: wildcatDownstairs <[email protected]>
2026-11-27 20:42:23 +08:00

1.1 KiB

Task summary

Counts the sample tasks by status.

In [ ]:
%load_ext autoreload
!python --version
In [ ]:
from collections import Counter

tasks = [("write docs", "done"), ("fix bug", "open"), ("review", "open")]
counts = Counter(status for _, status in tasks)
counts
In [ ]:
for status, n in sorted(counts.items()):
    print(f"{status}: {n}")