提交 7cf0a319 编写于 作者: D desbma 提交者: Alessio Sergi

Don't construct empty lists in tests

上级 59fc36e3
......@@ -664,7 +664,7 @@ class _GlancesCurses(object):
# Exit if:
# - the plugin_stats message is empty
# - the display tag = False
if plugin_stats['msgdict'] == [] or not plugin_stats['display']:
if not plugin_stats['msgdict'] or not plugin_stats['display']:
# Exit
return 0
......
......@@ -67,7 +67,7 @@ class Plugin(GlancesPlugin):
# Build the string message
# Header
if self.stats == []:
if not self.stats:
msg = _("No warning or critical alert detected")
ret.append(self.curse_add_line(msg, "TITLE"))
else:
......
......@@ -103,7 +103,7 @@ class GlancesGrabBat(object):
def getcapacitypercent(self):
"""Get batteries capacity percent."""
if not self.initok or self.bat.stat == []:
if not self.initok or not self.bat.stat:
return []
# Init the bsum (sum of percent)
......
......@@ -122,7 +122,7 @@ class Plugin(GlancesPlugin):
ret = []
# Only process if stats exist and display plugin enable...
if self.stats == [] or args.disable_diskio:
if not self.stats or args.disable_diskio:
return ret
# Build the string message
......
......@@ -158,7 +158,7 @@ class Plugin(GlancesPlugin):
ret = []
# Only process if stats exist and display plugin enable...
if self.stats == [] or args.disable_fs:
if not self.stats or args.disable_fs:
return ret
# Max size for the fsname name
......
......@@ -88,7 +88,7 @@ class Plugin(GlancesPlugin):
ret = []
# Only process if stats exist and display plugin enable...
if self.stats == [] or args.disable_process:
if not self.stats or args.disable_process:
return ret
# Build the string message
......
......@@ -185,7 +185,7 @@ class Plugin(GlancesPlugin):
ret = []
# Only process if stats exist and display plugin enable...
if self.stats == [] or args.disable_network:
if not self.stats or args.disable_network:
return ret
# Max size for the interface name
......
......@@ -130,7 +130,7 @@ class Plugin(GlancesPlugin):
ret = []
# No per CPU stat ? Exit...
if self.stats == []:
if not self.stats:
msg = _("PER CPU not available")
ret.append(self.curse_add_line(msg, "TITLE"))
return ret
......
......@@ -355,7 +355,7 @@ class Plugin(GlancesPlugin):
ret = []
# Only process if stats exist and display plugin enable...
if self.stats == [] or args.disable_process:
if not self.stats or args.disable_process:
return ret
# Compute the sort key
......
......@@ -125,7 +125,7 @@ class Plugin(GlancesPlugin):
ret = []
# Only process if stats exist and display plugin enable...
if self.stats == [] or args.disable_sensors:
if not self.stats or args.disable_sensors:
return ret
# Build the string message
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册