(cell: nbformat.ICell)
| 87 | } |
| 88 | |
| 89 | export function pruneCell(cell: nbformat.ICell): nbformat.ICell { |
| 90 | // Source is usually a single string on input. Convert back to an array |
| 91 | const result = { |
| 92 | ...cell, |
| 93 | source: splitMultilineString(cell.source) |
| 94 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 95 | } as any as nbformat.ICell; // nyc (code coverage) barfs on this so just trick it. |
| 96 | |
| 97 | // Remove outputs and execution_count from non code cells |
| 98 | if (result.cell_type !== 'code') { |
| 99 | // Map to any so nyc will build. |
| 100 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 101 | delete (<any>result).outputs; |
| 102 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 103 | delete (<any>result).execution_count; |
| 104 | } else if (result.cell_type) { |
| 105 | // Clean outputs from code cells |
| 106 | const cellResult = result as nbformat.ICodeCell; |
| 107 | cellResult.outputs = cellResult.outputs ? (cellResult.outputs as nbformat.IOutput[]).map(fixupOutput) : []; |
| 108 | } |
| 109 | |
| 110 | return result; |
| 111 | } |
| 112 | |
| 113 | export function translateKernelLanguageToMonaco(language: string): string { |
| 114 | language = language.toLowerCase(); |
no test coverage detected