Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/epomakercontroller/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand Down
8 changes: 2 additions & 6 deletions src/epomakercontroller/commands/EpomakerClearScreenCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 2 additions & 6 deletions src/epomakercontroller/commands/EpomakerCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions src/epomakercontroller/commands/EpomakerPollCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 1 addition & 3 deletions src/epomakercontroller/commands/EpomakerStreamCommand.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 1 addition & 3 deletions src/epomakercontroller/commands/utils/stream_buffer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
"""
Command buffer, that streams data directly to keyboard
"""
"""Command buffer, that streams data directly to keyboard"""

3 changes: 1 addition & 2 deletions src/epomakercontroller/configs/constants.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/epomakercontroller/controllers/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
16 changes: 4 additions & 12 deletions src/epomakercontroller/epomakercontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions src/epomakercontroller/utils/time_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion tests/data/config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
"DEVICE_DESCRIPTION_REGEX": "ROYUAN .* System Control",
"CONF_LAYOUT_PATH": "EpomakerRT100-UK-ISO.json",
"CONF_KEYMAP_PATH": "EpomakerRT100.json"
}
}
3 changes: 1 addition & 2 deletions tests/fake/fake_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
4 changes: 1 addition & 3 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
3 changes: 1 addition & 2 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""

Expand Down
4 changes: 1 addition & 3 deletions tests/test_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Loading