Skip to content

Commit 87fb4f9

Browse files
ic-dev21Boris Fersing
authored andcommitted
Cleanup dead code
1 parent d5df744 commit 87fb4f9

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

pyhilo/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ async def async_get_access_token(self) -> str:
135135
"""Return a valid access token."""
136136
if not self._oauth_session.valid_token:
137137
await self._oauth_session.async_ensure_token_valid()
138-
138+
139139
access_token = str(self._oauth_session.token["access_token"])
140140
LOG.debug(f"ic-dev21 access token is {access_token}")
141141

pyhilo/event.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Event object """
22
from datetime import datetime, timedelta, timezone
3-
import re
43
import logging
4+
import re
55
from typing import Any, cast
66

77
from pyhilo.util import camel_to_snake, from_utc_timestamp
@@ -126,13 +126,15 @@ def current_phase_times(self) -> dict[str, datetime]:
126126
"end": getattr(self, phase_end),
127127
}
128128

129-
130129
@property
131130
def state(self) -> str:
132-
now = datetime.now(self.preheat_start.tzinfo)
131+
now = datetime.now(self.preheat_start.tzinfo)
133132
if self.pre_cold_start and self.pre_cold_start <= now < self.pre_cold_end:
134133
return "pre_cold"
135-
elif self.appreciation_start and self.appreciation_start <= now < self.appreciation_end:
134+
elif (
135+
self.appreciation_start
136+
and self.appreciation_start <= now < self.appreciation_end
137+
):
136138
return "appreciation"
137139
elif self.preheat_start > now:
138140
return "scheduled"
@@ -146,9 +148,8 @@ def state(self) -> str:
146148
return "off"
147149
elif now >= self.recovery_end:
148150
return "completed"
149-
elif self.progess:
151+
elif self.progress:
150152
return self.progress
151153

152154
else:
153155
return "unknown"
154-

pyhilo/util/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
"""Define utility modules."""
22
import asyncio
33
from datetime import datetime, timedelta
4+
import logging
45
import re
56
from typing import Any, Callable
6-
import logging
7-
8-
LOG = logging.getLogger(__package__)
97

108
from dateutil import tz
119
from dateutil.parser import parse
1210

1311
from pyhilo.const import LOG # noqa: F401
1412

13+
LOG = logging.getLogger(__package__)
14+
15+
1516
CAMEL_REX_1 = re.compile("(.)([A-Z][a-z]+)")
1617
CAMEL_REX_2 = re.compile("([a-z0-9])([A-Z])")
1718

@@ -44,6 +45,7 @@ def from_utc_timestamp(date_string: str) -> datetime:
4445
output = dt.astimezone(to_zone)
4546
return output
4647

48+
4749
def time_diff(ts1: datetime, ts2: datetime) -> timedelta:
4850
to_zone = tz.tzlocal()
4951
return ts1.astimezone(to_zone) - ts2.astimezone(to_zone)

pyhilo/websocket.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,9 @@ async def async_invoke(
377377
except asyncio.TimeoutError:
378378
return
379379
self._ready_event.clear()
380-
LOG.debug(f"ic-dev21 invoke argument: {arg}, invocationId: {inv_id}, target: {target}, type: {type}")
380+
LOG.debug(
381+
f"ic-dev21 invoke argument: {arg}, invocationId: {inv_id}, target: {target}, type: {type}"
382+
)
381383
await self._async_send_json(
382384
{
383385
"arguments": arg,

0 commit comments

Comments
 (0)