Skip to content

Commit 2f8a38f

Browse files
committed
Increase mypy strictness
1 parent 93f3da7 commit 2f8a38f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ repos:
4040
rev: v0.910-1
4141
hooks:
4242
- id: mypy
43+
args: ["--disallow-incomplete-defs", "--ignore-missing-imports"]

src/napari_matplotlib/scatter.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import napari
55
import numpy as np
66
from magicgui import magicgui
7+
from magicgui.widgets import ComboBox
78

89
from .base import NapariMPLWidget
910
from .util import Interval
@@ -135,7 +136,7 @@ def x_axis_key(self) -> Optional[str]:
135136
return self._x_axis_key
136137

137138
@x_axis_key.setter
138-
def x_axis_key(self, key: Optional[str]):
139+
def x_axis_key(self, key: Optional[str]) -> None:
139140
self._x_axis_key = key
140141
self._draw()
141142

@@ -145,17 +146,17 @@ def y_axis_key(self) -> Optional[str]:
145146
return self._y_axis_key
146147

147148
@y_axis_key.setter
148-
def y_axis_key(self, key: Optional[str]):
149+
def y_axis_key(self, key: Optional[str]) -> None:
149150
self._y_axis_key = key
150151
self._draw()
151152

152-
def _set_axis_keys(self, x_axis_key: str, y_axis_key: str):
153+
def _set_axis_keys(self, x_axis_key: str, y_axis_key: str) -> None:
153154
"""Set both axis keys and then redraw the plot"""
154155
self._x_axis_key = x_axis_key
155156
self._y_axis_key = y_axis_key
156157
self._draw()
157158

158-
def _get_valid_axis_keys(self, combo_widget=None) -> List[str]:
159+
def _get_valid_axis_keys(self, combo_widget: ComboBox) -> List[str]:
159160
"""
160161
Get the valid axis keys from the layer FeatureTable.
161162
@@ -188,7 +189,7 @@ def _get_data(self) -> Tuple[List[np.ndarray], str, str]:
188189
if not hasattr(self.layers[0], "features"):
189190
# if the selected layer doesn't have a featuretable,
190191
# skip draw
191-
return np.array([]), "", ""
192+
return [np.array([])], "", ""
192193

193194
feature_table = self.layers[0].features
194195

@@ -197,7 +198,7 @@ def _get_data(self) -> Tuple[List[np.ndarray], str, str]:
197198
or (self.x_axis_key is None)
198199
or (self.y_axis_key is None)
199200
):
200-
return np.array([]), "", ""
201+
return [np.array([])], "", ""
201202

202203
data_x = feature_table[self.x_axis_key]
203204
data_y = feature_table[self.y_axis_key]

0 commit comments

Comments
 (0)