Skip to content

Commit

Permalink
feat(pydantic_v2): Migrate to Pydantic to v2
Browse files Browse the repository at this point in the history
== BREAKING CHANGE==
- Change all validation syntax to comply with Pydantic-v2
- New validation syntax is NOT compatible with Pydantic-v1
- Format `isort`, `black`
- Update all test
  • Loading branch information
ed-p-may committed Jun 4, 2024
1 parent 1f1baac commit 0ffbc84
Show file tree
Hide file tree
Showing 28 changed files with 9,708 additions and 9,569 deletions.
20 changes: 10 additions & 10 deletions PHX/PHPP/phpp_localization/shape_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

from typing import Dict, Optional

from pydantic import BaseModel
from pydantic.main import BaseModel

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


class InputItem(BaseModel):
column: Optional[str]
row: Optional[int]
unit: Optional[str]
column: Optional[str] = None
row: Optional[int] = None
unit: Optional[str] = None

@property
def xl_range(self) -> str:
Expand All @@ -28,8 +28,8 @@ class VerificationInputItem(BaseModel):
locator_string: str
input_column: str
input_row_offset: int
options: Optional[Dict]
unit: Optional[str]
options: Optional[Dict] = None
unit: Optional[str] = None


class Verification(BaseModel):
Expand Down Expand Up @@ -182,8 +182,8 @@ class Climate(BaseModel):
name: str
active_dataset: ClimateActiveDataset
ud_block: ClimateUDBlock
named_ranges: Optional[ClimateNamedRanges]
defined_ranges: Optional[ClimateDefinedRanges]
named_ranges: Optional[ClimateNamedRanges] = None
defined_ranges: Optional[ClimateDefinedRanges] = None


# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -502,7 +502,7 @@ class VentilationInputItem(BaseModel):
locator_col: str
locator_string: str
input_column: str
unit: Optional[str]
unit: Optional[str] = None


class Ventilation(BaseModel):
Expand Down Expand Up @@ -985,7 +985,7 @@ class PerAddresses(BaseModel):
class PerDataBlock(BaseModel):
locator_string_heading: str
locator_string_start: str
locator_string_end: Optional[str]
locator_string_end: Optional[str] = None


class PerNamedRanges(BaseModel):
Expand Down
Loading

0 comments on commit 0ffbc84

Please sign in to comment.