Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongrout committed Feb 18, 2022
1 parent 82848c2 commit 45ebf31
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
10 changes: 3 additions & 7 deletions packages/base-manager/src/manager-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,10 @@ export abstract class ManagerBase implements IWidgetManager {
*
* #### Notes
* If the model is not found, the returned Promise object is rejected.
*
*
* If you would like to synchronously test if a model exists, use .has_model().
*/
async get_model(model_id: string): Promise<WidgetModel> {
async get_model(model_id: string): Promise<WidgetModel> {
const modelPromise = this._models[model_id];
if (modelPromise === undefined) {
throw new Error('widget model not found');
Expand Down Expand Up @@ -466,11 +466,7 @@ export abstract class ManagerBase implements IWidgetManager {
const state = states[widget_id];
// Put binary buffers
if (widget_id in bufferPaths) {
put_buffers(
state,
bufferPaths[widget_id],
bufferGroups[widget_id]
);
put_buffers(state, bufferPaths[widget_id], bufferGroups[widget_id]);
}
try {
if (comm) {
Expand Down
2 changes: 1 addition & 1 deletion packages/base/src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export interface IWidgetManager {
* #### Notes
* This is a synchronous way to check if a model is registered.
*/
has_model(model_id: string): boolean;
has_model(model_id: string): boolean;

/**
* Register a model instance promise with the manager.
Expand Down
4 changes: 2 additions & 2 deletions packages/base/test/src/dummy-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ export class DummyManager implements widgets.IWidgetManager {
*
* #### Notes
* If the model is not found, the returned Promise object is rejected.
*
*
* If you would like to synchronously test if a model exists, use .has_model().
*/
async get_model(model_id: string): Promise<widgets.WidgetModel> {
async get_model(model_id: string): Promise<widgets.WidgetModel> {
const modelPromise = this._models[model_id];
if (modelPromise === undefined) {
throw new Error('widget model not found');
Expand Down
18 changes: 9 additions & 9 deletions packages/html-manager/src/output_renderers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ export class WidgetRenderer extends Widget implements IRenderMime.IRenderer {
return;
}
try {
const wModel = await this._manager.get_model(source.model_id);
const wView = await this._manager.create_view(wModel);
Widget.attach(wView.luminoWidget, this.node);
} catch (err) {
console.log('Error displaying widget');
console.log(err);
this.node.textContent = 'Error displaying widget';
this.addClass('jupyter-widgets');
}
const wModel = await this._manager.get_model(source.model_id);
const wView = await this._manager.create_view(wModel);
Widget.attach(wView.luminoWidget, this.node);
} catch (err) {
console.log('Error displaying widget');
console.log(err);
this.node.textContent = 'Error displaying widget';
this.addClass('jupyter-widgets');
}
}

/**
Expand Down
4 changes: 3 additions & 1 deletion python/widgetsnbextension/src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ function register_events(Jupyter, events, outputarea) {
}

if (manager.has_model(data.model_id)) {
manager.get_model(data.model_id).then(function (model) {
manager
.get_model(data.model_id)
.then(function (model) {
return manager.create_view(model, { output: output });
})
.then(function (view) {
Expand Down

0 comments on commit 45ebf31

Please sign in to comment.