Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd589d5f

Browse files
committed
Fix type hints
1 parentee5c1e0 commitd589d5f

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-
fromtypingimportAny,Optional,cast
1+
fromtypingimportAny,Optional,Union,cast
22

33
importnapari
44
importnumpyasnp
@@ -91,7 +91,7 @@ def bins_start(self) -> float:
9191
returnself.findChild(QDoubleSpinBox,name="bins start").value()
9292

9393
@bins_start.setter
94-
defbins_start(self,start:int|float)->None:
94+
defbins_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
returnself.findChild(QDoubleSpinBox,name="bins stop").value()
102102

103103
@bins_stop.setter
104-
defbins_stop(self,stop:int|float)->None:
104+
defbins_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-
defautoset_widget_bins(self,data:npt.ArrayLike)->None:
118+
defautoset_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
iflayer.data.ndim-layer.rgb==3:
128128
# 3D data, can be single channel or RGB

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp