Code Duplication    Length = 21-21 lines in 2 locations

glances/plugins/glances_network.py 1 location

@@ 54-74 (lines=21) @@
51
    stats is a list
52
    """
53
54
    def __init__(self, args=None, config=None):
55
        """Init the plugin."""
56
        super(Plugin, self).__init__(args=args,
57
                                     config=config,
58
                                     items_history_list=items_history_list,
59
                                     stats_init_value=[])
60
61
        # We want to display the stat in the curse interface
62
        self.display_curse = True
63
64
        # Hide stats if it has never been != 0
65
        if config is not None:
66
            self.hide_zero = config.get_bool_value(
67
                self.plugin_name, 'hide_zero', default=False)
68
        else:
69
            self.hide_zero = False
70
        self.hide_zero_fields = ['rx', 'tx']
71
72
        # Force a first update because we need two update to have the first stat
73
        self.update()
74
        self.refresh_timer.set(0)
75
76
    def get_key(self):
77
        """Return the key of the list."""

glances/plugins/glances_diskio.py 1 location

@@ 46-66 (lines=21) @@
43
    stats is a list
44
    """
45
46
    def __init__(self, args=None, config=None):
47
        """Init the plugin."""
48
        super(Plugin, self).__init__(args=args,
49
                                     config=config,
50
                                     items_history_list=items_history_list,
51
                                     stats_init_value=[])
52
53
        # We want to display the stat in the curse interface
54
        self.display_curse = True
55
56
        # Hide stats if it has never been != 0
57
        if config is not None:
58
            self.hide_zero = config.get_bool_value(
59
                self.plugin_name, 'hide_zero', default=False)
60
        else:
61
            self.hide_zero = False
62
        self.hide_zero_fields = ['read_bytes', 'write_bytes']
63
64
        # Force a first update because we need two update to have the first stat
65
        self.update()
66
        self.refresh_timer.set(0)
67
68
    def get_key(self):
69
        """Return the key of the list."""