Skip to content

Commit

Permalink
Make flake8 happier
Browse files Browse the repository at this point in the history
  • Loading branch information
lukipuki committed Oct 26, 2023
1 parent 56b4f76 commit e78a44f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
flake8 . --count --exit-zero --statistics
- name: Test with pytest
run: |
pytest
5 changes: 2 additions & 3 deletions src/yaroc/scripts/mqtt_forwarder.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def _prototime_to_datetime(prototime: Timestamp) -> datetime:

@staticmethod
def _payload_to_bytes(payload: PayloadType) -> bytes:
if type(payload) == bytes:
if isinstance(payload, bytes):
return payload
elif type(payload) == str:
elif isinstance(payload, str):
return payload.encode("utf-8")
else:
return bytes() # TODO: indicate error
Expand Down Expand Up @@ -63,7 +63,6 @@ async def _handle_punches(self, mac_addr: str, payload: PayloadType, now: dateti
log_message += f", MAC {mac_addr}"

logging.info(log_message)

handles = [
client.send_punch(punch.card, si_time, punch.code, punch.mode, process_time)
for client in self.clients[mac_addr]
Expand Down

0 comments on commit e78a44f

Please sign in to comment.