Skip to content

Commit e3a4dc7

Browse files
committed
pylint...
1 parent dc539da commit e3a4dc7

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

examples/mcp23017_scanner_keys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
PINS = [0, 1, 2, 3, 4, 10, 11, 12, 13, 14]
1212

1313
mcp = MCP23017(board.I2C())
14-
scanner = McpKeysScanner(mcp, PINS) # , irq=board.D5)
14+
scanner = McpKeysScanner(mcp, PINS) # , irq=board.D5)
1515

1616
while True:
1717
t0 = ticks_ms()

mcp23017_scanner.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,16 @@ def __len__(self) -> int:
137137

138138

139139
class McpScanner:
140+
"""
141+
Base class for MCP scanners.
142+
"""
140143

141-
def __init__(self,
144+
def __init__(
145+
self,
142146
mcp: any,
143147
irq: Optional[Pin] = None,
144148
):
149+
self._key_count = 0
145150
self.mcp = mcp
146151
self.keys_state = set()
147152
self.events = EventQueue()
@@ -155,6 +160,9 @@ def key_count(self) -> int:
155160
"""The number of keys in the scanner."""
156161
return self._key_count
157162

163+
def _scan_pins(self) -> Set[int]: # pylint:disable=no-self-use
164+
return Set()
165+
158166
def update(self) -> None:
159167
"""
160168
Run the scan and create events in the event queue.
@@ -297,8 +305,7 @@ def _scan_pins(self) -> Set[int]:
297305
"""Scan the buttons and return the list of keys down"""
298306
pressed = set()
299307
inputs = self.mcp.gpio & self.pin_bits
300-
for scan in self.pins:
301-
for pin in self.pins:
302-
if inputs & (1 << pin) == 0:
303-
pressed.add(pin)
308+
for pin in self.pins:
309+
if inputs & (1 << pin) == 0:
310+
pressed.add(pin)
304311
return pressed

0 commit comments

Comments
 (0)