Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 3, 2022
1 parent 851ec71 commit b9bf816
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion ipympl/backend_nbagg.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from collections.abc import Iterable
except ImportError:
# Python 2.7
from collections import Iterable
from collections.abc import Iterable

import matplotlib
import numpy as np
Expand Down
54 changes: 27 additions & 27 deletions src/mpl_widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export class MPLCanvasModel extends DOMWidgetModel {
} catch (e) {
console.log(
"No handler for the '" + msg_type + "' message type: ",
msg
msg,
);
return;
}
Expand Down Expand Up @@ -328,7 +328,7 @@ export class MPLCanvasModel extends DOMWidgetModel {
0,
0,
this.offscreen_canvas.width,
this.offscreen_canvas.height
this.offscreen_canvas.height,
);
}

Expand Down Expand Up @@ -410,23 +410,23 @@ export class MPLCanvasView extends DOMWidgetView {
model_events() {
this.model.on(
'change:header_visible',
this._update_header_visible.bind(this)
this._update_header_visible.bind(this),
);
this.model.on(
'change:footer_visible',
this._update_footer_visible.bind(this)
this._update_footer_visible.bind(this),
);
this.model.on(
'change:toolbar_visible',
this._update_toolbar_visible.bind(this)
this._update_toolbar_visible.bind(this),
);
this.model.on(
'change:toolbar_position',
this._update_toolbar_position.bind(this)
this._update_toolbar_position.bind(this),
);
this.model.on(
'change:_figure_label',
this._update_figure_label.bind(this)
this._update_figure_label.bind(this),
);
this.model.on('change:_message', this._update_message.bind(this));
this.model.on('change:_cursor', this._update_cursor.bind(this));
Expand Down Expand Up @@ -459,7 +459,7 @@ export class MPLCanvasView extends DOMWidgetView {
this.header.classList.add(
'jupyter-widgets',
'widget-label',
'jupyter-matplotlib-header'
'jupyter-matplotlib-header',
);
this._update_header_visible();
this._update_figure_label();
Expand All @@ -474,7 +474,7 @@ export class MPLCanvasView extends DOMWidgetView {
const canvas_container = document.createElement('div');
canvas_container.classList.add(
'jupyter-widgets',
'jupyter-matplotlib-canvas-container'
'jupyter-matplotlib-canvas-container',
);
this.figure.appendChild(canvas_container);

Expand All @@ -483,7 +483,7 @@ export class MPLCanvasView extends DOMWidgetView {
canvas_div.style.clear = 'both';
canvas_div.classList.add(
'jupyter-widgets',
'jupyter-matplotlib-canvas-div'
'jupyter-matplotlib-canvas-div',
);

canvas_div.addEventListener('keydown', this.key_event('key_press'));
Expand Down Expand Up @@ -512,35 +512,35 @@ export class MPLCanvasView extends DOMWidgetView {
top_canvas.addEventListener('dblclick', this.mouse_event('dblclick'));
top_canvas.addEventListener(
'mousedown',
this.mouse_event('button_press')
this.mouse_event('button_press'),
);
top_canvas.addEventListener(
'mouseup',
this.mouse_event('button_release')
this.mouse_event('button_release'),
);
top_canvas.addEventListener(
'mousemove',
throttle(
this.mouse_event('motion_notify'),
this.model.get('pan_zoom_throttle')
)
this.model.get('pan_zoom_throttle'),
),
);

top_canvas.addEventListener(
'mouseenter',
this.mouse_event('figure_enter')
this.mouse_event('figure_enter'),
);
top_canvas.addEventListener(
'mouseleave',
this.mouse_event('figure_leave')
this.mouse_event('figure_leave'),
);

top_canvas.addEventListener(
'wheel',
throttle(
this.mouse_event('scroll'),
this.model.get('pan_zoom_throttle')
)
this.model.get('pan_zoom_throttle'),
),
);

canvas_div.appendChild(canvas);
Expand All @@ -561,7 +561,7 @@ export class MPLCanvasView extends DOMWidgetView {

async _init_toolbar() {
this.toolbar_view = (await this.create_child_view(
this.model.get('toolbar')
this.model.get('toolbar'),
)) as ToolbarView;

this.figure.appendChild(this.toolbar_view.el);
Expand All @@ -588,7 +588,7 @@ export class MPLCanvasView extends DOMWidgetView {
0,
0,
this.canvas.width,
this.canvas.height
this.canvas.height,
);
} else {
this.context.drawImage(this.model.offscreen_canvas, 0, 0);
Expand All @@ -598,7 +598,7 @@ export class MPLCanvasView extends DOMWidgetView {
0,
0,
this.top_canvas.width,
this.top_canvas.height
this.top_canvas.height,
);

// Draw rubberband
Expand All @@ -617,7 +617,7 @@ export class MPLCanvasView extends DOMWidgetView {
this.model.get('_rubberband_x'),
this.model.get('_rubberband_y'),
this.model.get('_rubberband_width'),
this.model.get('_rubberband_height')
this.model.get('_rubberband_height'),
);
}

Expand All @@ -629,7 +629,7 @@ export class MPLCanvasView extends DOMWidgetView {
this.top_canvas.height - this.resize_handle_size,
// Stop
this.top_canvas.width,
this.top_canvas.height
this.top_canvas.height,
);
gradient.addColorStop(0, 'white');
gradient.addColorStop(1, 'black');
Expand All @@ -641,15 +641,15 @@ export class MPLCanvasView extends DOMWidgetView {
this.top_context.beginPath();
this.top_context.moveTo(
this.top_canvas.width,
this.top_canvas.height
this.top_canvas.height,
);
this.top_context.lineTo(
this.top_canvas.width,
this.top_canvas.height - this.resize_handle_size
this.top_canvas.height - this.resize_handle_size,
);
this.top_context.lineTo(
this.top_canvas.width - this.resize_handle_size,
this.top_canvas.height
this.top_canvas.height,
);
this.top_context.closePath();
this.top_context.fill();
Expand All @@ -668,7 +668,7 @@ export class MPLCanvasView extends DOMWidgetView {
this.footer.classList.add(
'jupyter-widgets',
'widget-label',
'jupyter-matplotlib-footer'
'jupyter-matplotlib-footer',
);
this._update_footer_visible();
this._update_message();
Expand Down
2 changes: 1 addition & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default jupyterMatplotlibPlugin;
*/
function activateWidgetExtension(
app: Application<Widget>,
registry: IJupyterWidgetRegistry
registry: IJupyterWidgetRegistry,
): void {
registry.registerWidget({
name: MODULE_NAME,
Expand Down
10 changes: 5 additions & 5 deletions src/toolbar_widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class ToolbarView extends DOMWidgetView {
'jupyter-widgets',
'jupyter-matplotlib-toolbar',
'widget-container',
'widget-box'
'widget-box',
);

// Fade-in/fade-out mode by default, the figure will decide
Expand Down Expand Up @@ -69,14 +69,14 @@ export class ToolbarView extends DOMWidgetView {
button.classList.add(
'jupyter-matplotlib-button',
'jupyter-widgets',
'jupyter-button'
'jupyter-button',
);
button.setAttribute('href', '#');
button.setAttribute('title', tooltip);
button.style.outline = 'none';
button.addEventListener(
'click',
this.toolbar_button_onclick(method_name)
this.toolbar_button_onclick(method_name),
);

const icon = document.createElement('i');
Expand Down Expand Up @@ -162,7 +162,7 @@ export class ToolbarView extends DOMWidgetView {
}

set_visibility(
value: 'visible' | 'hidden' | 'fade-in-fade-out' | boolean
value: 'visible' | 'hidden' | 'fade-in-fade-out' | boolean,
): void {
// For backward compatibility with the old API
if (typeof value === 'boolean') {
Expand Down Expand Up @@ -247,7 +247,7 @@ export class ToolbarView extends DOMWidgetView {
this.model.on_some_change(
['button_style', '_current_action'],
this.set_buttons_style,
this
this,
);
}
}
8 changes: 4 additions & 4 deletions ui-tests/tests/ipympl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const filterUpdateNotebooks = (item) => {

const testCellOutputs = async (
page: IJupyterLabPageFixture,
tmpPath: string
tmpPath: string,
) => {
const paths = klaw(path.resolve(__dirname, './notebooks'), {
filter: (item) => !filterUpdateNotebooks(item),
Expand Down Expand Up @@ -52,7 +52,7 @@ const testCellOutputs = async (

for (let c = 0; c < numCellImages; ++c) {
expect(results[c]).toMatchSnapshot(
getCaptureImageName(notebook, c)
getCaptureImageName(notebook, c),
);
}

Expand Down Expand Up @@ -94,7 +94,7 @@ const testUpdates = async (page: IJupyterLabPageFixture, tmpPath: string) => {

for (let i = 0; i < cellCount; i++) {
expect(results[i]).toMatchSnapshot(
getCaptureImageName(notebook, i)
getCaptureImageName(notebook, i),
);
}

Expand All @@ -106,7 +106,7 @@ test.describe('ipympl Visual Regression', () => {
test.beforeEach(async ({ page, tmpPath }) => {
await page.contents.uploadDirectory(
path.resolve(__dirname, './notebooks'),
tmpPath
tmpPath,
);
await page.filebrowser.openDirectory(tmpPath);
});
Expand Down

0 comments on commit b9bf816

Please sign in to comment.