mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
insulation thickness can be string 🟩
This commit is contained in:
parent
160dec11b1
commit
2dd9b9ce84
1 changed files with 7 additions and 3 deletions
|
|
@ -17,7 +17,7 @@ class Floor(TypedDict):
|
|||
class Roof(TypedDict, total=False):
|
||||
construction: int # TODO: map to str
|
||||
insulation_location: int # TODO: map to str
|
||||
insulation_thickness_mm: float
|
||||
insulation_thickness_mm: float | str
|
||||
|
||||
|
||||
class BuildingPart(TypedDict):
|
||||
|
|
@ -55,10 +55,14 @@ def _parse_int(value: Optional[str], field: str) -> int:
|
|||
return int(value)
|
||||
|
||||
|
||||
def _parse_thickness_mm(value: Optional[str]) -> Optional[float]:
|
||||
def _parse_thickness_mm(value: Optional[str]) -> Optional[float | str]:
|
||||
if value is None:
|
||||
return None
|
||||
return float(value.replace("mm", "").strip())
|
||||
stripped = value.replace("mm", "").strip()
|
||||
try:
|
||||
return float(stripped)
|
||||
except ValueError:
|
||||
return stripped
|
||||
|
||||
|
||||
def parse_rdsap(xml_string: str) -> SapPropertyDetails:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue