diff --git a/kmk/scanners/keypad.py b/kmk/scanners/keypad.py index cc7c29742..ee3b9fd3e 100644 --- a/kmk/scanners/keypad.py +++ b/kmk/scanners/keypad.py @@ -4,23 +4,23 @@ class KeypadScanner(Scanner): - ''' + """ Translation layer around a CircuitPython 7 keypad scanner. :param pin_map: A sequence of (row, column) tuples for each key. :param kp: An instance of the keypad class. - ''' + """ @property def key_count(self): return self.keypad.key_count def scan_for_changes(self): - ''' + """ Scan for key events and return a key report if an event exists. The key report is a byte array with contents [row, col, True if pressed else False] - ''' + """ ev = self.keypad.events.get() if ev and self.offset: return keypad.Event(ev.key_number + self.offset, ev.pressed) @@ -28,13 +28,13 @@ def scan_for_changes(self): class MatrixScanner(KeypadScanner): - ''' + """ Row/Column matrix using the CircuitPython 7 keypad scanner. :param row_pins: A sequence of pins used for rows. :param col_pins: A sequence of pins used for columns. :param direction: The diode orientation of the matrix. - ''' + """ def __init__( self, @@ -49,16 +49,16 @@ def __init__( args = [ row_pins, column_pins, - ] + ] for i in args: if i is None: args.pop(i) kwargs = { - 'columns_to_anodes': columns_to_anodes, - 'interval': interval, - 'debounce_threshold': debounce_threshold, - 'max_events': max_events, - } + "columns_to_anodes": columns_to_anodes, + "interval": interval, + "debounce_threshold": debounce_threshold, + "max_events": max_events, + } for key, value in kwargs.items(): if value is None: kwargs.pop(key) @@ -67,11 +67,11 @@ def __init__( class KeysScanner(KeypadScanner): - ''' + """ GPIO-per-key 'matrix' using the native CircuitPython 7 keypad scanner. :param pins: An array of arrays of CircuitPython Pin objects, such that pins[r][c] is the pin for row r, column c. - ''' + """ def __init__( self, @@ -85,17 +85,17 @@ def __init__( ): args = [ pins, - ] + ] for i in args: if i is None: args.pop(i) kwargs = { - 'value_when_pressed': value_when_pressed, - 'pull': pull, - 'interval': interval, - 'debounce_threshold': debounce_threshold, - 'max_events': max_events, - } + "value_when_pressed": value_when_pressed, + "pull": pull, + "interval": interval, + "debounce_threshold": debounce_threshold, + "max_events": max_events, + } for key, value in kwargs.items(): if value is None: kwargs.pop(key) @@ -122,17 +122,17 @@ def __init__( data, latch, key_count, - ] + ] for i in args: if i is None: args.pop(i) kwargs = { - 'value_to_latch': value_to_latch, - 'value_when_pressed': value_when_pressed, - 'interval': interval, - 'debounce_threshold': debounce_threshold, - 'max_events': max_events, - } + "value_to_latch": value_to_latch, + "value_when_pressed": value_when_pressed, + "interval": interval, + "debounce_threshold": debounce_threshold, + "max_events": max_events, + } for key, value in kwargs.items(): if value is None: kwargs.pop(key)