Skip to content

Commit b704551

Browse files
committed
Fix formatting and typing errors
Introduced from some PRs to dev branch which didn't pass the checks.
1 parent 4780abb commit b704551

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/chia_log/handlers/daily_stats/stats_manager.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import logging
33
import re
44
from datetime import datetime, timedelta
5-
from typing import List, Union
5+
from typing import cast, List, Union
66
from threading import Thread
77
from time import sleep
88

@@ -50,7 +50,9 @@ def __init__(self, config: dict, notify_manager: NotifyManager):
5050
f"Summary notifications will be sent out every {self._frequency_hours} "
5151
f"hours starting from {self._notify_time['hour']:02d}:{self._notify_time['minute']:02d}"
5252
)
53-
self._datetime_next_summary = datetime.now().replace(hour=self._notify_time['hour'], minute=self._notify_time['minute'], second=0, microsecond=0)
53+
self._datetime_next_summary = datetime.now().replace(
54+
hour=self._notify_time["hour"], minute=self._notify_time["minute"], second=0, microsecond=0
55+
)
5456
while datetime.now() > self._datetime_next_summary:
5557
self._datetime_next_summary += timedelta(hours=self._frequency_hours)
5658

@@ -103,12 +105,13 @@ def _run_loop(self):
103105
def stop(self):
104106
self._is_running = False
105107

106-
def _parse_notify_time(self, value: Union[str, int], default: dict = {'hour': 21, 'minute': 0}) -> dict:
108+
def _parse_notify_time(self, value: Union[str, int], default: dict = {"hour": 21, "minute": 0}) -> dict:
107109
if type(value) == int:
108-
return {'hour': value, 'minute': 0}
110+
return {"hour": value, "minute": 0}
109111

110-
match = re.match('(?:[01]\d|2[0-3]):(?:[0-5]\d)', value)
112+
value = cast(str, value)
113+
match = re.match(r"(?:[01]\d|2[0-3]):(?:[0-5]\d)", value)
111114
if match:
112-
return {'hour': int(value[:2]), 'minute': int(value[-2:])}
115+
return {"hour": int(value[:2]), "minute": int(value[-2:])}
113116

114117
return default

src/chia_log/log_consumer.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,7 @@ def _read_log(self) -> Tuple[ChannelStdinFile, ChannelFile, ChannelStderrFile]:
164164
return stdin, stdout, stderr
165165

166166
def _has_rotated(self, path: PurePath) -> bool:
167-
stdin, stdout, stderr = self._ssh_client.exec_command(
168-
f"powershell.exe Write-Host(Get-Item {str(path)}).length"
169-
)
167+
stdin, stdout, stderr = self._ssh_client.exec_command(f"powershell.exe Write-Host(Get-Item {str(path)}).length")
170168

171169
old_size = self._log_size
172170
self._log_size = int(stdout.readline())

0 commit comments

Comments
 (0)