2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Improve code style

This commit is contained in:
Neraud 2017-07-30 09:32:02 +02:00
parent 262bee468d
commit ac255fa70d

View File

@ -256,16 +256,13 @@ class StatClient:
def on_one_torrent_info(self, value, torrent_id):
log.debug("Got torrent info : {0} -> {1}".format(torrent_id, value))
if 'state' in value:
state = value['state']
else:
state = "Error"
state = value.get("state", "Error")
if not (state in self.states):
if state not in self.states:
log.warn("State '{0}' is unknown !".format(state))
state = "Other"
self.states[state] = self.states[state] + 1
self.states[state] += 1
def on_all_torrent_info_fetched(self, res):
log.debug("on_all_torrent_info_fetched : {0}".format(self.states))
@ -390,7 +387,7 @@ if len(sys.argv) > 1:
print('Deluge Torrent Munin plugin, version {0}'.format(
plugin_version))
sys.exit(0)
elif action != "":
elif action:
log.warn("Unknown argument '{0}'".format(action))
sys.exit(1)
else: