Skip to content

Commit

Permalink
fix bugbear exception chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
marscher committed Dec 13, 2023
1 parent cbf0ffb commit db9b96c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions weldx_widgets/visualization/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _color_int_to_rgb(integer: int) -> Tuple[int, int, int]:


def _color_rgb_to_rgb_normalized(
rgb: Tuple[int, int, int]
rgb: Tuple[int, int, int],
) -> Tuple[float, float, float]:
"""Normalize an RGB color tuple with the range (0-255) to the range (0.0-1.0).
Expand All @@ -69,7 +69,7 @@ def _color_rgb_to_rgb_normalized(


def _color_rgb_normalized_to_rgb(
rgb: Tuple[float, float, float]
rgb: Tuple[float, float, float],
) -> Tuple[int, int, int]:
"""Normalize an RGB color tuple with the range (0.0-1.0) to the range (0-255).
Expand Down Expand Up @@ -143,7 +143,7 @@ def _shuffled_tab20_colors() -> List[int]:


def color_to_rgb_normalized(
color: Union[int, Tuple[int, int, int], Tuple[float, float, float]]
color: Union[int, Tuple[int, int, int], Tuple[float, float, float]],
) -> Tuple[float, float, float]:
"""Convert an arbitrary RGB color representation into a normalized RGB triplet.
Expand Down Expand Up @@ -228,5 +228,5 @@ def get_color(
return _color_rgb_to_int(value)
try:
return next(color_generator)
except StopIteration:
raise RuntimeError(f"given generator {color_generator} exhausted.")
except StopIteration as si:
raise RuntimeError(f"given generator {color_generator} exhausted.") from si

0 comments on commit db9b96c

Please sign in to comment.