Edit parsing again
This commit is contained in:
@ -777,12 +777,12 @@ class SystemHealthMonitor:
|
||||
return False
|
||||
|
||||
def _parse_size(self, size_str: str) -> float:
|
||||
"""Parse size string with units to float value"""
|
||||
"""Parse size string with units to bytes"""
|
||||
if not size_str:
|
||||
return 0.0
|
||||
|
||||
# Handle M/G/T sizes with potential decimal points
|
||||
match = re.match(r'([\d.]+)([KMGT])', size_str.strip())
|
||||
# Handle decimal numbers with units (like 192.2M, 3.5G)
|
||||
match = re.match(r'([\d.]+)\s*([KMGT])', size_str.strip())
|
||||
if match:
|
||||
value = float(match.group(1))
|
||||
unit = match.group(2)
|
||||
@ -793,14 +793,14 @@ class SystemHealthMonitor:
|
||||
'T': 1024**4
|
||||
}
|
||||
return value * multipliers[unit]
|
||||
|
||||
# Try parsing as plain number
|
||||
|
||||
# Remove any non-numeric characters and try parsing
|
||||
cleaned = ''.join(c for c in size_str if c.isdigit() or c == '.')
|
||||
try:
|
||||
return float(size_str)
|
||||
return float(cleaned)
|
||||
except ValueError:
|
||||
return 0.0
|
||||
|
||||
|
||||
def _is_physical_disk(self, device_path):
|
||||
"""
|
||||
Check if the device is a physical disk, excluding logical volumes and special devices.
|
||||
|
||||
Reference in New Issue
Block a user