| 212 | * If the executable is not defined in kernelspec json, & it is a Python kernel, then we'll use the provided python interpreter. |
| 213 | */ |
| 214 | export class RemoteKernelSpecConnectionMetadata { |
| 215 | public readonly kernelModel?: undefined; |
| 216 | public readonly kind = 'startUsingRemoteKernelSpec'; |
| 217 | public readonly id: string; |
| 218 | public readonly kernelSpec: IJupyterKernelSpec; |
| 219 | public readonly baseUrl: string; |
| 220 | public readonly interpreter?: PythonEnvironment; // Can be set if URL is localhost |
| 221 | public readonly serverProviderHandle: JupyterServerProviderHandle; |
| 222 | private constructor(options: { |
| 223 | interpreter?: PythonEnvironment; // Can be set if URL is localhost |
| 224 | kernelSpec: IJupyterKernelSpec; |
| 225 | baseUrl: string; |
| 226 | id: string; |
| 227 | serverProviderHandle: JupyterServerProviderHandle; |
| 228 | }) { |
| 229 | this.interpreter = options.interpreter; |
| 230 | this.kernelSpec = options.kernelSpec; |
| 231 | this.baseUrl = options.baseUrl; |
| 232 | this.id = options.id; |
| 233 | this.serverProviderHandle = options.serverProviderHandle; |
| 234 | sendKernelTelemetry(this); |
| 235 | } |
| 236 | public static create(options: { |
| 237 | interpreter?: PythonEnvironment; // Can be set if URL is localhost |
| 238 | kernelSpec: IJupyterKernelSpec; |
| 239 | baseUrl: string; |
| 240 | id: string; |
| 241 | serverProviderHandle: JupyterServerProviderHandle; |
| 242 | }) { |
| 243 | return new RemoteKernelSpecConnectionMetadata(options); |
| 244 | } |
| 245 | public getHashId() { |
| 246 | return getConnectionIdHash(this); |
| 247 | } |
| 248 | public toJSON() { |
| 249 | return { |
| 250 | id: this.id, |
| 251 | kernelSpec: this.kernelSpec, |
| 252 | interpreter: serializePythonEnvironment(this.interpreter), |
| 253 | baseUrl: this.baseUrl, |
| 254 | kind: this.kind, |
| 255 | serverProviderHandle: this.serverProviderHandle |
| 256 | }; |
| 257 | } |
| 258 | public static fromJSON(options: Record<string, unknown> | RemoteKernelSpecConnectionMetadata) { |
| 259 | return BaseKernelConnectionMetadata.fromJSON(options) as RemoteKernelSpecConnectionMetadata; |
| 260 | } |
| 261 | } |
| 262 | /** |
| 263 | * Connection metadata for Kernels started using Python interpreter. |
| 264 | * These are not necessarily raw (it could be plain old Jupyter Kernels, where we register Python interpreter as a kernel). |
nothing calls this directly
no outgoing calls
no test coverage detected