adjust regex
This commit is contained in:
@ -785,7 +785,8 @@ class SystemHealthMonitor:
|
|||||||
|
|
||||||
size_str = size_str.strip().upper()
|
size_str = size_str.strip().upper()
|
||||||
|
|
||||||
match = re.match(r'^([\d.]+)\s*([KMGT])B?$', size_str)
|
# Match size with optional decimal and unit
|
||||||
|
match = re.match(r'^([\d.]+)\s*([KMGT]B?)?$', size_str)
|
||||||
if match:
|
if match:
|
||||||
value = float(match.group(1))
|
value = float(match.group(1))
|
||||||
unit = match.group(2)
|
unit = match.group(2)
|
||||||
@ -794,13 +795,18 @@ class SystemHealthMonitor:
|
|||||||
'K': 1024,
|
'K': 1024,
|
||||||
'M': 1024**2,
|
'M': 1024**2,
|
||||||
'G': 1024**3,
|
'G': 1024**3,
|
||||||
'T': 1024**4
|
'T': 1024**4,
|
||||||
|
'KB': 1024,
|
||||||
|
'MB': 1024**2,
|
||||||
|
'GB': 1024**3,
|
||||||
|
'TB': 1024**4
|
||||||
}
|
}
|
||||||
|
|
||||||
return value * multipliers.get(unit, 1) # Default to 1 for bytes
|
return value * multipliers.get(unit, 1) # Default to 1 for bytes
|
||||||
|
|
||||||
return 0.0
|
return 0.0
|
||||||
|
|
||||||
|
|
||||||
def _is_physical_disk(self, device_path):
|
def _is_physical_disk(self, device_path):
|
||||||
"""
|
"""
|
||||||
Check if the device is a physical disk, excluding logical volumes and special devices.
|
Check if the device is a physical disk, excluding logical volumes and special devices.
|
||||||
|
|||||||
Reference in New Issue
Block a user