Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed May 8, 2023
1 parent 6db0289 commit c689d3d
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 21 deletions.
2 changes: 0 additions & 2 deletions pitopd/hub_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,8 @@ def wait_for_device_identification(self):

time_waited = 0
while time_waited < 5:

device_id = self.get_device_id()
if device_id == DeviceID.unknown:

sleep(0.25)
time_waited += 0.25

Expand Down
1 change: 0 additions & 1 deletion pitopd/notification_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ def __show_message(
action_text=None,
action=None,
):

try:
cmd = self.__notify_send_command(
message_title_id,
Expand Down
1 change: 0 additions & 1 deletion pitopd/poweroff.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def _do_poweroff(device_id):
PWR__SHUTDOWN_CTRL__MODE4 = 0x20

try:

hub = I2CDevice("/dev/i2c-1", i2c_address)
hub.connect()

Expand Down
2 changes: 0 additions & 2 deletions pitopd/pthub/pthub.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def register_client(
on_shutdown_requested_func=None,
on_battery_state_changed_func=None,
):

self._brightness_change_func = on_brightness_changed_func
self._screen_blanked_func = on_screen_blanked_func
self._screen_unblanked_func = on_screen_unblanked_func
Expand Down Expand Up @@ -180,7 +179,6 @@ def register_client(
on_shutdown_requested_func=None,
on_battery_state_changed_func=None,
):

_state.register_client(
on_brightness_changed_func,
on_screen_blanked_func,
Expand Down
8 changes: 0 additions & 8 deletions pitopd/pthub/pthub_spi.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def __init__(self, state_instance):
def _update_state_from_pending_state_change(self, state_change_to_send):
# If state is to change, update appropriate bit(s)
if state_change_to_send is not None:

if state_change_to_send._type == SPIStateChangeType.screen:
if state_change_to_send._operation == SPIScreenOperations.blank:
self._state.set_screen_blanked()
Expand All @@ -114,7 +113,6 @@ def _update_state_from_pending_state_change(self, state_change_to_send):
logger.info(msg)

elif state_change_to_send._type == SPIStateChangeType.brightness:

if _represents_int(state_change_to_send._operation):
brightness_level = int(state_change_to_send._operation)
if brightness_level >= 0 and brightness_level <= 10:
Expand All @@ -139,19 +137,16 @@ def transceive_and_process(self):

# Determine if received byte represents device ID or state
if byte_type == SPIResponseType.device_id:

logger.debug("Valid response from hub - DEVICE ID")
self._process_device_id(hub_response_bstring)

elif byte_type == SPIResponseType.state:

self._process_spi_resp(hub_response_bstring)

# State update has been sent to hub: perform another transceive to sync states
self._get_state_from_hub(process_state=False)

else:

logger.warning("Invalid response from hub")
return False

Expand Down Expand Up @@ -242,7 +237,6 @@ def _determine_byte(self, resp):

def _process_spi_resp_shutdown(self, spi_shutdown_bit_int):
if spi_shutdown_bit_int == 1:

# Increment shutdown counter
self._shutdown_ctr.increment()

Expand Down Expand Up @@ -451,7 +445,6 @@ def _add_state_change_to_send_class_to_stack(pending_state_change_to_send):

def change_brightness_state(brightness_val):
if is_initialised():

if brightness_val > 10:
brightness_val = 10

Expand Down Expand Up @@ -589,7 +582,6 @@ def _main_thread_loop():
)

while len(_spi_handler.queued_changes) > 0:

communicate()
sleep(_cycle_sleep_time)

Expand Down
1 change: 0 additions & 1 deletion pitopd/pthub2/pthub2.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def register_client(
on_shutdown_requested_func=None,
on_battery_state_changed_func=None,
):

_state.register_client(
on_brightness_changed_func,
on_screen_blanked_func,
Expand Down
2 changes: 0 additions & 2 deletions pitopd/pthub2/pthub2_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ def disable_hdmi_audio(self):

def _main_thread_loop(self):
while self._run_polling_thread is True:

self._poll_hub()
sleep(self._cycle_sleep_time)

Expand All @@ -262,7 +261,6 @@ def _read_shutdown_control(self):
)

if shutdown_control & ShutdownRegister.PWR__SHUTDOWN_CTRL__BUTT != 0:

# The power button been held for the time indicated in PWR__BUTT_SHORT_HOLD_TURNOFF
self._state.emit_shutdown()

Expand Down
1 change: 0 additions & 1 deletion pitopd/pthub2/pthub2_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def register_client(
on_shutdown_requested_func=None,
on_battery_state_changed_func=None,
):

self._brightness_change_func = on_brightness_changed_func
self._screen_blanked_func = on_screen_blanked_func
self._screen_unblanked_func = on_screen_unblanked_func
Expand Down
3 changes: 0 additions & 3 deletions pitopd/sys_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,8 @@ def set_value(property_name, value_to_set):
desired_line = ""

with open(temp_file, "w") as output_file:

last_char = ""
with open(_BootConfig.BOOT_CONFIG_FILE, "r") as input_file:

for line in input_file:
line_to_write = line

Expand Down Expand Up @@ -581,7 +579,6 @@ def configure_in_boot_config(
def boot_config_correctly_configured(
expected_clock_val=None, expected_baud_val=None, expected_enabled_val=None
):

if expected_clock_val is not None:
if isinstance(expected_clock_val, int):
clock_string = _BootConfig.get_value(
Expand Down

0 comments on commit c689d3d

Please sign in to comment.