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

Function removeNotebookSuffixAddedByExtension

src/kernels/helpers.ts:176–191  ·  view source on GitHub ↗
(notebookPath: string)

Source from the content-addressed store, hash-verified

174 * to get the original local ipynb file name.
175 */
176export function removeNotebookSuffixAddedByExtension(notebookPath: string) {
177 if (notebookPath.includes(jvscIdentifier)) {
178 const guidRegEx = /[a-f0-9]$/;
179 if (
180 notebookPath
181 .substring(notebookPath.lastIndexOf(jvscIdentifier) + jvscIdentifier.length)
182 .search(guidRegEx) !== -1
183 ) {
184 const nbFile = notebookPath.substring(0, notebookPath.lastIndexOf(jvscIdentifier));
185 return nbFile.toLowerCase().endsWith('.ipynb') || nbFile.toLowerCase().endsWith('.py')
186 ? nbFile
187 : `${nbFile}.ipynb`;
188 }
189 }
190 return notebookPath;
191}
192
193type ConnectionWithKernelSpec = LocalKernelSpecConnectionMetadata | PythonKernelConnectionMetadata;
194export function kernelConnectionMetadataHasKernelSpec(

Calls

no outgoing calls

Tested by

no test coverage detected