Skip to content

Commit 4e4fb84

Browse files
committed
Make linters happy
1 parent b8623ed commit 4e4fb84

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

src/napari_matplotlib/histogram.py

Lines changed: 17 additions & 7 deletions
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
@@ -124,16 +134,13 @@ def bins_num(self, num: int) -> None:
124134

125135
def autoset_widget_bins(self, data: npt.ArrayLike) -> None:
126136
"""Update widgets with bins determined from the image data"""
127-
128137
bins = np.linspace(np.min(data), np.max(data), 100, dtype=data.dtype)
129138
self.bins_start = bins[0]
130139
self.bins_stop = bins[-1]
131140
self.bins_num = bins.size
132141

133-
134142
def _get_layer_data(self, layer) -> np.ndarray:
135143
"""Get the data associated with a given layer"""
136-
137144
if layer.data.ndim - layer.rgb == 3:
138145
# 3D data, can be single channel or RGB
139146
data = layer.data[self.current_z]
@@ -150,7 +157,6 @@ def on_update_layers(self) -> None:
150157
"""
151158
Called when the layer selection changes by ``self._update_layers()``.
152159
"""
153-
154160
if not self.layers:
155161
return
156162

@@ -160,8 +166,12 @@ def on_update_layers(self) -> None:
160166

161167
# Only allow integer bins for integer data
162168
n_decimals = 0 if np.issubdtype(layer_data.dtype, np.integer) else 2
163-
self.findChild(QDoubleSpinBox, name="bins start").setDecimals(n_decimals)
164-
self.findChild(QDoubleSpinBox, name="bins stop").setDecimals(n_decimals)
169+
self.findChild(QDoubleSpinBox, name="bins start").setDecimals(
170+
n_decimals
171+
)
172+
self.findChild(QDoubleSpinBox, name="bins stop").setDecimals(
173+
n_decimals
174+
)
165175

166176
def draw(self) -> None:
167177
"""

src/napari_matplotlib/tests/test_histogram.py

Lines changed: 3 additions & 0 deletions
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)