MCPcopy Create free account
hub / github.com/Mercury7353/PyBench / save_as_ipynb

Function save_as_ipynb

utils/save_notebook.py:36–62  ·  view source on GitHub ↗
(cells, filename)

Source from the content-addressed store, hash-verified

34
35
36def save_as_ipynb(cells, filename):
37 notebook = {
38 "cells": cells,
39 "metadata": {
40 "kernelspec": {
41 "display_name": "Python 3",
42 "language": "python",
43 "name": "python3",
44 },
45 "language_info": {
46 "codemirror_mode": {"name": "ipython", "version": 3},
47 "file_extension": ".py",
48 "mimetype": "text/x-python",
49 "name": "python",
50 "nbconvert_exporter": "python",
51 "pygments_lexer": "ipython3",
52 "version": "3.7.11",
53 },
54 },
55 "nbformat": 4,
56 "nbformat_minor": 5,
57 }
58
59 with open(filename, "w") as file:
60 json.dump(notebook, file, indent=2)
61
62 print(f"Notebook saved as {filename}")
63
64
65if __name__ == "__main__":

Callers 1

process_taskFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected