Skip to content

Commit 3c3bb0f

Browse files
committed
fix lint issues
1 parent efc19d5 commit 3c3bb0f

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ cleanup DEVICE_ID $CI="true":
6060
echo "Removing device and child devices (including certificates)"
6161
c8y devicemanagement certificates list -n --tenant "$(c8y currenttenant get --select name --output csv)" --filter "name eq ${DEVICE_ID}" --pageSize 2000 | c8y devicemanagement certificates delete --tenant "$(c8y currenttenant get --select name --output csv)"
6262
c8y inventory find -n --owner "device_${DEVICE_ID}" -p 100 | c8y inventory delete
63-
c8y users delete -n --id "device_${DEVICE_ID}$" --tenant "$(c8y currenttenant get --select name --output csv)" --silentStatusCodes 404 --silentExit
63+
c8y users delete -n --id "device_${DEVICE_ID}$" --tenant "$(c8y currenttenant get --select name --output csv)" --silentStatusCodes 404 --silentExit

tedge_modbus/operations/c8y_modbus_configuration.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ def run(arguments, context: Context):
3535
modbus_config["modbus"]["pollinterval"] = polling_rate
3636

3737
# Save to file
38-
logger.info("Saving new configuration to %s", config_path)
39-
with open(config_path, "w", encoding="utf8") as f:
38+
logger.info("Saving new configuration to %s", context.base_config_path)
39+
with open(context.base_config_path, "w", encoding="utf8") as f:
4040
toml.dump(modbus_config, f)
41-
logger.info("New configuration saved to %s", config_path)
4241

4342
# Update managedObject
4443
logger.debug("Updating managedObject with new configuration")

tedge_modbus/operations/c8y_modbus_device.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ def parse_arguments(arguments) -> ModebusDevice:
8787

8888

8989
def run(arguments, context: Context):
90+
"""main"""
9091
loglevel = context.base_config["modbus"]["loglevel"] or "INFO"
9192
logger.setLevel(getattr(logging, loglevel.upper(), logging.INFO))
92-
"""main"""
9393
logger.info("New c8y_ModbusDevice operation")
9494
# Check and store arguments
9595
if len(arguments) != 8:

tedge_modbus/operations/context.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import subprocess
55
from dataclasses import dataclass
66
from pathlib import Path
7-
7+
import toml
88

99
@dataclass
1010
class Context:
@@ -15,6 +15,7 @@ class Context:
1515
port = 1883
1616
client_id = "c8y_ModbusConfiguration-operation-client"
1717
config_dir = Path("/etc/tedge/plugins/modbus")
18+
base_config_path = config_dir / "modbus.toml"
1819

1920
@property
2021
def c8y_proxy(self) -> str:
@@ -38,5 +39,5 @@ def device_id(self):
3839

3940
@property
4041
def base_config(self):
41-
config_path = config_dir / "modbus.toml"
42-
return toml.load(config_path)
42+
"""loads the default modbus.toml file and gives it back as dict"""
43+
return toml.load(self.base_config_path)

0 commit comments

Comments
 (0)