From 6d2c1bc45cebff31019428b7f2c2f7615c5f5737 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 12 Oct 2021 14:07:30 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- ipympl/backend_nbagg.py | 14 ++++++-------- src/mpl_widget.ts | 3 +-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/ipympl/backend_nbagg.py b/ipympl/backend_nbagg.py index 3d147531..e89f57d8 100644 --- a/ipympl/backend_nbagg.py +++ b/ipympl/backend_nbagg.py @@ -10,11 +10,8 @@ # Python 2.7 from collections import Iterable -import numpy as np - -from PIL import Image - import matplotlib +import numpy as np from IPython import get_ipython from IPython import version_info as ipython_version_info from IPython.display import HTML, display @@ -29,6 +26,7 @@ NavigationToolbar2WebAgg, TimerTornado, ) +from PIL import Image from traitlets import ( Any, Bool, @@ -261,7 +259,9 @@ def send_binary(self, data): # Update _data_url if self.syncing_data_url: - data = self._last_buff.view(dtype=np.uint8).reshape((*self._last_buff.shape, 4)) + data = self._last_buff.view(dtype=np.uint8).reshape( + (*self._last_buff.shape, 4) + ) with io.BytesIO() as png: Image.fromarray(data).save(png, format="png") self._data_url = b64encode(png.getvalue()).decode('utf-8') @@ -282,9 +282,7 @@ def _repr_mimebundle_(self, **kwargs): buf = io.BytesIO() self.figure.savefig(buf, format='png', dpi='figure') - self._data_url = b64encode( - buf.getvalue() - ).decode('utf-8') + self._data_url = b64encode(buf.getvalue()).decode('utf-8') data = { 'text/plain': plaintext, diff --git a/src/mpl_widget.ts b/src/mpl_widget.ts index 054c4954..7942f89e 100644 --- a/src/mpl_widget.ts +++ b/src/mpl_widget.ts @@ -10,7 +10,6 @@ import * as utils from './utils'; import { MODULE_VERSION } from './version'; - export class MPLCanvasModel extends DOMWidgetModel { offscreen_canvas: HTMLCanvasElement; offscreen_context: CanvasRenderingContext2D; @@ -52,7 +51,7 @@ export class MPLCanvasModel extends DOMWidgetModel { static serializers: ISerializers = { ...DOMWidgetModel.serializers, - toolbar: { deserialize: unpack_models as any } + toolbar: { deserialize: unpack_models as any }, }; initialize(attributes: any, options: any) {