Code Duplication    Length = 11-11 lines in 2 locations

glances/plugins/glances_cpu.py 2 locations

@@ 213-223 (lines=11) @@
210
            if key in self.stats:
211
                self.views[key]['decoration'] = self.get_alert(self.stats[key], maximum=100 * self.stats['cpucore'], header=key)
212
        # Optional
213
        for key in ['nice', 'irq', 'iowait', 'steal', 'ctx_switches', 'interrupts', 'soft_interrupts', 'syscalls']:
214
            if key in self.stats:
215
                self.views[key]['optional'] = True
216
217
    def msg_curse(self, args=None):
218
        """Return the list to display in the UI."""
219
        # Init the return message
220
        ret = []
221
222
        # Only process if stats exist and plugin not disable
223
        if not self.stats or self.is_disable():
224
            return ret
225
226
        # Build the string message
@@ 193-203 (lines=11) @@
190
            for key in iterkeys(self.stats):
191
                self.stats[key] = float(self.stats[key])
192
            self.stats['total'] = 100 - self.stats['idle']
193
194
    def update_views(self):
195
        """Update stats views."""
196
        # Call the father's method
197
        super(Plugin, self).update_views()
198
199
        # Add specifics informations
200
        # Alert and log
201
        for key in ['user', 'system', 'iowait']:
202
            if key in self.stats:
203
                self.views[key]['decoration'] = self.get_alert_log(self.stats[key], header=key)
204
        # Alert only
205
        for key in ['steal', 'total']:
206
            if key in self.stats: