Skip to content

Commit 4fa6f65

Browse files
authored
Merge pull request #50 from matplotlib/mypy-opts
Increase mypy strictness
2 parents 93f3da7 + 019bcac commit 4fa6f65

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

Diff for: .pre-commit-config.yaml

+1
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"]

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[![Python Version](https://img.shields.io/pypi/pyversions/napari-matplotlib.svg?color=green)](https://python.org)
66
[![tests](https://github.com/dstansby/napari-matplotlib/workflows/tests/badge.svg)](https://github.com/dstansby/napari-matplotlib/actions)
77
[![codecov](https://codecov.io/gh/dstansby/napari-matplotlib/branch/main/graph/badge.svg)](https://codecov.io/gh/dstansby/napari-matplotlib)
8+
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/matplotlib/pytest-mpl/master.svg)](https://results.pre-commit.ci/latest/github/matplotlib/pytest-mpl/master)
89
[![napari hub](https://img.shields.io/endpoint?url=https://api.napari-hub.org/shields/napari-matplotlib)](https://napari-hub.org/plugins/napari-matplotlib)
910

1011
A plugin to create Matplotlib plots from napari layers

Diff for: src/napari_matplotlib/scatter.py

+9-6
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,19 @@ 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(
160+
self, combo_widget: Optional[ComboBox] = None
161+
) -> List[str]:
159162
"""
160163
Get the valid axis keys from the layer FeatureTable.
161164
@@ -188,7 +191,7 @@ def _get_data(self) -> Tuple[List[np.ndarray], str, str]:
188191
if not hasattr(self.layers[0], "features"):
189192
# if the selected layer doesn't have a featuretable,
190193
# skip draw
191-
return np.array([]), "", ""
194+
return [], "", ""
192195

193196
feature_table = self.layers[0].features
194197

@@ -197,7 +200,7 @@ def _get_data(self) -> Tuple[List[np.ndarray], str, str]:
197200
or (self.x_axis_key is None)
198201
or (self.y_axis_key is None)
199202
):
200-
return np.array([]), "", ""
203+
return [], "", ""
201204

202205
data_x = feature_table[self.x_axis_key]
203206
data_y = feature_table[self.y_axis_key]

0 commit comments

Comments
 (0)