Map nan values to None (#458)
Publish Python Package / test (push) Has been cancelled
Publish Python Package / Build and Publish Python Package (push) Has been cancelled

This commit is contained in:
Jedd Morgan
2025-10-02 13:21:04 +01:00
committed by GitHub
parent e4453f0b04
commit af42b09dd5
+5
View File
@@ -1,3 +1,4 @@
import math
from typing import Any, Tuple
from ifcopenshell.entity_instance import entity_instance
@@ -134,6 +135,10 @@ def _get_quantities(
value = getattr(quantity, quantity.attribute_name(3))
unit_info = _get_unit_info(element, quantity)
# Server does not consider `NaN` valid json
if math.isnan(value):
value = None
if unit_info:
# Create structured quantity object with units
results[quantity_name] = {