Skip to content

Commit 726fb2f

Browse files
Fix linter errors
1 parent e870586 commit 726fb2f

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

matplotlib_pyodide/html5_canvas_backend.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,25 +291,22 @@ def _math_to_rgba(self, s, prop, rgb):
291291
"""Convert math text to an RGBA array using path parser and figure"""
292292
from io import BytesIO
293293

294-
# Get the text dimensions
294+
# Get the text dimensions and generate a figure
295+
# of the right rize.
295296
width, height, depth, _, _ = self.mathtext_parser.parse(s, dpi=72, prop=prop)
296297

297-
# Create a figure of the right size
298298
fig = figure.Figure(figsize=(width / 72, height / 72))
299299

300300
# Add text to the figure
301301
# Note: depth/height gives us the baseline position
302302
fig.text(0, depth / height, s, fontproperties=prop, color=rgb)
303303

304-
# Set up the Agg backend
305304
backend_agg.FigureCanvasAgg(fig)
306305

307-
# Render to PNG
308-
buf = BytesIO()
306+
buf = BytesIO() # render to PNG
309307
fig.savefig(buf, dpi=self.dpi, format="png", transparent=True)
310308
buf.seek(0)
311309

312-
# Read back the image
313310
rgba = plt.imread(buf)
314311
return rgba, depth
315312

tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ def matplotlib_test_decorator(f):
1919
@pytest.fixture(scope="module")
2020
def wheel_path(tmp_path_factory):
2121
# Build a micropip wheel for testing
22-
import build
2322
from build.env import DefaultIsolatedEnv
2423

24+
import build
25+
2526
output_dir = tmp_path_factory.mktemp("wheel")
2627

2728
with DefaultIsolatedEnv() as env:

0 commit comments

Comments
 (0)