LINT fixes for LCD plugins
This commit is contained in:
parent
40269ddaad
commit
5d2e74eb97
3 changed files with 6 additions and 18 deletions
|
@ -1,16 +1,9 @@
|
|||
from abc import ABC, abstractmethod
|
||||
from enum import Enum
|
||||
from typing import List, Optional
|
||||
|
||||
from platypush.plugins import Plugin, action
|
||||
|
||||
|
||||
class PinMode(Enum):
|
||||
import RPi.GPIO
|
||||
BOARD = RPi.GPIO.BOARD
|
||||
BCM = RPi.GPIO.BCM
|
||||
|
||||
|
||||
class LcdPlugin(Plugin, ABC):
|
||||
"""
|
||||
Abstract class for plugins to communicate with LCD displays.
|
||||
|
@ -21,23 +14,20 @@ class LcdPlugin(Plugin, ABC):
|
|||
* **RPi.GPIO** (``pip install RPi.GPIO``)
|
||||
|
||||
"""
|
||||
import RPLCD.lcd
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.lcd = None
|
||||
|
||||
@staticmethod
|
||||
def _get_pin_mode(pin_mode: str) -> int:
|
||||
import RPi.GPIO
|
||||
pin_modes = ['BOARD', 'BCM']
|
||||
pin_mode = pin_mode.upper()
|
||||
assert hasattr(PinMode, pin_mode), \
|
||||
'Invalid pin_mode: {}. Supported modes: {}'.format(
|
||||
pin_mode, list([mode.name for mode in PinMode if mode.name != 'RPi']))
|
||||
|
||||
return getattr(PinMode, pin_mode).value
|
||||
assert pin_mode in pin_modes, 'Invalid pin_mode: {}. Supported modes: {}'.format(pin_mode, pin_modes)
|
||||
return getattr(RPi.GPIO, pin_mode).value
|
||||
|
||||
@abstractmethod
|
||||
def _get_lcd(self) -> RPLCD.lcd.BaseCharLCD:
|
||||
def _get_lcd(self):
|
||||
pass
|
||||
|
||||
def _init_lcd(self):
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from typing import List, Optional
|
||||
|
||||
from platypush.plugins import action
|
||||
from platypush.plugins.lcd import LcdPlugin
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
|
||||
from platypush.plugins import action
|
||||
from platypush.plugins.lcd import LcdPlugin
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue