diff --git a/src/epomakercontroller/cli.py b/src/epomakercontroller/cli.py index 04e698d..e8ed064 100644 --- a/src/epomakercontroller/cli.py +++ b/src/epomakercontroller/cli.py @@ -19,9 +19,7 @@ def wrapped_command(func): - """ - Simple wrapper around command call. Propagates function name and docstring to click - """ + """Simple wrapper around command call. Propagates function name and docstring to click""" @wraps(func) def wrapper(*args, **kwargs): with EpomakerController(CONFIG_MAIN) as controller: @@ -62,8 +60,7 @@ def upload_image(controller: EpomakerController, image_path: str) -> None: @cli.command() @wrapped_command def clear_screen(controller: EpomakerController) -> None: - """ - Clear the screen. + """Clear the screen. Please note, that you cannot revert this action! """ controller.clear_image() diff --git a/src/epomakercontroller/commands/EpomakerClearScreenCommand.py b/src/epomakercontroller/commands/EpomakerClearScreenCommand.py index 8883e56..9df1781 100644 --- a/src/epomakercontroller/commands/EpomakerClearScreenCommand.py +++ b/src/epomakercontroller/commands/EpomakerClearScreenCommand.py @@ -3,14 +3,10 @@ class EpomakerClearScreenCommand(EpomakerCommand): - """ - Clear screen command. Resets the image, does not affect telemetry information on the screen - """ + """Clear screen command. Resets the image, does not affect telemetry information on the screen""" def __init__(self) -> None: - """ - Initialize URB data with 0xAC command to clear the screen. - """ + """Initialize URB data with 0xAC command to clear the screen.""" header = 0xAC footer = 0xFF - header diff --git a/src/epomakercontroller/commands/EpomakerCommand.py b/src/epomakercontroller/commands/EpomakerCommand.py index 6523e5b..af9001d 100644 --- a/src/epomakercontroller/commands/EpomakerCommand.py +++ b/src/epomakercontroller/commands/EpomakerCommand.py @@ -44,9 +44,7 @@ def __len__(self) -> int: class IEpomakerCommand(metaclass=ABCMeta): - """ - TODO: Write docstring for interface - """ + """TODO: Write docstring for interface""" def __init__(self): self.report_data_prepared: bool = False @@ -148,9 +146,7 @@ def iter_report_bytes(self) -> Iterator[bytes]: class EpomakerStreamedCommand(IEpomakerCommand): - """ - Epomaker command, that streams command without data preparing. - """ + """Epomaker command, that streams command without data preparing.""" def __init__( self, diff --git a/src/epomakercontroller/commands/EpomakerPollCommand.py b/src/epomakercontroller/commands/EpomakerPollCommand.py index 9fb504e..2422ee0 100644 --- a/src/epomakercontroller/commands/EpomakerPollCommand.py +++ b/src/epomakercontroller/commands/EpomakerPollCommand.py @@ -8,8 +8,7 @@ class EpomakerPollCommand(EpomakerCommand): """A command for polling the keyboard on 2.4Ghz wireless.""" def __init__(self) -> None: - """Initializes the poll. - """ + """Initializes the poll.""" initialization_data = "f7" initial_report = Report(initialization_data, index=0, checksum_index=None) super().__init__(initial_report) diff --git a/src/epomakercontroller/commands/EpomakerStreamCommand.py b/src/epomakercontroller/commands/EpomakerStreamCommand.py index 3f9397a..9b68eef 100644 --- a/src/epomakercontroller/commands/EpomakerStreamCommand.py +++ b/src/epomakercontroller/commands/EpomakerStreamCommand.py @@ -1,6 +1,4 @@ -""" -Large command that should be streamed directly to keyboard without storing data -""" +"""Large command that should be streamed directly to keyboard without storing data""" from epomakercontroller.commands.EpomakerCommand import EpomakerCommand from epomakercontroller.commands.reports.Report import Report diff --git a/src/epomakercontroller/commands/EpomakerWirelessInitCommand.py b/src/epomakercontroller/commands/EpomakerWirelessInitCommand.py index 538dcca..9ebccf2 100644 --- a/src/epomakercontroller/commands/EpomakerWirelessInitCommand.py +++ b/src/epomakercontroller/commands/EpomakerWirelessInitCommand.py @@ -1,6 +1,4 @@ -""" -Todo: write docstrings for this class -""" +"""Todo: write docstrings for this class""" from .EpomakerCommand import EpomakerCommand, CommandStructure from .reports.Report import Report diff --git a/src/epomakercontroller/commands/utils/stream_buffer.py b/src/epomakercontroller/commands/utils/stream_buffer.py index ac11f12..5204f59 100644 --- a/src/epomakercontroller/commands/utils/stream_buffer.py +++ b/src/epomakercontroller/commands/utils/stream_buffer.py @@ -1,4 +1,2 @@ -""" -Command buffer, that streams data directly to keyboard -""" +"""Command buffer, that streams data directly to keyboard""" diff --git a/src/epomakercontroller/configs/constants.py b/src/epomakercontroller/configs/constants.py index debad99..974a307 100644 --- a/src/epomakercontroller/configs/constants.py +++ b/src/epomakercontroller/configs/constants.py @@ -1,5 +1,4 @@ -""" -The main goal of this file is to prevent appearance of "magic" symbols in code, +"""The main goal of this file is to prevent appearance of "magic" symbols in code, and provide a single point of project configuration """ import os diff --git a/src/epomakercontroller/controllers/controller.py b/src/epomakercontroller/controllers/controller.py index bf856a3..d012bec 100644 --- a/src/epomakercontroller/controllers/controller.py +++ b/src/epomakercontroller/controllers/controller.py @@ -14,8 +14,7 @@ class ControllerBase(metaclass=ABCMeta): - """ - Just a base class for every type of controller. + """Just a base class for every type of controller. I assume you plan to support multiple keyboard types. Must be useful """ def __init__(self): diff --git a/src/epomakercontroller/epomakercontroller.py b/src/epomakercontroller/epomakercontroller.py index e206124..1995760 100644 --- a/src/epomakercontroller/epomakercontroller.py +++ b/src/epomakercontroller/epomakercontroller.py @@ -49,9 +49,7 @@ # pylint: disable=R0903 class EpomakerConfig: - """ - Configuration class that stores EpomakerController settings, parsed from config.json - """ + """Configuration class that stores EpomakerController settings, parsed from config.json""" def __init__(self, config_main: Config) -> None: all_configs = get_all_configs() @@ -302,9 +300,7 @@ def __check_whistle_response(response: bytes): return "01010168" in response.hex() def send_wireless_init(self) -> bool: - """ - Sends wireless init command to the HID device. Required before 2.4GHz mode usage - """ + """Sends wireless init command to the HID device. Required before 2.4GHz mode usage""" if self.__check_whistle_response(bytes(self.poll())): return True @@ -329,9 +325,7 @@ def send_image(self, image_path: str) -> None: self._send_command(image_command) def send_gif(self, image_path: str) -> None: - """ - Sends animated image to the screen. - """ + """Sends animated image to the screen.""" if not os.path.isfile(image_path): Logger.log_error(f"Could not find image: {image_path}") return @@ -341,9 +335,7 @@ def send_gif(self, image_path: str) -> None: self._send_command(gif_command) def clear_image(self) -> None: - """ - Sends command to completely clear the screen. Please note that you cannot revert this action. - """ + """Sends command to completely clear the screen. Please note that you cannot revert this action.""" self._send_command(EpomakerClearScreenCommand.EpomakerClearScreenCommand()) def send_time(self, time_to_send: datetime | None = None) -> None: diff --git a/src/epomakercontroller/utils/time_helper.py b/src/epomakercontroller/utils/time_helper.py index 5b0ea5c..0b1aece 100644 --- a/src/epomakercontroller/utils/time_helper.py +++ b/src/epomakercontroller/utils/time_helper.py @@ -2,8 +2,7 @@ class TimeHelper: - """ - A helper class to ensure a minimum amount of time has passed between its creation and deletion. + """A helper class to ensure a minimum amount of time has passed between its creation and deletion. This class starts a timer when it is initialized. When it is deleted, it calculates the total elapsed time and enforces a delay to ensure that the specified minimum time has passed. diff --git a/tests/data/config/config.json b/tests/data/config/config.json index e7f783d..f709122 100644 --- a/tests/data/config/config.json +++ b/tests/data/config/config.json @@ -13,4 +13,4 @@ "DEVICE_DESCRIPTION_REGEX": "ROYUAN .* System Control", "CONF_LAYOUT_PATH": "EpomakerRT100-UK-ISO.json", "CONF_KEYMAP_PATH": "EpomakerRT100.json" -} +} \ No newline at end of file diff --git a/tests/fake/fake_controller.py b/tests/fake/fake_controller.py index fa58669..7f2dfda 100644 --- a/tests/fake/fake_controller.py +++ b/tests/fake/fake_controller.py @@ -10,8 +10,7 @@ class FakeEpomakerController(EpomakerController): - """ - This fixture should help in testing low-level functionality. + """This fixture should help in testing low-level functionality. Overrides some behaviour, related to HID devices. This approach will disconnect unit tests from physical devices. """ diff --git a/tests/test_commands.py b/tests/test_commands.py index 43bd842..937108c 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -14,9 +14,7 @@ def test_send_image(): def test_send_image_wrong_path(): - """ - No fail, but no command being executed - """ + """No fail, but no command being executed""" controller = FakeEpomakerController(cli.CONFIG_MAIN) controller.send_image(os.path.abspath("tests/data/calibration_nonexistent.png")) diff --git a/tests/test_config.py b/tests/test_config.py index 6541a77..70ee7e8 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -65,8 +65,7 @@ def fake_get_directory() -> Path: def test_default_main_config(): - """ - This test was created during DEFAULT_MAIN_CONFIG dict migration + """This test was created during DEFAULT_MAIN_CONFIG dict migration That made migration a test-driven process. That guarantees that nothing was broken in process """ diff --git a/tests/test_constants.py b/tests/test_constants.py index 083c2fb..7c1e4bc 100644 --- a/tests/test_constants.py +++ b/tests/test_constants.py @@ -3,9 +3,7 @@ def test_validate_path(): - """ - Add other validation here if path should exist on controller startup - """ + """Add other validation here if path should exist on controller startup""" assert os.path.exists(constants.TMP_FOLDER), "Temp folder does not exist" assert os.path.exists(constants.PATH_TO_DEFAULT_CONFIG), "Default config path does not exist"