1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-25 10:28:36 +00:00

Fix python style issues reported by flake8

Additionally some python2-only "print" statements are now compatible
with python3.
This commit is contained in:
Lars Kruse 2019-12-18 00:25:39 +01:00
parent 73f885e382
commit 7063330e03
17 changed files with 102 additions and 103 deletions

View file

@ -121,25 +121,25 @@ log = logging.getLogger("delugeStats")
log.setLevel(logging.WARNING)
conf = {
'host': os.getenv('host', '127.0.0.1'),
'port': int(os.getenv('port', '58846')),
'username': os.getenv('username', ''),
'password': os.getenv('password', '')
'host': os.getenv('host', '127.0.0.1'),
'port': int(os.getenv('port', '58846')),
'username': os.getenv('username', ''),
'password': os.getenv('password', '')
}
names_for_munin = {
'numConnections': 'numConnections',
'payloadUploadRate': 'payloadUploadRate',
'overheadUploadRate': 'overheadUploadRate',
'payloadDownloadRate': 'payloadDownloadRate',
'overheadDownloadRate': 'overheadDownloadRate',
'state.Seeding': 'seeding',
'state.Downloading': 'downloading',
'state.Paused': 'paused',
'state.Error': 'error',
'state.Queued': 'queued',
'state.Checking': 'checking',
'state.Other': 'other'
'numConnections': 'numConnections',
'payloadUploadRate': 'payloadUploadRate',
'overheadUploadRate': 'overheadUploadRate',
'payloadDownloadRate': 'payloadDownloadRate',
'overheadDownloadRate': 'overheadDownloadRate',
'state.Seeding': 'seeding',
'state.Downloading': 'downloading',
'state.Paused': 'paused',
'state.Error': 'error',
'state.Queued': 'queued',
'state.Checking': 'checking',
'state.Other': 'other'
}
torrent_states = ["Downloading",
@ -300,8 +300,8 @@ def print_config(mode):
"graph_info This graph shows the number of connections used by Deluge Torrent")
print(names_for_munin["numConnections"] + ".label connections")
print(names_for_munin["numConnections"] + ".min 0")
print(names_for_munin["numConnections"] +
".info The number of connections used by Deluge Torrent")
print(names_for_munin["numConnections"]
+ ".info The number of connections used by Deluge Torrent")
elif mode == "bandwidth":
print("graph_title Bandwidth usage")
print("graph_order payloadDownloadRate overheadDownloadRate payloadUploadRate "
@ -353,13 +353,12 @@ def print_config(mode):
print("graph_period second")
for state_name in torrent_states:
print(names_for_munin["state." +
state_name] + ".label " + state_name)
print(names_for_munin["state." + state_name] + ".label " + state_name)
print(names_for_munin["state." + state_name] + ".draw AREASTACK")
print(names_for_munin["state." + state_name] + ".type GAUGE")
print(names_for_munin["state." + state_name] + ".min 0")
print(names_for_munin["state." + state_name] +
".info Number of torrents in the '" + state_name + "' state")
print(names_for_munin["state." + state_name]
+ ".info Number of torrents in the '" + state_name + "' state")
def fetch_info(mode):