Skip to content

Commit ee5c1e0

Browse files
committed
Make linters happy
1 parent d0de647 commit ee5c1e0

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

Diff for: src/napari_matplotlib/histogram.py

+17-7
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@
44
import numpy as np
55
import numpy.typing as npt
66
from matplotlib.container import BarContainer
7-
from qtpy.QtWidgets import QComboBox, QLabel, QVBoxLayout, QWidget, QGroupBox, QFormLayout, QDoubleSpinBox, QSpinBox, QAbstractSpinBox
7+
from qtpy.QtWidgets import (
8+
QAbstractSpinBox,
9+
QComboBox,
10+
QDoubleSpinBox,
11+
QFormLayout,
12+
QGroupBox,
13+
QLabel,
14+
QSpinBox,
15+
QVBoxLayout,
16+
QWidget,
17+
)
818

919
from .base import SingleAxesWidget
1020
from .features import FEATURES_LAYER_TYPES
@@ -107,16 +117,13 @@ def bins_num(self, num: int) -> None:
107117

108118
def autoset_widget_bins(self, data: npt.ArrayLike) -> None:
109119
"""Update widgets with bins determined from the image data"""
110-
111120
bins = np.linspace(np.min(data), np.max(data), 100, dtype=data.dtype)
112121
self.bins_start = bins[0]
113122
self.bins_stop = bins[-1]
114123
self.bins_num = bins.size
115124

116-
117125
def _get_layer_data(self, layer) -> np.ndarray:
118126
"""Get the data associated with a given layer"""
119-
120127
if layer.data.ndim - layer.rgb == 3:
121128
# 3D data, can be single channel or RGB
122129
data = layer.data[self.current_z]
@@ -133,7 +140,6 @@ def on_update_layers(self) -> None:
133140
"""
134141
Called when the layer selection changes by ``self._update_layers()``.
135142
"""
136-
137143
if not self.layers:
138144
return
139145

@@ -143,8 +149,12 @@ def on_update_layers(self) -> None:
143149

144150
# Only allow integer bins for integer data
145151
n_decimals = 0 if np.issubdtype(layer_data.dtype, np.integer) else 2
146-
self.findChild(QDoubleSpinBox, name="bins start").setDecimals(n_decimals)
147-
self.findChild(QDoubleSpinBox, name="bins stop").setDecimals(n_decimals)
152+
self.findChild(QDoubleSpinBox, name="bins start").setDecimals(
153+
n_decimals
154+
)
155+
self.findChild(QDoubleSpinBox, name="bins stop").setDecimals(
156+
n_decimals
157+
)
148158

149159
def draw(self) -> None:
150160
"""

Diff for: src/napari_matplotlib/tests/test_histogram.py

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
assert_figures_not_equal,
1010
)
1111

12+
1213
@pytest.mark.mpl_image_compare
1314
def test_histogram_2D_bins(make_napari_viewer, astronaut_data):
1415
viewer = make_napari_viewer()
@@ -24,6 +25,7 @@ def test_histogram_2D_bins(make_napari_viewer, astronaut_data):
2425
# collected by the widget
2526
return deepcopy(fig)
2627

28+
2729
@pytest.mark.mpl_image_compare
2830
def test_histogram_2D(make_napari_viewer, astronaut_data):
2931
viewer = make_napari_viewer()
@@ -34,6 +36,7 @@ def test_histogram_2D(make_napari_viewer, astronaut_data):
3436
# collected by the widget
3537
return deepcopy(fig)
3638

39+
3740
@pytest.mark.mpl_image_compare
3841
def test_histogram_3D(make_napari_viewer, brain_data):
3942
viewer = make_napari_viewer()

0 commit comments

Comments
 (0)