mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-01 14:08:34 +03:00
Don't construct empty lists in tests
This commit is contained in:
parent
59fc36e334
commit
7cf0a31997
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user