mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +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):
|
class Roof(TypedDict, total=False):
|
||||||
construction: int # TODO: map to str
|
construction: int # TODO: map to str
|
||||||
insulation_location: int # TODO: map to str
|
insulation_location: int # TODO: map to str
|
||||||
insulation_thickness_mm: float
|
insulation_thickness_mm: float | str
|
||||||
|
|
||||||
|
|
||||||
class BuildingPart(TypedDict):
|
class BuildingPart(TypedDict):
|
||||||
|
|
@ -55,10 +55,14 @@ def _parse_int(value: Optional[str], field: str) -> int:
|
||||||
return int(value)
|
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:
|
if value is None:
|
||||||
return 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:
|
def parse_rdsap(xml_string: str) -> SapPropertyDetails:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue