Code Duplication    Length = 13-14 lines in 3 locations

glances/plugins/glances_sensors.py 1 location

@@ 156-169 (lines=14) @@
153
154
        return stats
155
156
    def update_views(self):
157
        """Update stats views."""
158
        # Call the father's method
159
        super(Plugin, self).update_views()
160
161
        # Add specifics informations
162
        # Alert
163
        for i in self.stats:
164
            if not i['value']:
165
                continue
166
            if i['type'] == 'battery':
167
                self.views[i[self.get_key()]]['value']['decoration'] = self.get_alert(100 - i['value'], header=i['type'])
168
            else:
169
                self.views[i[self.get_key()]]['value']['decoration'] = self.get_alert(i['value'], header=i['type'])
170
171
    def msg_curse(self, args=None):
172
        """Return the dict to display in the curse interface."""

glances/plugins/glances_network.py 1 location

@@ 217-229 (lines=13) @@
214
215
        # Update the history list
216
        self.update_stats_history(self.get_key())
217
218
        # Update the view
219
        self.update_views()
220
221
        return self.stats
222
223
    def update_views(self):
224
        """Update stats views."""
225
        # Call the father's method
226
        super(Plugin, self).update_views()
227
228
        # Add specifics informations
229
        # Alert
230
        for i in self.stats:
231
            ifrealname = i['interface_name'].split(':')[0]
232
            self.views[i[self.get_key()]]['rx']['decoration'] = self.get_alert(int(i['rx'] // i['time_since_update'] * 8),

glances/plugins/glances_diskio.py 1 location

@@ 143-155 (lines=13) @@
140
            # Update stats using SNMP
141
            # No standard way for the moment...
142
            pass
143
144
        # Update the history list
145
        self.update_stats_history('disk_name')
146
147
        # Update the view
148
        self.update_views()
149
150
        return self.stats
151
152
    def update_views(self):
153
        """Update stats views."""
154
        # Call the father's method
155
        super(Plugin, self).update_views()
156
157
        # Add specifics informations
158
        # Alert