Skip to content

Commit 1cc27b3

Browse files
committed
ruff unsafe fixes
1 parent aa0b474 commit 1cc27b3

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

‎matplotlib_inline/backend_inline.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,25 +124,25 @@ def flush_figures():
124124
# ignore the tracking, just draw and close all figures
125125
try:
126126
return show(True)
127-
except Exception as e:
127+
except Exception:
128128
# safely show traceback if in IPython, else raise
129129
ip = get_ipython()
130130
if ip is None:
131-
raise e
131+
raise
132132
else:
133133
ip.showtraceback()
134134
return
135135

136136
# exclude any figures that were closed:
137-
active = set([fm.canvas.figure for fm in Gcf.get_all_fig_managers()])
137+
active = {fm.canvas.figure for fm in Gcf.get_all_fig_managers()}
138138
for fig in [fig for fig in show._to_draw if fig in active]:
139139
try:
140140
display(fig, metadata=_fetch_figure_metadata(fig))
141-
except Exception as e:
141+
except Exception:
142142
# safely show traceback if in IPython, else raise
143143
ip = get_ipython()
144144
if ip is None:
145-
raise e
145+
raise
146146
else:
147147
ip.showtraceback()
148148
return

‎matplotlib_inline/config.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ def _update_figure_formatters(self):
6161
)
6262

6363
def _figure_formats_changed(self, name, old, new):
64-
if "jpg" in new or "jpeg" in new:
65-
if not pil_available():
66-
raise TraitError("Requires PIL/Pillow for JPG figures")
64+
if ("jpg" in new or "jpeg" in new) and not pil_available():
65+
raise TraitError("Requires PIL/Pillow for JPG figures")
6766
self._update_figure_formatters()
6867

6968
figure_format = Unicode(

0 commit comments

Comments
 (0)