From 84034120fbdeacf34be4b4ecae693183e5faa339 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 7 Oct 2021 09:46:17 +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 | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/ipympl/backend_nbagg.py b/ipympl/backend_nbagg.py index 3b037d79..d07fff90 100644 --- a/ipympl/backend_nbagg.py +++ b/ipympl/backend_nbagg.py @@ -4,29 +4,12 @@ import json from base64 import b64encode -from PIL import Image - +import matplotlib import numpy as np - -from traitlets import ( - Any, - Bool, - CaselessStrEnum, - CInt, - Enum, - Instance, - List, - Unicode, - default, -) - from IPython import get_ipython from IPython import version_info as ipython_version_info from IPython.display import HTML, display - from ipywidgets import DOMWidget, widget_serialization - -import matplotlib from matplotlib import is_interactive, rcParams from matplotlib._pylab_helpers import Gcf from matplotlib.backend_bases import NavigationToolbar2, _Backend, cursors @@ -36,6 +19,18 @@ NavigationToolbar2WebAgg, TimerTornado, ) +from PIL import Image +from traitlets import ( + Any, + Bool, + CaselessStrEnum, + CInt, + Enum, + Instance, + List, + Unicode, + default, +) from ._version import js_semver @@ -241,8 +236,9 @@ def get_image(self): # The buffer is created as type uint32 so that entire # pixels can be compared in one numpy call, rather than # needing to compare each plane separately. - output = (np.frombuffer(renderer.buffer_rgba(), dtype=np.uint32) - .reshape((renderer.height, renderer.width))) + output = np.frombuffer(renderer.buffer_rgba(), dtype=np.uint32).reshape( + (renderer.height, renderer.width) + ) self._png_is_old = False