提交 1b3bff25 编写于 作者: A Alessio Sergi

Use 'not' to test for empty sets

Empty sets evaluate to False.
上级 ec44cfe1
......@@ -166,7 +166,7 @@ class Plugin(GlancesPlugin):
ret = []
# Only process if stats exist...
if self.stats == {}:
if not self.stats:
return ret
# Build the string message
......
......@@ -214,7 +214,7 @@ class Plugin(GlancesPlugin):
ret = []
# Only process if stats exist (and non null) and display plugin enable...
if self.stats == {} or args.disable_docker or len(self.stats['containers']) == 0:
if not self.stats or args.disable_docker or len(self.stats['containers']) == 0:
return ret
# Build the string message
......
......@@ -137,7 +137,7 @@ class Plugin(GlancesPlugin):
ret = []
# Only process if stats exist...
if self.stats == {}:
if not self.stats:
return ret
# Build the string message
......
......@@ -179,7 +179,7 @@ class Plugin(GlancesPlugin):
ret = []
# Only process if stats exist...
if self.stats == {}:
if not self.stats:
return ret
# Build the string message
......
......@@ -150,7 +150,7 @@ class Plugin(GlancesPlugin):
ret = []
# Only process if stats exist...
if self.stats == {}:
if not self.stats:
return ret
# Build the string message
......
......@@ -77,7 +77,7 @@ class Plugin(GlancesPlugin):
ret.append(self.curse_add_line(msg))
return ret
if self.stats == {}:
if not self.stats:
return ret
# Display the filter (if it exists)
......
......@@ -87,7 +87,7 @@ class Plugin(GlancesPlugin):
ret = []
# Only process if stats exist...
if self.stats == {} or args.disable_quicklook:
if not self.stats or args.disable_quicklook:
return ret
# Define the bar
......
......@@ -156,7 +156,7 @@ class Plugin(GlancesPlugin):
# Add specifics informations
# Alert
for i in self.stats:
if i['value'] == []:
if not i['value']:
continue
if i['type'] == 'battery':
self.views[i[self.get_key()]]['value']['decoration'] = self.get_alert(100 - i['value'], header=i['type'])
......@@ -169,7 +169,7 @@ class Plugin(GlancesPlugin):
ret = []
# Only process if stats exist and display plugin enable...
if not self.stats or args.disable_sensors or self.stats == []:
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.
先完成此消息的编辑!
想要评论请 注册