fix various bugs found by the 'prospector' static-analysis tool

This commit is contained in:
Andrew Scheller
2016-04-07 16:12:17 +01:00
parent 4f7e1f003e
commit 72ca075668
13 changed files with 33 additions and 34 deletions

View File

@@ -7,8 +7,6 @@ from __future__ import (
str = type('')
from threading import Lock
import RPIO
import RPIO.PWM
from RPIO.Exceptions import InvalidChannelException
@@ -21,6 +19,8 @@ from ..exc import (
PinFixedPull,
PinInvalidPull,
PinInvalidBounce,
PinInvalidState,
PinPWMError,
)
@@ -126,7 +126,7 @@ class RPIOPin(Pin):
def _set_state(self, value):
if not 0 <= value <= 1:
raise PinInvalidValue('invalid state "%s" for pin %r' % (value, self))
raise PinInvalidState('invalid state "%s" for pin %r' % (value, self))
if self._pwm:
RPIO.PWM.clear_channel_gpio(0, self._number)
if value == 0: