MCPcopy Create free account
hub / github.com/deepnote/vscode-deepnote / pruneCell

Function pruneCell

src/platform/common/utils.ts:89–111  ·  view source on GitHub ↗
(cell: nbformat.ICell)

Source from the content-addressed store, hash-verified

87}
88
89export 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
113export function translateKernelLanguageToMonaco(language: string): string {
114 language = language.toLowerCase();

Callers 1

Calls 2

splitMultilineStringFunction · 0.85
mapMethod · 0.80

Tested by

no test coverage detected