From c373c57854de79110e1eec80a224a38c26d0ab79 Mon Sep 17 00:00:00 2001 From: mazocode Date: Fri, 6 Oct 2023 17:41:32 +0200 Subject: [PATCH] Workflow fix --- .github/workflows/run-code-analysis.yaml | 1 + Makefile | 2 +- modbus2mqtt.py | 21 ++++++++++----------- pyproject.toml | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/run-code-analysis.yaml b/.github/workflows/run-code-analysis.yaml index 4c8de0e..57a98b1 100644 --- a/.github/workflows/run-code-analysis.yaml +++ b/.github/workflows/run-code-analysis.yaml @@ -20,6 +20,7 @@ jobs: python -m pip install --upgrade pip pip install poetry pip install flake8 + pip install pyproject-flake8 pip install -r requirements.txt - name: Static code analysis run: | diff --git a/Makefile b/Makefile index e36f6c8..4c46902 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ export-requirements: poetry export -f requirements.txt --output requirements.txt check-code: - poetry run flake8 . + poetry run pflake8 . show-dependencies: poetry show diff --git a/modbus2mqtt.py b/modbus2mqtt.py index 7f21a11..d04a157 100755 --- a/modbus2mqtt.py +++ b/modbus2mqtt.py @@ -143,12 +143,12 @@ def poller_thread(self): # ) val = rr.registers[0] if r.signed and int(val) >= 32768: - val = int(val)-65535 + val = int(val) - 65535 if r.decimals > 0: - fmt = '{0:.'+str(r.decimals)+'f}' - val = float(fmt.format((int(val)-float(r.substract)) / float(r.divide))) + fmt = '{0:.' + str(r.decimals) + 'f}' + val = float(fmt.format((int(val) - float(r.substract)) / float(r.divide))) else: - val = int(((int(val)-float(r.substract)) / float(r.divide))) + val = int(((int(val) - float(r.substract)) / float(r.divide))) log.debug("got %s", val) @@ -204,13 +204,12 @@ def main(argv): log.debug("Configuring mqtt broker %s", config["mqtt"]["host"]) b = MqttBroker( - config["mqtt"]["host"], - int(config["mqtt"]["port"]), - config["mqtt"]["username"], - config["mqtt"]["password"], - config["mqtt"]["topic_prefix"], - bool(config["mqtt"]["tls"]) - ) + config["mqtt"]["host"], + int(config["mqtt"]["port"]), + config["mqtt"]["username"], + config["mqtt"]["password"], + config["mqtt"]["topic_prefix"], + bool(config["mqtt"]["tls"])) for source in config["sources"]: log.debug("Configuring source %s", source["name"]) diff --git a/pyproject.toml b/pyproject.toml index 0811fa7..211cd0b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,4 +14,4 @@ pyyaml = "6.0.1" [tool.flake8] max-line-length = 120 -ignore = ['E203', 'W503', 'E501', 'W128'] +ignore = ['E203', 'W503', 'E501', 'E128']