diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index dc2babe..c77a243 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -38,7 +38,7 @@ jobs: - name: Set up python id: setup-python - uses: actions/setup-python@v4.4.0 + uses: actions/setup-python@v4.6.0 with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.architecture }} diff --git a/uoshardware/abstractions.py b/uoshardware/abstractions.py index 965907d..a7d6a7c 100644 --- a/uoshardware/abstractions.py +++ b/uoshardware/abstractions.py @@ -184,8 +184,10 @@ def execute_instruction(self, packet: NPCPacket) -> ComResult: # dead: disable :param packet: A tuple containing the uint8 npc packet for the UOS instruction. :returns: ComResult object. - :raises: UOSUnsupportedError if the interface hasn't been built correctly. - :raises: UOSCommunicationError if there is a problem completing the action. + :raises: UOSUnsupportedError if the interface hasn't been built + correctly. + :raises: UOSCommunicationError if there is a problem completing + the action. """ raise UOSUnsupportedError( f"UOSInterfaces must over-ride {UOSInterface.execute_instruction.__name__} prototype." @@ -200,8 +202,10 @@ def read_response( :param expect_packets: How many packets including ACK to expect :param timeout_s: The maximum time this function will wait for data. :return: COM Result object. - :raises: UOSUnsupportedError if the interface hasn't been built correctly. - :raises: UOSCommunicationError if there is a problem completing the action. + :raises: UOSUnsupportedError if the interface hasn't been built + correctly. + :raises: UOSCommunicationError if there is a problem completing + the action. """ raise UOSUnsupportedError( f"UOSInterfaces must over-ride {UOSInterface.read_response.__name__} prototype." @@ -212,8 +216,10 @@ def hard_reset(self) -> ComResult: """UOS loop reset functionality should be as hard a reset as possible. :return: COM Result object. - :raises: UOSUnsupportedError if the interface hasn't been built correctly. - :raises: UOSCommunicationError if there is a problem completing the action. + :raises: UOSUnsupportedError if the interface hasn't been built + correctly. + :raises: UOSCommunicationError if there is a problem completing + the action. """ raise UOSUnsupportedError( f"UOSInterfaces must over-ride {UOSInterface.hard_reset.__name__} prototype" @@ -223,8 +229,10 @@ def hard_reset(self) -> ComResult: def open(self): """Abstract method for opening a connection to a UOSInterface. - :raises: UOSUnsupportedError if the interface hasn't been built correctly. - :raises: UOSCommunicationError if there is a problem completing the action. + :raises: UOSUnsupportedError if the interface hasn't been built + correctly. + :raises: UOSCommunicationError if there is a problem completing + the action. """ raise UOSUnsupportedError( f"UOSInterfaces must over-ride {UOSInterface.open.__name__} prototype." @@ -234,8 +242,10 @@ def open(self): def close(self): """Abstract method for closing a connection to a UOSInterface. - :raises: UOSUnsupportedError if the interface hasn't been built correctly. - :raises: UOSCommunicationError if there is a problem completing the action. + :raises: UOSUnsupportedError if the interface hasn't been built + correctly. + :raises: UOSCommunicationError if there is a problem completing + the action. """ raise UOSUnsupportedError( f"UOSInterfaces must over-ride {UOSInterface.close.__name__} prototype." @@ -246,7 +256,8 @@ def is_active(self) -> bool: """Abstract method for checking if a connection is being held active. :return: Success boolean. - :raises: UOSUnsupportedError if the interface hasn't been built correctly. + :raises: UOSUnsupportedError if the interface hasn't been built + correctly. """ raise UOSUnsupportedError( f"UOSInterfaces must over-ride {UOSInterface.close.__name__} prototype." @@ -258,7 +269,8 @@ def enumerate_devices() -> list: """Return a list of UOSDevices visible to the driver. :return: A list of possible UOSInterfaces on the server. - :raises: UOSUnsupportedError if the interface hasn't been built correctly. + :raises: UOSUnsupportedError if the interface hasn't been built + correctly. """ raise UOSUnsupportedError( f"UOSInterfaces must over-ride {UOSInterface.enumerate_devices.__name__} prototype." diff --git a/uoshardware/api.py b/uoshardware/api.py index c36373e..45f148d 100644 --- a/uoshardware/api.py +++ b/uoshardware/api.py @@ -58,7 +58,8 @@ class UOSDevice: # dead: disable """Class for high level object-orientated control of UOS devices. :ivar identity: The type of device, this is must have a valid device in the config. - :ivar address: Compliant connection string for identifying the device and interface. + :ivar address: Compliant connection string for identifying the + device and interface. """ __device: Device # Device definitions as parsed from a compatible ini. @@ -158,9 +159,11 @@ def get_gpio_input( ) -> ComResult: """Read a GPIO pins level from device and returns the value. - :param pin: The numeric number of the pin as defined in the dictionary for that device. + :param pin: The numeric number of the pin as defined in the + dictionary for that device. :param pull_up: Enable the internal pull-up resistor. Default is false. - :param volatility: How volatile should the command be, use constants from uoshardware. + :param volatility: How volatile should the command be, use + constants from uoshardware. :return: ComResult object. """ result = self.__execute_instruction( @@ -210,7 +213,8 @@ def get_system_info(self) -> ComResult: def reset_all_io(self, volatility=Persistence.RAM) -> ComResult: """Execute the reset IO at the defined volatility level. - :param volatility: Where should the pins reset from, use constants from uoshardware. + :param volatility: Where should the pins reset from, use + constants from uoshardware. :return: ComResult object containing the result of the reset operation.. """ return self.__execute_instruction( @@ -251,7 +255,8 @@ def __execute_instruction( :param instruction_data: device_functions from the LUT, payload ect. :param retry: Allows the instruction to retry execution when fails. :return: ComResult object - :raises: UOSUnsupportedError if function is not possible on the loaded device. + :raises: UOSUnsupportedError if function is not possible on the + loaded device. """ if ( function.name not in self.__device.functions_enabled diff --git a/uoshardware/interface/serial.py b/uoshardware/interface/serial.py index 52d669b..10f5f0e 100644 --- a/uoshardware/interface/serial.py +++ b/uoshardware/interface/serial.py @@ -17,7 +17,8 @@ class Serial(UOSInterface): """Pyserial class that handles reading / writing to ports. :ivar _device: Holds the pyserial device once opened. None if not opened. - :ivar _connection: Holds the standard connection string 'Interface'|'OS Connection String. + :ivar _connection: Holds the standard connection string + 'Interface'|'OS Connection String. :ivar _port: Holds the port class, none type if device not instantiated. :ivar _kwargs: Additional keyword arguments as defined in the documentation. """ @@ -100,7 +101,8 @@ def execute_instruction(self, packet: NPCPacket): """Build and execute a new instruction packet. :param packet: A tuple containing the uint8 npc packet for the UOS instruction. - :return: Tuple containing a status boolean and index 0 and a result-set dict at index 1. + :return: Tuple containing a status boolean and index 0 and a + result-set dict at index 1. """ if self._device is None: raise UOSCommunicationError( @@ -171,7 +173,8 @@ def read_response(self, expect_packets: int, timeout_s: float): def hard_reset(self): """Manually drive the DTR line low to reset the device. - :return: Tuple containing a status boolean and index 0 and a result-set dict at index 1. + :return: Tuple containing a status boolean and index 0 and a + result-set dict at index 1. """ if self._device is None: raise UOSCommunicationError("Connection must be open to hard reset device.")