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

Class KernelSessionFactory

src/kernels/common/kernelSessionFactory.ts:13–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11 */
12@injectable()
13export class KernelSessionFactory implements IKernelSessionFactory {
14 constructor(
15 @inject(IRawNotebookSupportedService)
16 private readonly rawKernelSupported: IRawNotebookSupportedService,
17
18 @inject(IRawKernelSessionFactory)
19 @optional()
20 private readonly newRawKernelSessionFactory: IRawKernelSessionFactory | undefined,
21 @inject(JupyterKernelSessionFactory)
22 private readonly newJupyterSessionFactory: IKernelSessionFactory
23 ) {}
24
25 public async create(options: KernelSessionCreationOptions): Promise<IKernelSession> {
26 const kernelConnection = options.kernelConnection;
27 if (
28 this.rawKernelSupported.isSupported &&
29 isLocalConnection(kernelConnection) &&
30 this.newRawKernelSessionFactory
31 ) {
32 return this.newRawKernelSessionFactory.create({ ...options, kernelConnection: kernelConnection });
33 } else {
34 return this.newJupyterSessionFactory.create(options);
35 }
36 }
37}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected