Skip to content

Commit e56d9cd

Browse files
authored
Merge pull request #111 from vchrisb/black
house keeping
2 parents ec474d1 + 25b0bce commit e56d9cd

5 files changed

Lines changed: 29 additions & 27 deletions

File tree

.github/workflows/make_wheel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Prepare python
16-
uses: actions/setup-python@v4
16+
uses: actions/setup-python@v5
1717
with:
1818
python-version: '3.10'
1919

.github/workflows/validate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v4
1313
- name: Set up Python ${{ matrix.python-version }}
14-
uses: actions/setup-python@v4
14+
uses: actions/setup-python@v5
1515
with:
1616
python-version: ${{ matrix.python-version }}
1717
- name: Install dependencies

e3dc/_e3dc.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,7 @@ def poll(self, keepAlive: bool = False):
318318
"production": {"solar": solar, "add": -add, "grid": grid},
319319
"selfConsumption": sc,
320320
"stateOfCharge": soc,
321-
"time": datetime.datetime.utcfromtimestamp(ts).replace(
322-
tzinfo=datetime.timezone.utc
323-
),
321+
"time": datetime.datetime.fromtimestamp(ts, tz=datetime.timezone.utc),
324322
}
325323

326324
self.lastRequest = outObj
@@ -1247,9 +1245,9 @@ def get_battery_data(
12471245
(RscpTag.BAT_REQ_DCB_INFO, RscpType.Uint16, dcb),
12481246
],
12491247
),
1250-
keepAlive=True
1251-
if dcb != dcbs[-1]
1252-
else keepAlive, # last request should honor keepAlive
1248+
keepAlive=(
1249+
True if dcb != dcbs[-1] else keepAlive
1250+
), # last request should honor keepAlive
12531251
)
12541252

12551253
info = rscpFindTag(req, RscpTag.BAT_DCB_INFO)
@@ -1381,9 +1379,11 @@ def get_batteries_data(
13811379
self.get_battery_data(
13821380
batIndex=battery["index"],
13831381
dcbs=dcbs,
1384-
keepAlive=True
1385-
if battery["index"] != batteries[-1]["index"]
1386-
else keepAlive, # last request should honor keepAlive
1382+
keepAlive=(
1383+
True
1384+
if battery["index"] != batteries[-1]["index"]
1385+
else keepAlive
1386+
), # last request should honor keepAlive
13871387
)
13881388
)
13891389

@@ -1716,9 +1716,9 @@ def get_pvi_data(
17161716
),
17171717
],
17181718
),
1719-
keepAlive=True
1720-
if string != strings[-1]
1721-
else keepAlive, # last request should honor keepAlive
1719+
keepAlive=(
1720+
True if string != strings[-1] else keepAlive
1721+
), # last request should honor keepAlive
17221722
)
17231723
stringobj = {
17241724
"power": rscpFindTagIndex(
@@ -1771,9 +1771,9 @@ def get_pvis_data(
17711771
pviIndex=pvi["index"],
17721772
strings=strings,
17731773
phases=phases,
1774-
keepAlive=True
1775-
if pvi["index"] != pvis[-1]["index"]
1776-
else keepAlive, # last request should honor keepAlive
1774+
keepAlive=(
1775+
True if pvi["index"] != pvis[-1]["index"] else keepAlive
1776+
), # last request should honor keepAlive
17771777
)
17781778
)
17791779

@@ -1931,9 +1931,11 @@ def get_powermeters_data(
19311931
outObj.append(
19321932
self.get_powermeter_data(
19331933
pmIndex=powermeter["index"],
1934-
keepAlive=True
1935-
if powermeter["index"] != powermeters[-1]["index"]
1936-
else keepAlive, # last request should honor keepAlive
1934+
keepAlive=(
1935+
True
1936+
if powermeter["index"] != powermeters[-1]["index"]
1937+
else keepAlive
1938+
), # last request should honor keepAlive
19371939
)
19381940
)
19391941

e3dc/_e3dc_rscp_web.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,10 @@ def sendCommand(
354354
def _sendRequest_internal(
355355
self,
356356
innerFrame: bytes | Tuple[str | int | RscpTag, str | int | RscpType, Any],
357-
callback: Callable[
358-
[Tuple[str | int | RscpTag, str | int | RscpType, Any]], None
359-
]
360-
| None = None,
357+
callback: (
358+
Callable[[Tuple[str | int | RscpTag, str | int | RscpType, Any]], None]
359+
| None
360+
) = None,
361361
):
362362
"""Internal send request method.
363363

e3dc/_rscpLib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ def rscpFindTag(
8585
if decodedMsg[0] == tagStr:
8686
return decodedMsg
8787
if isinstance(decodedMsg[2], list):
88-
msgList: List[
89-
Tuple[str | int | RscpTag, str | int | RscpType, Any]
90-
] = decodedMsg[2]
88+
msgList: List[Tuple[str | int | RscpTag, str | int | RscpType, Any]] = (
89+
decodedMsg[2]
90+
)
9191
for msg in msgList:
9292
msgValue = rscpFindTag(msg, tag)
9393
if msgValue is not None:

0 commit comments

Comments
 (0)