Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jupyter-js-services

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jupyter-js-services - npm Package Compare versions

Comparing version 0.10.4 to 0.10.5

16

lib/mockkernel.d.ts

@@ -5,3 +5,3 @@ import { IDisposable } from 'phosphor-disposable';

/**
* A mock kernel object that only handles execution requests.
* A mock kernel object.
* It only keeps one kernel future at a time.

@@ -68,2 +68,6 @@ */

/**
* Set the kernel info for the mock kernel.
*/
setKernelInfo(value: IKernelInfo): void;
/**
* Send a `complete_request` message.

@@ -82,2 +86,5 @@ */

* Send an `execute_request` message.
*
* #### Notes
* This simulatates an actual exection on the server.
*/

@@ -109,2 +116,6 @@ execute(contents: IExecuteRequest, disposeOnDone?: boolean): IKernelFuture;

getKernelSpec(): Promise<IKernelSpec>;
/**
* Set the kernel spec associated with the kernel.
*/
setKernelSpec(value: IKernelSpec): void;
private _sendKernelMessage(msgType, channel, contents);

@@ -115,2 +126,5 @@ private _changeStatus(status);

private _future;
private _kernelspec;
private _kernelInfo;
private _executionCount;
}

@@ -1,2 +0,4 @@

"use strict";
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
'use strict';
var utils = require('jupyter-js-utils');

@@ -8,3 +10,3 @@ var phosphor_signaling_1 = require('phosphor-signaling');

/**
* A mock kernel object that only handles execution requests.
* A mock kernel object.
* It only keeps one kernel future at a time.

@@ -20,2 +22,5 @@ */

this._future = null;
this._kernelspec = null;
this._kernelInfo = null;
this._executionCount = 0;
options = options || {};

@@ -156,5 +161,11 @@ this.id = options.id || '';

MockKernel.prototype.kernelInfo = function () {
return this._sendKernelMessage('kernel_info_request', 'shell', {});
return Promise.resolve(this._kernelInfo);
};
/**
* Set the kernel info for the mock kernel.
*/
MockKernel.prototype.setKernelInfo = function (value) {
this._kernelInfo = value;
};
/**
* Send a `complete_request` message.

@@ -179,4 +190,8 @@ */

* Send an `execute_request` message.
*
* #### Notes
* This simulatates an actual exection on the server.
*/
MockKernel.prototype.execute = function (contents, disposeOnDone) {
var _this = this;
if (disposeOnDone === void 0) { disposeOnDone = true; }

@@ -198,3 +213,21 @@ var options = {

var msg = kernel_1.createKernelMessage(options, contents);
return this.sendShellMessage(msg, true, disposeOnDone);
var future = this.sendShellMessage(msg, true, disposeOnDone);
Promise.resolve(void 0).then(function () {
_this.sendServerMessage('status', 'iopub', {
execution_state: 'busy'
});
_this.sendServerMessage('stream', 'iopub', {
name: 'stdout',
text: 'foo'
});
_this.sendServerMessage('status', 'iopub', {
execution_state: 'idle'
});
_this.sendServerMessage('execute_reply', 'shell', {
execution_count: ++_this._executionCount,
data: {},
metadata: {}
});
});
return future;
};

@@ -233,4 +266,10 @@ /**

MockKernel.prototype.getKernelSpec = function () {
return Promise.resolve(void 0);
return Promise.resolve(this._kernelspec);
};
/**
* Set the kernel spec associated with the kernel.
*/
MockKernel.prototype.setKernelSpec = function (value) {
this._kernelspec = value;
};
MockKernel.prototype._sendKernelMessage = function (msgType, channel, contents) {

@@ -252,4 +291,4 @@ var options = {

return new Promise(function (resolve, reject) {
future.onReply = function (msg) {
resolve(msg.content);
future.onReply = function (reply) {
resolve(reply.content);
};

@@ -256,0 +295,0 @@ });

2

package.json
{
"name": "jupyter-js-services",
"version": "0.10.4",
"version": "0.10.5",
"description": "Client APIs for the Jupyter services REST APIs",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc