refactor(outputs): drop the empty except in the sanitiser

This commit is contained in:
pedrooot
2026-10-07 17:45:44 +02:00
parent cb107696d0
commit c1f8bd74b5
+6 -5
View File
@@ -211,10 +211,11 @@ def sanitize_csv_value(value):
):
return value
try:
# float() also accepts nan/inf and padded forms, which a spreadsheet
# renders as text, so only a finite number is left untouched
if isfinite(float(value)) and value == value.strip():
return value
number = float(value)
except ValueError:
pass
return f"'{value}"
# float() also accepts nan/inf and whitespace-padded forms, which a spreadsheet
# renders as text rather than as a number
if isfinite(number) and value == value.strip():
return value
return f"'{value}"