Skip to content

Commit b9bf816

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 851ec71 commit b9bf816

File tree

5 files changed

+38
-38
lines changed

5 files changed

+38
-38
lines changed

ipympl/backend_nbagg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from collections.abc import Iterable
2525
except ImportError:
2626
# Python 2.7
27-
from collections import Iterable
27+
from collections.abc import Iterable
2828

2929
import matplotlib
3030
import numpy as np

src/mpl_widget.ts

+27-27
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ export class MPLCanvasModel extends DOMWidgetModel {
275275
} catch (e) {
276276
console.log(
277277
"No handler for the '" + msg_type + "' message type: ",
278-
msg
278+
msg,
279279
);
280280
return;
281281
}
@@ -328,7 +328,7 @@ export class MPLCanvasModel extends DOMWidgetModel {
328328
0,
329329
0,
330330
this.offscreen_canvas.width,
331-
this.offscreen_canvas.height
331+
this.offscreen_canvas.height,
332332
);
333333
}
334334

@@ -410,23 +410,23 @@ export class MPLCanvasView extends DOMWidgetView {
410410
model_events() {
411411
this.model.on(
412412
'change:header_visible',
413-
this._update_header_visible.bind(this)
413+
this._update_header_visible.bind(this),
414414
);
415415
this.model.on(
416416
'change:footer_visible',
417-
this._update_footer_visible.bind(this)
417+
this._update_footer_visible.bind(this),
418418
);
419419
this.model.on(
420420
'change:toolbar_visible',
421-
this._update_toolbar_visible.bind(this)
421+
this._update_toolbar_visible.bind(this),
422422
);
423423
this.model.on(
424424
'change:toolbar_position',
425-
this._update_toolbar_position.bind(this)
425+
this._update_toolbar_position.bind(this),
426426
);
427427
this.model.on(
428428
'change:_figure_label',
429-
this._update_figure_label.bind(this)
429+
this._update_figure_label.bind(this),
430430
);
431431
this.model.on('change:_message', this._update_message.bind(this));
432432
this.model.on('change:_cursor', this._update_cursor.bind(this));
@@ -459,7 +459,7 @@ export class MPLCanvasView extends DOMWidgetView {
459459
this.header.classList.add(
460460
'jupyter-widgets',
461461
'widget-label',
462-
'jupyter-matplotlib-header'
462+
'jupyter-matplotlib-header',
463463
);
464464
this._update_header_visible();
465465
this._update_figure_label();
@@ -474,7 +474,7 @@ export class MPLCanvasView extends DOMWidgetView {
474474
const canvas_container = document.createElement('div');
475475
canvas_container.classList.add(
476476
'jupyter-widgets',
477-
'jupyter-matplotlib-canvas-container'
477+
'jupyter-matplotlib-canvas-container',
478478
);
479479
this.figure.appendChild(canvas_container);
480480

@@ -483,7 +483,7 @@ export class MPLCanvasView extends DOMWidgetView {
483483
canvas_div.style.clear = 'both';
484484
canvas_div.classList.add(
485485
'jupyter-widgets',
486-
'jupyter-matplotlib-canvas-div'
486+
'jupyter-matplotlib-canvas-div',
487487
);
488488

489489
canvas_div.addEventListener('keydown', this.key_event('key_press'));
@@ -512,35 +512,35 @@ export class MPLCanvasView extends DOMWidgetView {
512512
top_canvas.addEventListener('dblclick', this.mouse_event('dblclick'));
513513
top_canvas.addEventListener(
514514
'mousedown',
515-
this.mouse_event('button_press')
515+
this.mouse_event('button_press'),
516516
);
517517
top_canvas.addEventListener(
518518
'mouseup',
519-
this.mouse_event('button_release')
519+
this.mouse_event('button_release'),
520520
);
521521
top_canvas.addEventListener(
522522
'mousemove',
523523
throttle(
524524
this.mouse_event('motion_notify'),
525-
this.model.get('pan_zoom_throttle')
526-
)
525+
this.model.get('pan_zoom_throttle'),
526+
),
527527
);
528528

529529
top_canvas.addEventListener(
530530
'mouseenter',
531-
this.mouse_event('figure_enter')
531+
this.mouse_event('figure_enter'),
532532
);
533533
top_canvas.addEventListener(
534534
'mouseleave',
535-
this.mouse_event('figure_leave')
535+
this.mouse_event('figure_leave'),
536536
);
537537

538538
top_canvas.addEventListener(
539539
'wheel',
540540
throttle(
541541
this.mouse_event('scroll'),
542-
this.model.get('pan_zoom_throttle')
543-
)
542+
this.model.get('pan_zoom_throttle'),
543+
),
544544
);
545545

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

562562
async _init_toolbar() {
563563
this.toolbar_view = (await this.create_child_view(
564-
this.model.get('toolbar')
564+
this.model.get('toolbar'),
565565
)) as ToolbarView;
566566

567567
this.figure.appendChild(this.toolbar_view.el);
@@ -588,7 +588,7 @@ export class MPLCanvasView extends DOMWidgetView {
588588
0,
589589
0,
590590
this.canvas.width,
591-
this.canvas.height
591+
this.canvas.height,
592592
);
593593
} else {
594594
this.context.drawImage(this.model.offscreen_canvas, 0, 0);
@@ -598,7 +598,7 @@ export class MPLCanvasView extends DOMWidgetView {
598598
0,
599599
0,
600600
this.top_canvas.width,
601-
this.top_canvas.height
601+
this.top_canvas.height,
602602
);
603603

604604
// Draw rubberband
@@ -617,7 +617,7 @@ export class MPLCanvasView extends DOMWidgetView {
617617
this.model.get('_rubberband_x'),
618618
this.model.get('_rubberband_y'),
619619
this.model.get('_rubberband_width'),
620-
this.model.get('_rubberband_height')
620+
this.model.get('_rubberband_height'),
621621
);
622622
}
623623

@@ -629,7 +629,7 @@ export class MPLCanvasView extends DOMWidgetView {
629629
this.top_canvas.height - this.resize_handle_size,
630630
// Stop
631631
this.top_canvas.width,
632-
this.top_canvas.height
632+
this.top_canvas.height,
633633
);
634634
gradient.addColorStop(0, 'white');
635635
gradient.addColorStop(1, 'black');
@@ -641,15 +641,15 @@ export class MPLCanvasView extends DOMWidgetView {
641641
this.top_context.beginPath();
642642
this.top_context.moveTo(
643643
this.top_canvas.width,
644-
this.top_canvas.height
644+
this.top_canvas.height,
645645
);
646646
this.top_context.lineTo(
647647
this.top_canvas.width,
648-
this.top_canvas.height - this.resize_handle_size
648+
this.top_canvas.height - this.resize_handle_size,
649649
);
650650
this.top_context.lineTo(
651651
this.top_canvas.width - this.resize_handle_size,
652-
this.top_canvas.height
652+
this.top_canvas.height,
653653
);
654654
this.top_context.closePath();
655655
this.top_context.fill();
@@ -668,7 +668,7 @@ export class MPLCanvasView extends DOMWidgetView {
668668
this.footer.classList.add(
669669
'jupyter-widgets',
670670
'widget-label',
671-
'jupyter-matplotlib-footer'
671+
'jupyter-matplotlib-footer',
672672
);
673673
this._update_footer_visible();
674674
this._update_message();

src/plugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default jupyterMatplotlibPlugin;
2727
*/
2828
function activateWidgetExtension(
2929
app: Application<Widget>,
30-
registry: IJupyterWidgetRegistry
30+
registry: IJupyterWidgetRegistry,
3131
): void {
3232
registry.registerWidget({
3333
name: MODULE_NAME,

src/toolbar_widget.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class ToolbarView extends DOMWidgetView {
3838
'jupyter-widgets',
3939
'jupyter-matplotlib-toolbar',
4040
'widget-container',
41-
'widget-box'
41+
'widget-box',
4242
);
4343

4444
// Fade-in/fade-out mode by default, the figure will decide
@@ -69,14 +69,14 @@ export class ToolbarView extends DOMWidgetView {
6969
button.classList.add(
7070
'jupyter-matplotlib-button',
7171
'jupyter-widgets',
72-
'jupyter-button'
72+
'jupyter-button',
7373
);
7474
button.setAttribute('href', '#');
7575
button.setAttribute('title', tooltip);
7676
button.style.outline = 'none';
7777
button.addEventListener(
7878
'click',
79-
this.toolbar_button_onclick(method_name)
79+
this.toolbar_button_onclick(method_name),
8080
);
8181

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

164164
set_visibility(
165-
value: 'visible' | 'hidden' | 'fade-in-fade-out' | boolean
165+
value: 'visible' | 'hidden' | 'fade-in-fade-out' | boolean,
166166
): void {
167167
// For backward compatibility with the old API
168168
if (typeof value === 'boolean') {
@@ -247,7 +247,7 @@ export class ToolbarView extends DOMWidgetView {
247247
this.model.on_some_change(
248248
['button_style', '_current_action'],
249249
this.set_buttons_style,
250-
this
250+
this,
251251
);
252252
}
253253
}

ui-tests/tests/ipympl.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const filterUpdateNotebooks = (item) => {
1717

1818
const testCellOutputs = async (
1919
page: IJupyterLabPageFixture,
20-
tmpPath: string
20+
tmpPath: string,
2121
) => {
2222
const paths = klaw(path.resolve(__dirname, './notebooks'), {
2323
filter: (item) => !filterUpdateNotebooks(item),
@@ -52,7 +52,7 @@ const testCellOutputs = async (
5252

5353
for (let c = 0; c < numCellImages; ++c) {
5454
expect(results[c]).toMatchSnapshot(
55-
getCaptureImageName(notebook, c)
55+
getCaptureImageName(notebook, c),
5656
);
5757
}
5858

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

9595
for (let i = 0; i < cellCount; i++) {
9696
expect(results[i]).toMatchSnapshot(
97-
getCaptureImageName(notebook, i)
97+
getCaptureImageName(notebook, i),
9898
);
9999
}
100100

@@ -106,7 +106,7 @@ test.describe('ipympl Visual Regression', () => {
106106
test.beforeEach(async ({ page, tmpPath }) => {
107107
await page.contents.uploadDirectory(
108108
path.resolve(__dirname, './notebooks'),
109-
tmpPath
109+
tmpPath,
110110
);
111111
await page.filebrowser.openDirectory(tmpPath);
112112
});

0 commit comments

Comments
 (0)