Skip to content

Commit 5ac1f71

Browse files
committed
Fix type hints
1 parent 4e4fb84 commit 5ac1f71

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/napari_matplotlib/histogram.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Optional, cast
1+
from typing import Any, Optional, Union, cast
22

33
import napari
44
import numpy as np
@@ -108,7 +108,7 @@ def bins_start(self) -> float:
108108
return self.findChild(QDoubleSpinBox, name="bins start").value()
109109

110110
@bins_start.setter
111-
def bins_start(self, start: int | float) -> None:
111+
def bins_start(self, start: Union[int, float]) -> None:
112112
"""Set the minimum bin edge"""
113113
self.findChild(QDoubleSpinBox, name="bins start").setValue(start)
114114

@@ -118,7 +118,7 @@ def bins_stop(self) -> float:
118118
return self.findChild(QDoubleSpinBox, name="bins stop").value()
119119

120120
@bins_stop.setter
121-
def bins_stop(self, stop: int | float) -> None:
121+
def bins_stop(self, stop: Union[int, float]) -> None:
122122
"""Set the maximum bin edge"""
123123
self.findChild(QDoubleSpinBox, name="bins stop").setValue(stop)
124124

@@ -132,14 +132,14 @@ def bins_num(self, num: int) -> None:
132132
"""Set the number of bins to use"""
133133
self.findChild(QSpinBox, name="bins num").setValue(num)
134134

135-
def autoset_widget_bins(self, data: npt.ArrayLike) -> None:
135+
def autoset_widget_bins(self, data: npt.NDArray[Any]) -> None:
136136
"""Update widgets with bins determined from the image data"""
137137
bins = np.linspace(np.min(data), np.max(data), 100, dtype=data.dtype)
138138
self.bins_start = bins[0]
139139
self.bins_stop = bins[-1]
140140
self.bins_num = bins.size
141141

142-
def _get_layer_data(self, layer) -> np.ndarray:
142+
def _get_layer_data(self, layer: napari.layers.Layer) -> npt.NDArray[Any]:
143143
"""Get the data associated with a given layer"""
144144
if layer.data.ndim - layer.rgb == 3:
145145
# 3D data, can be single channel or RGB

0 commit comments

Comments
 (0)