@@ -104,7 +104,7 @@ def duty_cycle(self):
104
104
105
105
@duty_cycle .setter
106
106
def duty_cycle (self , val ):
107
- if ( val < 0 ) or ( val > 65535 ) :
107
+ if val < 0 or val > 65535 :
108
108
raise ValueError ("PWM intensity {0} outside supported range [0;65535]" .format (val ))
109
109
# Convert to 12-bit value (quantization error will occur!).
110
110
val = (val >> 4 ) & 0xFFF
@@ -130,7 +130,7 @@ def frequency(self, val):
130
130
131
131
def __init__ (self , spi , latch , * , auto_write = True , num_drivers = 1 ):
132
132
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 ))
134
134
self ._spi = spi
135
135
self ._latch = latch
136
136
self ._latch .switch_to_output (value = False )
@@ -168,9 +168,9 @@ def write(self):
168
168
def _get_gs_value (self , channel ):
169
169
# pylint: disable=no-else-return
170
170
# 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 :
172
172
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 ))
174
174
# Invert channel position as the last channel needs to be written first.
175
175
# I.e. is in the first position of the shift registr.
176
176
channel = _CHANNELS * self ._n - 1 - channel
@@ -195,10 +195,10 @@ def _get_gs_value(self, channel):
195
195
raise RuntimeError ('Unsupported bit offset!' )
196
196
197
197
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 :
199
199
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 :
202
202
raise ValueError ("PWM intensity {0} outside supported range [0;4095]" .format (val ))
203
203
204
204
# Invert channel position as the last channel needs to be written first.
0 commit comments