Skip to content

Commit

Permalink
Remove lock count (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
dladrichem authored Apr 9, 2024
1 parent 5dca547 commit 675d9a7
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 44 deletions.
10 changes: 1 addition & 9 deletions flood_adapt/object_model/interface/benefits.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Any, Optional, Union

import pandas as pd
from pydantic import BaseModel, validator
from pydantic import BaseModel


class CurrentSituationModel(BaseModel):
Expand All @@ -16,7 +16,6 @@ class BenefitModel(BaseModel):

name: str
description: Optional[str] = ""
lock_count: int = 0
strategy: str
event_set: str
projection: str
Expand All @@ -27,13 +26,6 @@ class BenefitModel(BaseModel):
implementation_cost: Optional[float] = None
annual_maint_cost: Optional[float] = None

@validator("lock_count")
def validate_lock_count(cls, lock_count: int) -> int:
"""Validate lock_count"""
if lock_count < 0:
raise ValueError("lock_count must be a positive integer")
return lock_count


class IBenefit(ABC):
attrs: BenefitModel
Expand Down
8 changes: 0 additions & 8 deletions flood_adapt/object_model/interface/measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,8 @@ class MeasureModel(BaseModel):

name: str = Field(..., min_length=1)
description: Optional[str] = ""
lock_count: int = 0
type: Union[HazardType, ImpactType]

@validator("lock_count")
def validate_lock_count(cls, lock_count: int) -> int:
"""Validate lock_count"""
if lock_count < 0:
raise ValueError("lock_count must be a positive integer")
return lock_count


class HazardMeasureModel(MeasureModel):
"""BaseModel describing the expected variables and data types of attributes common to all impact measures"""
Expand Down
10 changes: 1 addition & 9 deletions flood_adapt/object_model/interface/projections.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from abc import ABC, abstractmethod
from typing import Any, Optional, Union

from pydantic import BaseModel, validator
from pydantic import BaseModel

from flood_adapt.object_model.io.unitfulvalue import (
UnitfulLength,
Expand Down Expand Up @@ -34,17 +34,9 @@ class SocioEconomicChangeModel(BaseModel):
class ProjectionModel(BaseModel):
name: str
description: Optional[str] = ""
lock_count: int = 0
physical_projection: PhysicalProjectionModel
socio_economic_change: SocioEconomicChangeModel

@validator("lock_count")
def validate_lock_count(cls, lock_count: int) -> int:
"""Validate lock_count"""
if lock_count < 0:
raise ValueError("lock_count must be a positive integer")
return lock_count


class IProjection(ABC):
attrs: ProjectionModel
Expand Down
10 changes: 1 addition & 9 deletions flood_adapt/object_model/interface/scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,18 @@
from abc import ABC, abstractmethod
from typing import Any, Optional, Union

from pydantic import BaseModel, validator
from pydantic import BaseModel


class ScenarioModel(BaseModel):
"""BaseModel describing the expected variables and data types of a scenario"""

name: str
description: Optional[str] = ""
lock_count: int = 0
event: str
projection: str
strategy: str

@validator("lock_count")
def validate_lock_count(cls, lock_count: int) -> int:
"""Validate lock_count"""
if lock_count < 0:
raise ValueError("lock_count must be a positive integer")
return lock_count


class IScenario(ABC):
attrs: ScenarioModel
Expand Down
10 changes: 1 addition & 9 deletions flood_adapt/object_model/interface/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,14 @@
from abc import ABC, abstractmethod
from typing import Any, Optional, Union

from pydantic import BaseModel, validator
from pydantic import BaseModel


class StrategyModel(BaseModel):
name: str
description: Optional[str] = ""
lock_count: int = 0
measures: Optional[list[str]] = []

@validator("lock_count")
def validate_lock_count(cls, lock_count: int) -> int:
"""Validate lock_count"""
if lock_count < 0:
raise ValueError("lock_count must be a positive integer")
return lock_count


class IStrategy(ABC):
attrs: StrategyModel
Expand Down

0 comments on commit 675d9a7

Please sign in to comment.