Skip to content

Commit 7879309

Browse files
author
BiffoBear
committed
Removed re-raising errors, it's confusing
1 parent b66abb3 commit 7879309

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

adafruit_rgbled.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#
33
# SPDX-License-Identifier: MIT
44

5+
# pylint: disable=raise-missing-from
56
"""
67
`adafruit_rgbled`
78
================================================================================
@@ -106,12 +107,11 @@ def __init__(
106107
if pin_type.startswith("<class '") and pin_type.endswith("Pin'>"):
107108
self._rgb_led_pins[pin] = PWMOut(self._rgb_led_pins[pin])
108109
self._rgb_led_pins[pin].duty_cycle = 0
109-
except AttributeError as exc:
110-
raise TypeError(
111-
"Pins must be of type Pin, PWMOut or PWMChannel"
112-
) from exc
110+
except AttributeError:
111+
raise TypeError("Pins must be of type Pin, PWMOut or PWMChannel")
113112
self._invert_pwm = invert_pwm
114113
self._current_color = (0, 0, 0)
114+
self.color = self._current_color
115115

116116
def __enter__(self) -> "RGBLED":
117117
return self
@@ -144,17 +144,17 @@ def color(self, value: Union[int, tuple]):
144144
try:
145145
# Check that integer is <= 0xffffff and create an iterable.
146146
rgb = value.to_bytes(3, "big", signed=False)
147-
except OverflowError as exc:
148-
raise ValueError("Only bits 0->23 valid for integer input") from exc
147+
except OverflowError:
148+
raise ValueError("Only bits 0->23 valid for integer input")
149149
elif isinstance(value, tuple):
150150
try:
151151
rgb = bytes(value) # Check that tuple has integers of 0 - 255.
152152
if len(rgb) != 3:
153153
raise ValueError
154-
except (ValueError, TypeError) as exc:
154+
except (ValueError, TypeError):
155155
raise ValueError(
156156
"Only a tuple of 3 integers of 0 - 255 for tuple input."
157-
) from exc
157+
)
158158
else:
159159
raise TypeError(
160160
"Color must be a tuple of 3 integers or 24-bit integer value."

0 commit comments

Comments
 (0)