Skip to content

Commit

Permalink
feat(pydantic): Roll back to Pydantic <2.0
Browse files Browse the repository at this point in the history
- rollback to pydantic v1
- format `isort`, `black`
  • Loading branch information
ed-p-may committed Jun 11, 2024
1 parent 7cf6e83 commit a0a30e6
Show file tree
Hide file tree
Showing 19 changed files with 10,945 additions and 10,958 deletions.
29 changes: 21 additions & 8 deletions PHX/PHPP/phpp_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,27 @@
from PHX.model.hvac.collection import NoDeviceFoundError
from PHX.PHPP import phpp_localization, sheet_io
from PHX.PHPP.phpp_localization.shape_model import PhppShape
from PHX.PHPP.phpp_model import (areas_data, areas_surface,
areas_thermal_bridges, climate_entry,
component_frame, component_glazing,
component_vent, electricity_item,
hot_water_piping, hot_water_tank,
shading_rows, uvalues_constructor, vent_ducts,
vent_space, vent_units, ventilation_data,
verification_data, version, windows_rows)
from PHX.PHPP.phpp_model import (
areas_data,
areas_surface,
areas_thermal_bridges,
climate_entry,
component_frame,
component_glazing,
component_vent,
electricity_item,
hot_water_piping,
hot_water_tank,
shading_rows,
uvalues_constructor,
vent_ducts,
vent_space,
vent_units,
ventilation_data,
verification_data,
version,
windows_rows,
)
from PHX.xl import xl_app
from PHX.xl.xl_typing import xl_Sheet_Protocol

Expand Down
23 changes: 8 additions & 15 deletions PHX/PHPP/phpp_localization/shape_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from typing import Dict, Optional

from pydantic.main import BaseModel
from pydantic import BaseModel

# -----------------------------------------------------------------------------

Expand Down Expand Up @@ -312,8 +312,7 @@ class Areas(BaseModel):
# -----------------------------------------------------------------------------


class ColGround(BaseModel):
...
class ColGround(BaseModel): ...


class Ground(BaseModel):
Expand Down Expand Up @@ -677,8 +676,7 @@ class CoolingPeakLoad(BaseModel):
# -----------------------------------------------------------------------------


class ColSummVent(BaseModel):
...
class ColSummVent(BaseModel): ...


class SummVent(BaseModel):
Expand Down Expand Up @@ -889,8 +887,7 @@ class Electricity(BaseModel):
# -----------------------------------------------------------------------------


class ColUseNonRes(BaseModel):
...
class ColUseNonRes(BaseModel): ...


class UseNonRes(BaseModel):
Expand Down Expand Up @@ -944,8 +941,7 @@ class ElecNonRes(BaseModel):
# -----------------------------------------------------------------------------


class ColIhgNonRes(BaseModel):
...
class ColIhgNonRes(BaseModel): ...


class IhgNonRes(BaseModel):
Expand All @@ -956,8 +952,7 @@ class IhgNonRes(BaseModel):
# -----------------------------------------------------------------------------


class ColAuxElec(BaseModel):
...
class ColAuxElec(BaseModel): ...


class AuxElec(BaseModel):
Expand Down Expand Up @@ -1017,17 +1012,15 @@ class Per(BaseModel):
# -----------------------------------------------------------------------------


class ColHp(BaseModel):
...
class ColHp(BaseModel): ...


class Hp(BaseModel):
name: str
columns: ColHp


class ColBoiler(BaseModel):
...
class ColBoiler(BaseModel): ...


class Boiler(BaseModel):
Expand Down
1 change: 0 additions & 1 deletion PHX/from_HBJSON/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ def _get_thermal_envelope_faces(_hb_room: room.Room, _all_room_ids: List[str]) -
--------
* (List[face.Face]) A List of all the thermal boundary faces.
"""

exposed_faces: List[face.Face] = []
for original_face in _hb_room.faces:
# -- If it is a Surface exposure, but the face's adjacent zone is NOT part of
Expand Down
4 changes: 2 additions & 2 deletions PHX/from_WUFI_XML/phx_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -1204,10 +1204,10 @@ def _PhxSiteEnergyFactors(_data: wufi_xml.WufiPH_ClimateLocation) -> PhxSiteEner
# If User-defined factors are used, they will be included in the XML file.
# So in that case, use those values for the PE and CO2 factors.
for name, factor in zip(_wufi_order, _data.PEFactorsUserDef or []):
phx_obj.pe_factors[name] = PhxPEFactor(factor.root, "kWh/kWh", name)
phx_obj.pe_factors[name] = PhxPEFactor(factor.__root__, "kWh/kWh", name)

for name, factor in zip(_wufi_order, _data.CO2FactorsUserDef or []):
phx_obj.co2_factors[name] = PhxCO2Factor(factor.root, "g/kWh", name)
phx_obj.co2_factors[name] = PhxCO2Factor(factor.__root__, "g/kWh", name)

return phx_obj

Expand Down
Loading

0 comments on commit a0a30e6

Please sign in to comment.