From fdae772869120ae3addd240eb009a174236c7240 Mon Sep 17 00:00:00 2001 From: John Woolsey <3237461+woolseyj@users.noreply.github.com> Date: Thu, 10 Jun 2021 00:18:31 -0400 Subject: [PATCH] Updated comments and error messages. --- wws_74hc165.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/wws_74hc165.py b/wws_74hc165.py index d9a4d2c..6f9a4f5 100644 --- a/wws_74hc165.py +++ b/wws_74hc165.py @@ -40,10 +40,10 @@ class DigitalInOut: - """Digital input/output of the 74HC165. The interface is exactly the - same as the ``digitalio.DigitalInOut`` class, however note that by design - this device is INPUT ONLY! Attempting to write outputs or set - direction as output will raise an exception. + """Digital input/output of the 74HC165. The interface is exactly the same + as the ``digitalio.DigitalInOut`` class, however note that by design this + device is INPUT ONLY! Attempting to write outputs or set direction as + output will raise an exception. """ def __init__(self, pin_number, shift_register_74hc165): @@ -62,7 +62,7 @@ def __init__(self, pin_number, shift_register_74hc165): # pylint: disable=unused-argument def switch_to_output(self, value=False, **kwargs): # pylint: disable=no-self-use """``switch_to_output`` is not supported.""" - raise RuntimeError("Digital output not supported.") + raise RuntimeError("Digital output is not supported.") def switch_to_input(self, **kwargs): """``DigitalInOut switch_to_input``""" @@ -80,7 +80,7 @@ def value(self): @value.setter def value(self, val): # pylint: disable=no-self-use """``value`` setting is not supported.""" - raise RuntimeError("Setting value not supported.") + raise RuntimeError("Setting value is not supported.") @property def direction(self): @@ -91,23 +91,23 @@ def direction(self): def direction(self, val): # pylint: disable=no-self-use """``Direction`` can only be set to ``INPUT``.""" if val != digitalio.Direction.INPUT: - raise RuntimeError("Digital output not supported.") + raise RuntimeError("Digital output is not supported.") @property def pull(self): - """Pull-up/down not supported, return None for no pull-up/down.""" + """Pull-up/down is not supported, return None for no pull-up/down.""" return None @pull.setter def pull(self, val): # pylint: disable=no-self-use """Only supports null/no pull state.""" if val is not None: - raise RuntimeError("Pull-up and pull-down not supported.") + raise RuntimeError("Pull-up and pull-down is not supported.") class ShiftRegister74HC165: - """Initialize the 74HC165 on the specified SPI bus - and indicate the number of shift registers being used. + """Initialize the 74HC165 on the specified SPI bus and indicate the number + of shift registers being used. """ def __init__(self, spi, latch, number_of_shift_registers=1): @@ -124,10 +124,11 @@ def number_of_shift_registers(self): @property def gpio(self): - """The raw GPIO input register. Each bit represents the - input value of the associated pin (0 = low, 1 = high). + """The raw GPIO input register. Each bit represents the input value of + the associated pin (0 = low, 1 = high). """ - # Manage latch (chip select) separately since it's values needs to be set in reverse + # Manage latch (chip select) separately since it's values needs to be + # set in reverse. self._latch.value = True with self._device as spi: # pylint: disable=no-member @@ -138,7 +139,7 @@ def gpio(self): @gpio.setter def gpio(self, val): # pylint: disable=no-self-use """``gpio`` setting is not supported.""" - raise RuntimeError("Setting gpio not supported.") + raise RuntimeError("Setting gpio is not supported.") def get_pin(self, pin): """Convenience function to create an instance of the DigitalInOut class