From c586f34d4b76693d3a1b7f33c18309c3c1e242b9 Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Wed, 14 Aug 2019 01:27:42 +0200 Subject: [PATCH] Plugin arris-tg3442: fix code style issues reported by flake8 --- plugins/router/arris-tg3442 | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/plugins/router/arris-tg3442 b/plugins/router/arris-tg3442 index 4f696888..94563a32 100755 --- a/plugins/router/arris-tg3442 +++ b/plugins/router/arris-tg3442 @@ -105,7 +105,7 @@ def login(session, url, username, password): iterations=1000, dklen=128/8 ) - secret = { "Password": password, "Nonce": current_session_id } + secret = {"Password": password, "Nonce": current_session_id} plaintext = bytes(json.dumps(secret).encode("ascii")) associated_data = "loginPassword" # initialize cipher @@ -168,7 +168,7 @@ def docsis_status(session): downstream_data = json.loads(json_downstream_data) upstream_data = json.loads(json_upstream_data) # convert lock status to numeric values - for d in [ upstream_data, downstream_data ]: + for d in [upstream_data, downstream_data]: for c in d: if c['LockStatus'] == "ACTIVE" or c['LockStatus'] == "Locked": c['LockStatus'] = 1 @@ -242,24 +242,21 @@ if __name__ == "__main__": # process all graphs for g in graph_descriptions: # graph config - print( - f"multigraph docsis_{g['name']}\n" - f"graph_title {g['title']}\n" \ - f"graph_category network\n" \ - f"graph_vlabel {g['vlabel']}\n" \ - f"graph_info {g['info']}\n" \ - f"graph_scale no\n" - ) + print(f"multigraph docsis_{g['name']}") + print(f"graph_title {g['title']}") + print(f"graph_category network") + print(f"graph_vlabel {g['vlabel']}") + print(f"graph_info {g['info']}") + print(f"graph_scale no") # channels for c in g['data']: # only use channels with PowerLevel if not c['PowerLevel']: continue - print( - f"channel_{c['ChannelID']}.label {c['ChannelID']} ({c['Frequency']} MHz)\n" - f"channel_{c['ChannelID']}.info Channel type: {c['ChannelType']}, Modulation: {c['Modulation']}" - ) + info_text = f"Channel type: {c['ChannelType']}, Modulation: {c['Modulation']}" + print(f"channel_{c['ChannelID']}.label {c['ChannelID']} ({c['Frequency']} MHz)") + print(f"channel_{c['ChannelID']}.info {info_text}") # output values ? else: