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] authored and martinRenou committed Oct 19, 2021
1 parent 63bbf94 commit 6d2c1bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
14 changes: 6 additions & 8 deletions ipympl/backend_nbagg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -29,6 +26,7 @@
NavigationToolbar2WebAgg,
TimerTornado,
)
from PIL import Image
from traitlets import (
Any,
Bool,
Expand Down Expand Up @@ -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')
Expand All @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions src/mpl_widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 6d2c1bc

Please sign in to comment.