Skip to content

Commit 03e87f9

Browse files
committed
formatting
1 parent edc4ed7 commit 03e87f9

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

matplotlib-backend-sixel.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# SPDX-License-Identifier: CC0-1.0
22

33
import sys
4-
import tempfile
4+
from tempfile import NamedTemporaryFile
55

66
from matplotlib import interactive, is_interactive
77
from matplotlib._pylab_helpers import Gcf
88
from matplotlib.backend_bases import FigureManagerBase, _Backend
99
from matplotlib.backends.backend_agg import FigureCanvasAgg
10-
from sixel import converter
10+
from sixel.converter import SixelConverter
1111

1212
# XXX heuristic for interactive repl
1313
if sys.flags.interactive:
@@ -16,9 +16,9 @@
1616

1717
class FigureManagerSixel(FigureManagerBase):
1818
def show(self):
19-
with tempfile.NamedTemporaryFile() as temppng:
19+
with NamedTemporaryFile() as temppng:
2020
self.canvas.figure.savefig(temppng.name, bbox_inches="tight", format="png")
21-
sixel_convert = converter.SixelConverter(temppng)
21+
sixel_convert = SixelConverter(temppng)
2222
sixel_convert.write(sys.stdout)
2323

2424

@@ -35,9 +35,10 @@ class _BackendSixelAgg(_Backend):
3535
def mainloop():
3636
return
3737

38-
# XXX: `draw_if_interactive` isn't really intended for on-shot rendering. We run the risk of being called
39-
# on a figure that isn't completely rendered yet, so we skip draw calls for figures that we detect as
40-
# not being fully initialized yet. Our heuristic for that is the presence of axes on the figure.
38+
# XXX: `draw_if_interactive` isn't really intended for on-shot rendering.
39+
# We run the risk of being called on a figure that isn't completely rendered yet,
40+
# so we skip draw calls for figures that we detect as not being fully initialized yet.
41+
# Our heuristic for that is the presence of axes on the figure.
4142
@classmethod
4243
def draw_if_interactive(cls):
4344
manager = Gcf.get_active()

0 commit comments

Comments
 (0)