Skip to content

Commit 1e6dfbe

Browse files
authored
styling the library
1 parent 689bd4b commit 1e6dfbe

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

adafruit_tlc5947.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def duty_cycle(self):
104104

105105
@duty_cycle.setter
106106
def duty_cycle(self, val):
107-
if (val < 0) or (val > 65535):
107+
if val < 0 or val > 65535:
108108
raise ValueError("PWM intensity {0} outside supported range [0;65535]".format(val))
109109
# Convert to 12-bit value (quantization error will occur!).
110110
val = (val >> 4) & 0xFFF
@@ -130,7 +130,7 @@ def frequency(self, val):
130130

131131
def __init__(self, spi, latch, *, auto_write=True, num_drivers=1):
132132
if num_drivers < 1:
133-
raise ValueError("need at least one driver; {0} is not supported.".format(num_drivers))
133+
raise ValueError("Need at least one driver; {0} is not supported.".format(num_drivers))
134134
self._spi = spi
135135
self._latch = latch
136136
self._latch.switch_to_output(value=False)
@@ -168,9 +168,9 @@ def write(self):
168168
def _get_gs_value(self, channel):
169169
# pylint: disable=no-else-return
170170
# Disable should be removed when refactor can be tested
171-
if (channel < 0) or (channel >= _CHANNELS * self._n):
171+
if channel < 0 or channel >= _CHANNELS * self._n:
172172
raise ValueError(
173-
"channel {0} not available with {1} board(s).".format(channel, self._n))
173+
"Channel {0} not available with {1} board(s).".format(channel, self._n))
174174
# Invert channel position as the last channel needs to be written first.
175175
# I.e. is in the first position of the shift registr.
176176
channel = _CHANNELS * self._n - 1 - channel
@@ -195,10 +195,10 @@ def _get_gs_value(self, channel):
195195
raise RuntimeError('Unsupported bit offset!')
196196

197197
def _set_gs_value(self, channel, val):
198-
if (channel < 0) or (channel >= _CHANNELS * self._n):
198+
if channel < 0 or channel >= _CHANNELS * self._n:
199199
raise ValueError(
200-
"channel {0} not available with {1} board(s).".format(channel, self._n))
201-
if (val < 0) or (val > 4095):
200+
"Channel {0} not available with {1} board(s).".format(channel, self._n))
201+
if val < 0 or val > 4095:
202202
raise ValueError("PWM intensity {0} outside supported range [0;4095]".format(val))
203203

204204
# Invert channel position as the last channel needs to be written first.

0 commit comments

Comments
 (0)