Code Duplication    Length = 23-23 lines in 2 locations

glances/plugins/network/__init__.py 1 location

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

glances/plugins/diskio/__init__.py 1 location

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