Edit parsing again
This commit is contained in:
@ -777,12 +777,12 @@ class SystemHealthMonitor:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def _parse_size(self, size_str: str) -> float:
|
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:
|
if not size_str:
|
||||||
return 0.0
|
return 0.0
|
||||||
|
|
||||||
# Handle M/G/T sizes with potential decimal points
|
# Handle decimal numbers with units (like 192.2M, 3.5G)
|
||||||
match = re.match(r'([\d.]+)([KMGT])', size_str.strip())
|
match = re.match(r'([\d.]+)\s*([KMGT])', size_str.strip())
|
||||||
if match:
|
if match:
|
||||||
value = float(match.group(1))
|
value = float(match.group(1))
|
||||||
unit = match.group(2)
|
unit = match.group(2)
|
||||||
@ -794,13 +794,13 @@ class SystemHealthMonitor:
|
|||||||
}
|
}
|
||||||
return value * multipliers[unit]
|
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:
|
try:
|
||||||
return float(size_str)
|
return float(cleaned)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
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