Skip to content

Commit

Permalink
Merge pull request #111 from vchrisb/black
Browse files Browse the repository at this point in the history
house keeping
  • Loading branch information
vchrisb authored Mar 21, 2024
2 parents ec474d1 + 25b0bce commit e56d9cd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/make_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Prepare python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
38 changes: 20 additions & 18 deletions e3dc/_e3dc.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,7 @@ def poll(self, keepAlive: bool = False):
"production": {"solar": solar, "add": -add, "grid": grid},
"selfConsumption": sc,
"stateOfCharge": soc,
"time": datetime.datetime.utcfromtimestamp(ts).replace(
tzinfo=datetime.timezone.utc
),
"time": datetime.datetime.fromtimestamp(ts, tz=datetime.timezone.utc),
}

self.lastRequest = outObj
Expand Down Expand Up @@ -1247,9 +1245,9 @@ def get_battery_data(
(RscpTag.BAT_REQ_DCB_INFO, RscpType.Uint16, dcb),
],
),
keepAlive=True
if dcb != dcbs[-1]
else keepAlive, # last request should honor keepAlive
keepAlive=(
True if dcb != dcbs[-1] else keepAlive
), # last request should honor keepAlive
)

info = rscpFindTag(req, RscpTag.BAT_DCB_INFO)
Expand Down Expand Up @@ -1381,9 +1379,11 @@ def get_batteries_data(
self.get_battery_data(
batIndex=battery["index"],
dcbs=dcbs,
keepAlive=True
if battery["index"] != batteries[-1]["index"]
else keepAlive, # last request should honor keepAlive
keepAlive=(
True
if battery["index"] != batteries[-1]["index"]
else keepAlive
), # last request should honor keepAlive
)
)

Expand Down Expand Up @@ -1716,9 +1716,9 @@ def get_pvi_data(
),
],
),
keepAlive=True
if string != strings[-1]
else keepAlive, # last request should honor keepAlive
keepAlive=(
True if string != strings[-1] else keepAlive
), # last request should honor keepAlive
)
stringobj = {
"power": rscpFindTagIndex(
Expand Down Expand Up @@ -1771,9 +1771,9 @@ def get_pvis_data(
pviIndex=pvi["index"],
strings=strings,
phases=phases,
keepAlive=True
if pvi["index"] != pvis[-1]["index"]
else keepAlive, # last request should honor keepAlive
keepAlive=(
True if pvi["index"] != pvis[-1]["index"] else keepAlive
), # last request should honor keepAlive
)
)

Expand Down Expand Up @@ -1931,9 +1931,11 @@ def get_powermeters_data(
outObj.append(
self.get_powermeter_data(
pmIndex=powermeter["index"],
keepAlive=True
if powermeter["index"] != powermeters[-1]["index"]
else keepAlive, # last request should honor keepAlive
keepAlive=(
True
if powermeter["index"] != powermeters[-1]["index"]
else keepAlive
), # last request should honor keepAlive
)
)

Expand Down
8 changes: 4 additions & 4 deletions e3dc/_e3dc_rscp_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,10 @@ def sendCommand(
def _sendRequest_internal(
self,
innerFrame: bytes | Tuple[str | int | RscpTag, str | int | RscpType, Any],
callback: Callable[
[Tuple[str | int | RscpTag, str | int | RscpType, Any]], None
]
| None = None,
callback: (
Callable[[Tuple[str | int | RscpTag, str | int | RscpType, Any]], None]
| None
) = None,
):
"""Internal send request method.
Expand Down
6 changes: 3 additions & 3 deletions e3dc/_rscpLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def rscpFindTag(
if decodedMsg[0] == tagStr:
return decodedMsg
if isinstance(decodedMsg[2], list):
msgList: List[
Tuple[str | int | RscpTag, str | int | RscpType, Any]
] = decodedMsg[2]
msgList: List[Tuple[str | int | RscpTag, str | int | RscpType, Any]] = (
decodedMsg[2]
)
for msg in msgList:
msgValue = rscpFindTag(msg, tag)
if msgValue is not None:
Expand Down

0 comments on commit e56d9cd

Please sign in to comment.