From c3380698331d6162a871a8acd257e6bb9246e579 Mon Sep 17 00:00:00 2001 From: Nicolai Buchwitz Date: Thu, 5 Feb 2026 08:57:00 +0100 Subject: [PATCH] docs: enforce 100 character line width in docstrings Reformatted docstrings across device.py, helper.py, and io.py to honor the 100 character line width limit, improving readability and consistency with project formatting standards. --- src/revpimodio2/device.py | 23 ++++++++++++++++------- src/revpimodio2/helper.py | 22 ++++++++++++++++------ src/revpimodio2/io.py | 6 ++++-- 3 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/revpimodio2/device.py b/src/revpimodio2/device.py index d2b0697..c374994 100644 --- a/src/revpimodio2/device.py +++ b/src/revpimodio2/device.py @@ -1053,10 +1053,14 @@ class Connect(Core): """ Sets the automatic watchdog toggle. - If this value is set to True, the necessary bit to toggle the watchdog is switched between True and False every 10 seconds in the background. - This bit is automatically written to the process image with autorefresh=True. + If this value is set to True, the necessary bit to toggle the + watchdog is switched between True and False every 10 seconds in + the background. + This bit is automatically written to the process image with + autorefresh=True. - IMPORTANT: If autorefresh=False, .writeprocimg() must be called cyclically to write the value to the process image!!! + IMPORTANT: If autorefresh=False, .writeprocimg() must be called + cyclically to write the value to the process image!!! :param value: True to activate, False to terminate """ @@ -2046,9 +2050,11 @@ class Gateway(Device): """ Class for the RevPi Gateway-Devices. - Provides additional functions for the RevPi Gateway devices besides the functions from RevPiDevice. - Gateways are ready. IOs on this device provide the replace_io function, - which allows defining custom IOs that map to a RevPiStructIO object. + Provides additional functions for the RevPi Gateway devices besides + the functions from RevPiDevice. + Gateways are ready. IOs on this device provide the replace_io + function, which allows defining custom IOs that map to a + RevPiStructIO object. This IO type can process and return values via multiple bytes. :ref: :func:`revpimodio2.io.IntIOReplaceable.replace_io()` @@ -2096,7 +2102,10 @@ class Virtual(Gateway): """ Writes piCtory default input values for a virtual device. - If default values for inputs of a virtual device are specified in piCtory, these are only set at system startup or a piControl reset. If the process image is subsequently overwritten with NULL, these values will be lost. + If default values for inputs of a virtual device are specified + in piCtory, these are only set at system startup or a piControl + reset. If the process image is subsequently overwritten with NULL, + these values will be lost. This function can only be applied to virtual devices! :return: True if operations on the virtual device were successful diff --git a/src/revpimodio2/helper.py b/src/revpimodio2/helper.py index 676b9ad..53157ca 100644 --- a/src/revpimodio2/helper.py +++ b/src/revpimodio2/helper.py @@ -18,12 +18,20 @@ from .io import IOBase class EventCallback(Thread): """Thread for internal calling of event functions. - The event function that this thread calls will receive the thread itself as a parameter. This must be considered when defining the function, e.g., "def event(th):". For extensive functions, this can be evaluated to prevent duplicate starts. + The event function that this thread calls will receive the thread itself + as a parameter. This must be considered when defining the function, e.g., + "def event(th):". For extensive functions, this can be evaluated to + prevent duplicate starts. The name of the IO object can be retrieved via EventCallback.ioname, - which triggered the event. EventCallback.iovalue returns the value of the IO object at the time of triggering. - The thread provides the EventCallback.exit event as an abort condition for the called function. - By calling the EventCallback.stop() function, the exit event is set and can be used to abort loops. - A wait function can also be implemented with the .exit() event: "th.exit.wait(0.5)" - waits 500ms or aborts immediately if .stop() is called on the thread. + which triggered the event. EventCallback.iovalue returns the value of + the IO object at the time of triggering. + The thread provides the EventCallback.exit event as an abort condition + for the called function. + By calling the EventCallback.stop() function, the exit event is set + and can be used to abort loops. + A wait function can also be implemented with the .exit() event: + "th.exit.wait(0.5)" - waits 500ms or aborts immediately if .stop() + is called on the thread. while not th.exit.is_set(): # IO-Arbeiten @@ -363,7 +371,9 @@ class ProcimgWriter(Thread): """ Class for synchronization thread. - This class is started as a thread if the process image should be synchronized cyclically. This function is mainly used for event handling. + This class is started as a thread if the process image should be + synchronized cyclically. This function is mainly used for event + handling. """ __slots__ = ( diff --git a/src/revpimodio2/io.py b/src/revpimodio2/io.py index 375c8f2..130e9f6 100644 --- a/src/revpimodio2/io.py +++ b/src/revpimodio2/io.py @@ -1465,8 +1465,10 @@ class StructIO(IOBase): Handles byte and word order conversion based on configuration. - :param value: If None, returns current value unpacked using struct format; otherwise packs and sets the value - :return: Current IO value unpacked according to struct format when called without arguments + :param value: If None, returns current value unpacked using struct + format; otherwise packs and sets the value + :return: Current IO value unpacked according to struct format when + called without arguments """ if value is None: # Inline get_structdefaultvalue()