Skip to content

Commit c1cd5b2

Browse files
committed
Bump mypy
1 parent 3609e70 commit c1cd5b2

File tree

7 files changed

+30
-29
lines changed

7 files changed

+30
-29
lines changed

.github/workflows/flake8.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
if: steps.changes.outputs.code == 'true'
3636
uses: "actions/setup-python@v5"
3737
with:
38-
python-version: "3.8"
38+
python-version: "3.9"
3939

4040
- name: Install dependencies 🔧
4141
if: steps.changes.outputs.code == 'true'

.github/workflows/mypy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
if: steps.changes.outputs.code == 'true'
4141
uses: "actions/setup-python@v5"
4242
with:
43-
python-version: "3.8"
43+
python-version: "3.9"
4444

4545
- name: Install dependencies (Linux) 🔧
4646
if: ${{ matrix.os == 'ubuntu-22.04' && steps.changes.outputs.code == 'true' }}

pymassspec_plot/__init__.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
from typing import List, Mapping, Optional, Sequence, Tuple
3030

3131
# 3rd party
32-
import matplotlib # type: ignore[import-untyped]
33-
import matplotlib.pyplot as plt # type: ignore[import-untyped]
34-
from matplotlib.axes import Axes # type: ignore[import-untyped]
35-
from matplotlib.backend_bases import MouseEvent # type: ignore[import-untyped]
36-
from matplotlib.container import BarContainer # type: ignore[import-untyped]
37-
from matplotlib.figure import Figure # type: ignore[import-untyped]
38-
from matplotlib.lines import Line2D # type: ignore[import-untyped]
32+
import matplotlib
33+
import matplotlib.pyplot as plt
34+
from matplotlib.axes import Axes
35+
from matplotlib.backend_bases import MouseEvent
36+
from matplotlib.container import BarContainer
37+
from matplotlib.figure import Figure
38+
from matplotlib.lines import Line2D
3939
from pyms import Peak
4040
from pyms.IonChromatogram import IonChromatogram
4141
from pyms.Peak.List.Function import is_peak_list
@@ -296,9 +296,9 @@ class ClickEventHandler:
296296
ax: Axes
297297

298298
#: The figure to plot mass spectra on after right clicking the plot.
299-
ms_fig: Figure
299+
ms_fig: Optional[Figure]
300300
#: The axes to plot mass spectra on after right clicking the plot.
301-
ms_ax: Axes
301+
ms_ax: Optional[Axes]
302302

