當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Kernel.startNew方法代碼示例

本文整理匯總了TypeScript中@jupyterlab/services.Kernel.startNew方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Kernel.startNew方法的具體用法?TypeScript Kernel.startNew怎麽用?TypeScript Kernel.startNew使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@jupyterlab/services.Kernel的用法示例。


在下文中一共展示了Kernel.startNew方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

 it('should test whether the kernel is ready', async () => {
   const kernel = await Kernel.startNew();
   expect(kernel.isReady).to.equal(false);
   await kernel.ready;
   expect(kernel.isReady).to.equal(true);
   await kernel.shutdown();
 });
開發者ID:afshin,項目名稱:jupyterlab,代碼行數:7,代碼來源:ikernel.spec.ts

示例2: it

 it('should accept server settings', async () => {
   const serverSettings = makeSettings();
   const kernel = await Kernel.startNew({ serverSettings });
   const response = await Kernel.listRunning(serverSettings);
   expect(toArray(response).length).to.be.greaterThan(0);
   await kernel.shutdown();
 });
開發者ID:afshin,項目名稱:jupyterlab,代碼行數:7,代碼來源:kernel.spec.ts

示例3: main

function main() {
  let renderMime: RenderMime;
  let model: OutputAreaModel;
  let outputAreaOptions: OutputArea.IOptions;
  let outputArea: OutputArea;

  let testcode = [
    'import numpy as np',
    'import matplotlib.pyplot as plt',
    '%matplotlib inline',
    'x = np.linspace(-10,10)',
    'y = x**2',
    'print(x)',
    'print(y)',
    'plt.plot(x, y)'
  ].join('\n');

  model = new OutputAreaModel();
  renderMime = new RenderMime({ initialFactories: defaultRendererFactories });

  outputAreaOptions = {
    model: model,
    rendermime: renderMime
  };

  outputArea = new OutputArea(outputAreaOptions);

  Kernel.startNew().then(kernel => {
    outputArea.future = kernel.requestExecute({ code: testcode });
    document.getElementById('outputarea').appendChild(outputArea.node);
  });
}
開發者ID:cameronoelsen,項目名稱:jupyterlab,代碼行數:32,代碼來源:index.ts

示例4: beforeEach

 beforeEach((done) => {
   Kernel.startNew().then(k => {
     kernel = k;
     return kernel.ready;
   }).then(() => {
     done();
   }).catch(done);
 });
開發者ID:danielballan,項目名稱:jupyterlab,代碼行數:8,代碼來源:model.spec.ts

示例5: it

 it('should accept the id of the new kernel', async () => {
   session = await startNew();
   const previous = session.kernel;
   await previous.ready;
   const kernel = await Kernel.startNew();
   await kernel.ready;
   await session.changeKernel({ id: kernel.id });
   await session.kernel.ready;
   expect(session.kernel.id).to.equal(kernel.id);
   expect(session.kernel).to.not.equal(previous);
   expect(session.kernel).to.not.equal(kernel);
   previous.dispose();
   kernel.dispose();
 });
開發者ID:afshin,項目名稱:jupyterlab,代碼行數:14,代碼來源:isession.spec.ts

示例6: main

function main() {
  const code = [
    'import numpy as np',
    'import matplotlib.pyplot as plt',
    '%matplotlib inline',
    'x = np.linspace(-10,10)',
    'y = x**2',
    'print(x)',
    'print(y)',
    'plt.plot(x, y)'
  ].join('\n');
  const model = new OutputAreaModel();
  const rendermime = new RenderMimeRegistry({ initialFactories });
  const outputArea = new OutputArea({ model, rendermime });

  Kernel.startNew().then(kernel => {
    outputArea.future = kernel.requestExecute({ code });
    document.getElementById('outputarea').appendChild(outputArea.node);
  });
}
開發者ID:7125messi,項目名稱:jupyterlab,代碼行數:20,代碼來源:index.ts


注:本文中的@jupyterlab/services.Kernel.startNew方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。