From 9a6e04421869663b1fcc5cd50d41b99acf71a6ab Mon Sep 17 00:00:00 2001 From: tobi-wan-kenobi Date: Fri, 24 Apr 2020 16:22:25 +0200 Subject: [PATCH] [modules/dnf] quotes --- modules/contrib/dnf.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/contrib/dnf.py b/modules/contrib/dnf.py index d3ceebf..3e39d8e 100644 --- a/modules/contrib/dnf.py +++ b/modules/contrib/dnf.py @@ -19,7 +19,7 @@ import bumblebee.engine def get_dnf_info(widget): try: - res = bumblebee.util.execute("dnf updateinfo") + res = bumblebee.util.execute('dnf updateinfo') except RuntimeError: pass @@ -27,26 +27,26 @@ def get_dnf_info(widget): bugfixes = 0 enhancements = 0 other = 0 - for line in res.split("\n"): + for line in res.split('\n'): - if not line.startswith(" "): continue - elif "ecurity" in line: + if not line.startswith(' '): continue + elif 'ecurity' in line: for s in line.split(): if s.isdigit(): security += int(s) - elif "ugfix" in line: + elif 'ugfix' in line: for s in line.split(): if s.isdigit(): bugfixes += int(s) - elif "hancement" in line: + elif 'hancement' in line: for s in line.split(): if s.isdigit(): enhancements += int(s) else: for s in line.split(): if s.isdigit(): other += int(s) - widget.set("security", security) - widget.set("bugfixes", bugfixes) - widget.set("enhancements", enhancements) - widget.set("other", other) + widget.set('security', security) + widget.set('bugfixes', bugfixes) + widget.set('enhancements', enhancements) + widget.set('other', other) class Module(bumblebee.engine.Module): def __init__(self, engine, config): @@ -57,9 +57,9 @@ class Module(bumblebee.engine.Module): def updates(self, widget): result = [] - for t in ["security", "bugfixes", "enhancements", "other"]: + for t in ['security', 'bugfixes', 'enhancements', 'other']: result.append(str(widget.get(t, 0))) - return "/".join(result) + return '/'.join(result) def update(self, widgets): thread = threading.Thread(target=get_dnf_info, args=(widgets[0],)) @@ -67,11 +67,11 @@ class Module(bumblebee.engine.Module): def state(self, widget): cnt = 0 - for t in ["security", "bugfixes", "enhancements", "other"]: + for t in ['security', 'bugfixes', 'enhancements', 'other']: cnt += widget.get(t, 0) if cnt == 0: - return "good" - if cnt > 50 or widget.get("security", 0) > 0: - return "critical" + return 'good' + if cnt > 50 or widget.get('security', 0) > 0: + return 'critical' # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4