Skip to content

Commit 426a0f5

Browse files
committed
use '| None' rather than Optional[Union[...]] for type hints
1 parent 457bc1b commit 426a0f5

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, Union, cast
1+
from typing import Any, cast
22

33
import napari
44
import numpy as np
@@ -30,8 +30,8 @@
3030
def _get_bins(
3131
data: npt.NDArray[Any],
3232
num_bins: int = 100,
33-
start: Optional[Union[int, float]] = None,
34-
stop: Optional[Union[int, float]] = None,
33+
start: int | float | None = None,
34+
stop: int | float | None = None,
3535
) -> npt.NDArray[Any]:
3636
"""Create evenly spaced bins with a given interval.
3737
@@ -195,7 +195,7 @@ def bins_start(self) -> float:
195195
return self._bin_widgets["start"].value()
196196

197197
@bins_start.setter
198-
def bins_start(self, start: Union[int, float]) -> None:
198+
def bins_start(self, start: int | float) -> None:
199199
"""Set the minimum bin edge"""
200200
self._bin_widgets["start"].setValue(start)
201201

@@ -205,7 +205,7 @@ def bins_stop(self) -> float:
205205
return self._bin_widgets["stop"].value()
206206

207207
@bins_stop.setter
208-
def bins_stop(self, stop: Union[int, float]) -> None:
208+
def bins_stop(self, stop: int | float) -> None:
209209
"""Set the maximum bin edge"""
210210
self._bin_widgets["stop"].setValue(stop)
211211

0 commit comments

Comments
 (0)