(notebookPath: string)
| 174 | * to get the original local ipynb file name. |
| 175 | */ |
| 176 | export 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 | |
| 193 | type ConnectionWithKernelSpec = LocalKernelSpecConnectionMetadata | PythonKernelConnectionMetadata; |
| 194 | export function kernelConnectionMetadataHasKernelSpec( |
no outgoing calls
no test coverage detected