Code Duplication    Length = 22-23 lines in 2 locations

glances/plugins/network/__init__.py 1 location

@@ 73-95 (lines=23) @@
70
    stats is a list
71
    """
72
73
    def __init__(self, args=None, config=None):
74
        """Init the plugin."""
75
        super(PluginModel, self).__init__(
76
            args=args,
77
            config=config,
78
            items_history_list=items_history_list,
79
            fields_description=fields_description,
80
            stats_init_value=[],
81
        )
82
83
        # We want to display the stat in the curse interface
84
        self.display_curse = True
85
86
        # Hide stats if it has never been != 0
87
        if config is not None:
88
            self.hide_zero = config.get_bool_value(self.plugin_name, 'hide_zero', default=False)
89
        else:
90
            self.hide_zero = False
91
        self.hide_zero_fields = ['bytes_recv', 'bytes_sent']
92
93
        # Force a first update because we need two updates to have the first stat
94
        self.update()
95
        self.refresh_timer.set(0)
96
97
    def get_key(self):
98
        """Return the key of the list."""

glances/plugins/diskio/__init__.py 1 location

@@ 62-83 (lines=22) @@
59
    stats is a list
60
    """
61
62
    def __init__(self, args=None, config=None):
63
        """Init the plugin."""
64
        super(PluginModel, self).__init__(
65
            args=args,
66
            config=config,
67
            items_history_list=items_history_list,
68
            stats_init_value=[],
69
            fields_description=fields_description,
70
        )
71
72
        # We want to display the stat in the curse interface
73
        self.display_curse = True
74
75
        # Hide stats if it has never been != 0
76
        if config is not None:
77
            self.hide_zero = config.get_bool_value(self.plugin_name, 'hide_zero', default=False)
78
        else:
79
            self.hide_zero = False
80
        self.hide_zero_fields = ['read_bytes', 'write_bytes']
81
82
        # Force a first update because we need two updates to have the first stat
83
        self.update()
84
        self.refresh_timer.set(0)
85
86
    def get_key(self):