Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _fire_changed(self):
if self.when_changed:
self.when_changed()
def _fire_events(self, ticks, new_value):
super(ButtonBoard, self)._fire_events(ticks, new_value)
old_value, self._last_value = self._last_value, new_value
if old_value is None:
# Initial "indeterminate" value; don't do anything
pass
elif old_value != new_value:
self._fire_changed()
ButtonBoard.is_pressed = ButtonBoard.is_active
ButtonBoard.pressed_time = ButtonBoard.active_time
ButtonBoard.when_pressed = ButtonBoard.when_activated
ButtonBoard.when_released = ButtonBoard.when_deactivated
ButtonBoard.wait_for_press = ButtonBoard.wait_for_active
ButtonBoard.wait_for_release = ButtonBoard.wait_for_inactive
class LEDCollection(CompositeOutputDevice):
"""
Extends :class:`CompositeOutputDevice`. Abstract base class for
:class:`LEDBoard` and :class:`LEDBarGraph`.
"""
def __init__(self, *args, **kwargs):
pwm = kwargs.pop('pwm', False)
active_high = kwargs.pop('active_high', True)
initial_value = kwargs.pop('initial_value', False)
pin_factory = kwargs.pop('pin_factory', None)
order = kwargs.pop('_order', None)
def _fire_events(self, ticks, new_value):
super(ButtonBoard, self)._fire_events(ticks, new_value)
old_value, self._last_value = self._last_value, new_value
if old_value is None:
# Initial "indeterminate" value; don't do anything
pass
elif old_value != new_value:
self._fire_changed()
if self.when_changed:
self.when_changed()
def _fire_events(self, ticks, new_value):
super(ButtonBoard, self)._fire_events(ticks, new_value)
old_value, self._last_value = self._last_value, new_value
if old_value is None:
# Initial "indeterminate" value; don't do anything
pass
elif old_value != new_value:
self._fire_changed()
ButtonBoard.is_pressed = ButtonBoard.is_active
ButtonBoard.pressed_time = ButtonBoard.active_time
ButtonBoard.when_pressed = ButtonBoard.when_activated
ButtonBoard.when_released = ButtonBoard.when_deactivated
ButtonBoard.wait_for_press = ButtonBoard.wait_for_active
ButtonBoard.wait_for_release = ButtonBoard.wait_for_inactive
class LEDCollection(CompositeOutputDevice):
"""
Extends :class:`CompositeOutputDevice`. Abstract base class for
:class:`LEDBoard` and :class:`LEDBarGraph`.
"""
def __init__(self, *args, **kwargs):
pwm = kwargs.pop('pwm', False)
active_high = kwargs.pop('active_high', True)
initial_value = kwargs.pop('initial_value', False)
pin_factory = kwargs.pop('pin_factory', None)
order = kwargs.pop('_order', None)
LEDClass = PWMLED if pwm else LED
self._when_changed = self._wrap_callback(value)
def _fire_changed(self):
if self.when_changed:
self.when_changed()
def _fire_events(self, ticks, new_value):
super(ButtonBoard, self)._fire_events(ticks, new_value)
old_value, self._last_value = self._last_value, new_value
if old_value is None:
# Initial "indeterminate" value; don't do anything
pass
elif old_value != new_value:
self._fire_changed()
ButtonBoard.is_pressed = ButtonBoard.is_active
ButtonBoard.pressed_time = ButtonBoard.active_time
ButtonBoard.when_pressed = ButtonBoard.when_activated
ButtonBoard.when_released = ButtonBoard.when_deactivated
ButtonBoard.wait_for_press = ButtonBoard.wait_for_active
ButtonBoard.wait_for_release = ButtonBoard.wait_for_inactive
class LEDCollection(CompositeOutputDevice):
"""
Extends :class:`CompositeOutputDevice`. Abstract base class for
:class:`LEDBoard` and :class:`LEDBarGraph`.
"""
def __init__(self, *args, **kwargs):
pwm = kwargs.pop('pwm', False)
active_high = kwargs.pop('active_high', True)
initial_value = kwargs.pop('initial_value', False)
def _fire_changed(self):
if self.when_changed:
self.when_changed()
def _fire_events(self, ticks, new_value):
super(ButtonBoard, self)._fire_events(ticks, new_value)
old_value, self._last_value = self._last_value, new_value
if old_value is None:
# Initial "indeterminate" value; don't do anything
pass
elif old_value != new_value:
self._fire_changed()
ButtonBoard.is_pressed = ButtonBoard.is_active
ButtonBoard.pressed_time = ButtonBoard.active_time
ButtonBoard.when_pressed = ButtonBoard.when_activated
ButtonBoard.when_released = ButtonBoard.when_deactivated
ButtonBoard.wait_for_press = ButtonBoard.wait_for_active
ButtonBoard.wait_for_release = ButtonBoard.wait_for_inactive
class LEDCollection(CompositeOutputDevice):
"""
Extends :class:`CompositeOutputDevice`. Abstract base class for
:class:`LEDBoard` and :class:`LEDBarGraph`.
"""
def __init__(self, *args, **kwargs):
pwm = kwargs.pop('pwm', False)
active_high = kwargs.pop('active_high', True)
initial_value = kwargs.pop('initial_value', False)
pin_factory = kwargs.pop('pin_factory', None)
def _fire_events(self, ticks, new_value):
super(ButtonBoard, self)._fire_events(ticks, new_value)
old_value, self._last_value = self._last_value, new_value
if old_value is None:
# Initial "indeterminate" value; don't do anything
pass
elif old_value != new_value:
self._fire_changed()
ButtonBoard.is_pressed = ButtonBoard.is_active
ButtonBoard.pressed_time = ButtonBoard.active_time
ButtonBoard.when_pressed = ButtonBoard.when_activated
ButtonBoard.when_released = ButtonBoard.when_deactivated
ButtonBoard.wait_for_press = ButtonBoard.wait_for_active
ButtonBoard.wait_for_release = ButtonBoard.wait_for_inactive
class LEDCollection(CompositeOutputDevice):
"""
Extends :class:`CompositeOutputDevice`. Abstract base class for
:class:`LEDBoard` and :class:`LEDBarGraph`.
"""
def __init__(self, *args, **kwargs):
pwm = kwargs.pop('pwm', False)
active_high = kwargs.pop('active_high', True)
initial_value = kwargs.pop('initial_value', False)
pin_factory = kwargs.pop('pin_factory', None)
order = kwargs.pop('_order', None)
LEDClass = PWMLED if pwm else LED
super(LEDCollection, self).__init__(
*(
self.when_changed()
def _fire_events(self, ticks, new_value):
super(ButtonBoard, self)._fire_events(ticks, new_value)
old_value, self._last_value = self._last_value, new_value
if old_value is None:
# Initial "indeterminate" value; don't do anything
pass
elif old_value != new_value:
self._fire_changed()
ButtonBoard.is_pressed = ButtonBoard.is_active
ButtonBoard.pressed_time = ButtonBoard.active_time
ButtonBoard.when_pressed = ButtonBoard.when_activated
ButtonBoard.when_released = ButtonBoard.when_deactivated
ButtonBoard.wait_for_press = ButtonBoard.wait_for_active
ButtonBoard.wait_for_release = ButtonBoard.wait_for_inactive
class LEDCollection(CompositeOutputDevice):
"""
Extends :class:`CompositeOutputDevice`. Abstract base class for
:class:`LEDBoard` and :class:`LEDBarGraph`.
"""
def __init__(self, *args, **kwargs):
pwm = kwargs.pop('pwm', False)
active_high = kwargs.pop('active_high', True)
initial_value = kwargs.pop('initial_value', False)
pin_factory = kwargs.pop('pin_factory', None)
order = kwargs.pop('_order', None)
LEDClass = PWMLED if pwm else LED
super(LEDCollection, self).__init__(