(
cells: (nbformat.ICodeCell | nbformat.IMarkdownCell | nbformat.IRawCell | nbformat.IUnrecognizedCell)[],
disposables: IDisposable[],
kernelSpec: nbformat.IKernelspecMetadata = { display_name: 'Python 3', name: 'python3' },
rootFolder?: Uri,
prefix?: string,
language?: string
)
| 239 | } |
| 240 | |
| 241 | export async function createTemporaryNotebook( |
| 242 | cells: (nbformat.ICodeCell | nbformat.IMarkdownCell | nbformat.IRawCell | nbformat.IUnrecognizedCell)[], |
| 243 | disposables: IDisposable[], |
| 244 | kernelSpec: nbformat.IKernelspecMetadata = { display_name: 'Python 3', name: 'python3' }, |
| 245 | rootFolder?: Uri, |
| 246 | prefix?: string, |
| 247 | language?: string |
| 248 | ): Promise<Uri> { |
| 249 | cells = |
| 250 | cells.length == 0 |
| 251 | ? [ |
| 252 | { |
| 253 | cell_type: 'code', |
| 254 | outputs: [], |
| 255 | source: ['\n'], |
| 256 | execution_count: 0, |
| 257 | metadata: {} |
| 258 | } |
| 259 | ] |
| 260 | : cells; |
| 261 | const data: nbformat.INotebookContent = { |
| 262 | cells, |
| 263 | metadata: { |
| 264 | orig_nbformat: 4, |
| 265 | kernelspec: kernelSpec |
| 266 | }, |
| 267 | nbformat: 4, |
| 268 | nbformat_minor: 2 |
| 269 | }; |
| 270 | if (language) { |
| 271 | data.metadata.language_info = { |
| 272 | name: language |
| 273 | }; |
| 274 | } |
| 275 | return createTemporaryNotebookFromNotebook(data, disposables, rootFolder, prefix); |
| 276 | } |
| 277 | |
| 278 | /** |
| 279 | * Open an existing notebook with some metadata that tells extension to use Python kernel. |
no test coverage detected