| 11 | */ |
| 12 | @injectable() |
| 13 | export 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected