Skip to content

Commit 6bb2747

Browse files
committed
Fix type hints
1 parent 1502a60 commit 6bb2747

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: src/napari_matplotlib/histogram.py

+5-5
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
@@ -91,7 +91,7 @@ def bins_start(self) -> float:
9191
return self.findChild(QDoubleSpinBox, name="bins start").value()
9292

9393
@bins_start.setter
94-
def bins_start(self, start: int | float) -> None:
94+
def bins_start(self, start: Union[int, float]) -> None:
9595
"""Set the minimum bin edge"""
9696
self.findChild(QDoubleSpinBox, name="bins start").setValue(start)
9797

@@ -101,7 +101,7 @@ def bins_stop(self) -> float:
101101
return self.findChild(QDoubleSpinBox, name="bins stop").value()
102102

103103
@bins_stop.setter
104-
def bins_stop(self, stop: int | float) -> None:
104+
def bins_stop(self, stop: Union[int, float]) -> None:
105105
"""Set the maximum bin edge"""
106106
self.findChild(QDoubleSpinBox, name="bins stop").setValue(stop)
107107

@@ -115,14 +115,14 @@ def bins_num(self, num: int) -> None:
115115
"""Set the number of bins to use"""
116116
self.findChild(QSpinBox, name="bins num").setValue(num)
117117

118-
def autoset_widget_bins(self, data: npt.ArrayLike) -> None:
118+
def autoset_widget_bins(self, data: npt.NDArray[Any]) -> None:
119119
"""Update widgets with bins determined from the image data"""
120120
bins = np.linspace(np.min(data), np.max(data), 100, dtype=data.dtype)
121121
self.bins_start = bins[0]
122122
self.bins_stop = bins[-1]
123123
self.bins_num = bins.size
124124

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

0 commit comments

Comments
 (0)