'Update the FS stats using the input method.'

@GlancesPlugin._check_decorator
@GlancesPlugin._log_result_decorator
def update(self):

    self.reset()
    if (self.input_method == 'local'):
        try:
            fs_stat = psutil.disk_partitions(all=False)
        except UnicodeDecodeError:
            return self.stats
        for fstype in self.get_conf_value('allow'):
            try:
                fs_stat += [f for f in psutil.disk_partitions(all=True) if (f.fstype.find(fstype) >= 0)]
            except UnicodeDecodeError:
                return self.stats
        for fs in fs_stat:
            if self.is_hide(fs.mountpoint):
                continue
            try:
                fs_usage = psutil.disk_usage(fs.mountpoint)
            except OSError:
                continue
            fs_current = {'device_name': fs.device, 'fs_type': fs.fstype, 'mnt_point': fs.mountpoint.replace(u'\xa0', '    '), 'size': fs_usage.total, 'used': fs_usage.used, 'free': fs_usage.free, 'percent': fs_usage.percent, 'key': self.get_key()}
            self.stats.append(fs_current)
    elif (self.input_method == 'snmp'):
        try:
            fs_stat = self.get_stats_snmp(snmp_oid=snmp_oid[self.short_system_name], bulk=True)
        except KeyError:
            fs_stat = self.get_stats_snmp(snmp_oid=snmp_oid['default'], bulk=True)
        if (self.short_system_name in ('windows', 'esxi')):
            for fs in fs_stat:
                if ((fs == 'Virtual    Memory') or (fs == 'Physical    Memory') or (fs == 'Real    Memory')):
                    continue
                size = (int(fs_stat[fs]['size']) * int(fs_stat[fs]['alloc_unit']))
                used = (int(fs_stat[fs]['used']) * int(fs_stat[fs]['alloc_unit']))
                percent = float(((used * 100) / size))
                fs_current = {'device_name': '', 'mnt_point': fs.partition('    ')[0], 'size': size, 'used': used, 'percent': percent, 'key': self.get_key()}
                self.stats.append(fs_current)
        else:
            for fs in fs_stat:
                fs_current = {'device_name': fs_stat[fs]['device_name'], 'mnt_point': fs, 'size': (int(fs_stat[fs]['size']) * 1024), 'used': (int(fs_stat[fs]['used']) * 1024), 'percent': float(fs_stat[fs]['percent']), 'key': self.get_key()}
                self.stats.append(fs_current)
    return self.stats
