Skip to content

Commit 084e201

Browse files
authored
fix pin and add zimor action (#71)
2 parents 394d7ea + 1cc27b3 commit 084e201

6 files changed

Lines changed: 51 additions & 12 deletions

File tree

‎.github/workflows/main.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
persist-credentials: false
4040

4141
- name: Setup Python ${{ matrix.python-version }}
42-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
42+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
4343
with:
4444
python-version: ${{ matrix.python-version }}
4545

‎.github/workflows/publish.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
persist-credentials: false
2222

2323
- name: Set up Python
24-
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
24+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2525
with:
2626
python-version: '3.x'
2727
- name: Install dependencies

‎.github/workflows/zizmor.yml‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: GitHub Actions Security Analysis with zizmor
2+
3+
on:
4+
push:
5+
branches: [ main, 7.x, 8.x ]
6+
pull_request:
7+
branches: [ main, 7.x, 8.x ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
zizmor:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
# Needed to upload the results to the code-scanning dashboard.
18+
security-events: write
19+
steps:
20+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
21+
with:
22+
persist-credentials: false
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
25+
- name: Run zizmor
26+
id: zizmor
27+
run: uvx zizmor --format=sarif . > results.sarif
28+
continue-on-error: true
29+
env:
30+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
- name: Upload SARIF results
32+
if: always()
33+
uses: github/codeql-action/upload-sarif@cdf488f595d80d6e07e03d4674febd5ab45fa938 # v4.37.9
34+
with:
35+
sarif_file: results.sarif
36+
category: zizmor
37+
- name: Fail if zizmor found problems
38+
if: steps.zizmor.outcome == 'failure'
39+
run: exit 1

‎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(

‎tests/notebooks/config_InlineBackend.ipynb‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
" 'optimize': True}}\n",
2626
"\n",
2727
"import matplotlib.pyplot as plt\n",
28-
"from matplotlib_inline.backend_inline import set_matplotlib_formats\n",
29-
"from traitlets.config import get_config"
28+
"from traitlets.config import get_config\n",
29+
"\n",
30+
"from matplotlib_inline.backend_inline import set_matplotlib_formats"
3031
]
3132
},
3233
{

0 commit comments

Comments
 (0)