303303
#: The number of top intensities to show in the terminal when left clicking the plot.
304304
n_intensities: int
@@ -327,16 +327,16 @@ def __init__(
327327

328328
self.peak_list = peak_list
329329

330-
self.ms_fig: Optional[Figure] = None
331-
self.ms_ax: Optional[Axes] = None
330+
self.ms_fig = None
331+
self.ms_ax = None
332332

333333
self._min = 1 - tolerance
334334
self._max = 1 + tolerance
335335
self.n_intensities = n_intensities
336336

337337
# If no peak list plot, no mouse click event
338338
if len(self.peak_list):
339-
self.cid = self.fig.canvas.mpl_connect("button_press_event", self.onclick)
339+
self.cid = self.fig.canvas.mpl_connect("button_press_event", self.onclick) # type: ignore[arg-type]
340340
else:
341341
self.cid = None
342342

@@ -351,6 +351,7 @@ def onclick(self, event: MouseEvent) -> None:
351351

352352
for peak in self.peak_list:
353353
# if event.xdata > 0.9999*peak.rt and event.xdata < 1.0001*peak.rt:
354+
assert event.xdata is not None
354355
if self._min * peak.rt < event.xdata < self._max * peak.rt:
355356
intensity_list = peak.mass_spectrum.mass_spec
356357
mass_list = peak.mass_spectrum.mass_list

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ autodoc_exclude_members = [
128128
]
129129

130130
[tool.mypy]
131-
python_version = "3.8"
131+
python_version = "3.9"
132132
namespace_packages = true
133133
check_untyped_defs = true
134134
warn_unused_ignores = true

repo_helper.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ short_desc: 'Plotting extension for PyMassSpec.'
1515
min_coverage: 88
1616
use_whey: true
1717
sphinx_html_theme: furo
18-
python_deploy_version: 3.8
19-
mypy_version: "1.8.0"
18+
python_deploy_version: 3.9
19+
mypy_version: 1.16
2020
preserve_custom_theme: true
2121

2222
conda_channels:

tests/test_plot.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
import pytest
88
from coincidence.regressions import AdvancedFileRegressionFixture
99
from domdf_python_tools.paths import PathPlus
10-
from matplotlib import pyplot as plt # type: ignore[import-untyped]
11-
from matplotlib.backend_bases import MouseEvent # type: ignore[import-untyped]
12-
from matplotlib.cbook import CallbackRegistry # type: ignore[import-untyped]
13-
from matplotlib.figure import Figure # type: ignore[import-untyped]
10+
from matplotlib import pyplot as plt
11+
from matplotlib.backend_bases import MouseEvent
12+
from matplotlib.cbook import CallbackRegistry
13+
from matplotlib.figure import Figure
1414
from pyms.GCMS.Class import GCMS_data
1515
from pyms.IntensityMatrix import IntensityMatrix
1616
from pyms.IonChromatogram import IonChromatogram
@@ -364,7 +364,7 @@ def test_click_event_handler(
364364
callbacks: CallbackRegistry = fig.canvas.callbacks
365365
assert "button_press_event" in callbacks.callbacks
366366

367-
event = MouseEvent("button_press_event", fig.canvas, peak_list[0].rt, 100, button=1)
367+
event = MouseEvent("button_press_event", fig.canvas, peak_list[0].rt, 100, button=1) # type: ignore[arg-type]
368368
event.xdata = peak_list[0].rt # FIXME
369369

370370
callbacks.process("button_press_event", event)

tox.ini

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ requires =
3232
[envlists]
3333
test = py37, py38, py39, py310, py311, py312, py313
3434
qa = mypy, lint
35-
cov = py38, coverage
35+
cov = py39, coverage
3636

3737
[testenv]
3838
setenv =
@@ -82,7 +82,7 @@ commands =
8282
check-wheel-contents dist/
8383

8484
[testenv:lint]
85-
basepython = python3.8
85+
basepython = python3.9
8686
changedir = {toxinidir}
8787
ignore_errors = True
8888
skip_install = True
@@ -112,32 +112,32 @@ deps =
112112
commands = python3 -m flake8_rst_docstrings_sphinx pymassspec_plot tests --allow-toolbox {posargs}
113113

114114
[testenv:perflint]
115-
basepython = python3.8
115+
basepython = python3.9
116116
changedir = {toxinidir}
117117
ignore_errors = True
118118
skip_install = True
119119
deps = perflint
120120
commands = python3 -m perflint pymassspec_plot {posargs}
121121

122122
[testenv:mypy]
123-
basepython = python3.8
123+
basepython = python3.9
124124
ignore_errors = True
125125
changedir = {toxinidir}
126126
deps =
127-
mypy==1.8.0
127+
mypy==1.16
128128
-r{toxinidir}/tests/requirements.txt
129129
commands = mypy pymassspec_plot tests {posargs}
130130

131131
[testenv:pyup]
132-
basepython = python3.8
132+
basepython = python3.9
133133
skip_install = True
134134
ignore_errors = True
135135
changedir = {toxinidir}
136136
deps = pyupgrade-directories
137137
commands = pyup_dirs pymassspec_plot tests --py36-plus --recursive
138138

139139
[testenv:coverage]
140-
basepython = python3.8
140+
basepython = python3.9
141141
skip_install = True
142142
ignore_errors = True
143143
whitelist_externals = /bin/bash

0 commit comments

Comments
 (0)