Skip to content

Commit

Permalink
Add new black version
Browse files Browse the repository at this point in the history
  • Loading branch information
dladrichem committed Feb 6, 2024
1 parent ac56bd2 commit 4cec458
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 124 deletions.
158 changes: 54 additions & 104 deletions flood_adapt/object_model/interface/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,211 +23,161 @@ class IDatabase(ABC):
site: ISite

@abstractmethod
def __init__(self, database_path: Union[str, os.PathLike], site_name: str) -> None:
...
def __init__(
self, database_path: Union[str, os.PathLike], site_name: str
) -> None: ...

@abstractmethod
def get_aggregation_areas(self) -> dict:
...
def get_aggregation_areas(self) -> dict: ...

@abstractmethod
def get_obs_points(self) -> GeoDataFrame:
...
def get_obs_points(self) -> GeoDataFrame: ...

@abstractmethod
def get_property_types(self) -> list:
...
def get_property_types(self) -> list: ...

@abstractmethod
def get_slr_scn_names(self) -> list:
...
def get_slr_scn_names(self) -> list: ...

@abstractmethod
def interp_slr(self, slr_scenario: str, year: float) -> float:
...
def interp_slr(self, slr_scenario: str, year: float) -> float: ...

@abstractmethod
def plot_slr_scenarios(self) -> str:
...
def plot_slr_scenarios(self) -> str: ...

@abstractmethod
def plot_wl(self, event: IEvent, input_wl_df: pd.DataFrame = None) -> str:
...
def plot_wl(self, event: IEvent, input_wl_df: pd.DataFrame = None) -> str: ...

@abstractmethod
def plot_river(self, event: IEvent, input_river_df: list[pd.DataFrame]) -> str:
...
def plot_river(self, event: IEvent, input_river_df: list[pd.DataFrame]) -> str: ...

@abstractmethod
def plot_rainfall(
self, event: IEvent, input_rainfall_df: pd.DataFrame = None
) -> str:
...
) -> str: ...

@abstractmethod
def plot_wind(self, event: IEvent, input_wind_df: pd.DataFrame = None) -> str:
...
def plot_wind(self, event: IEvent, input_wind_df: pd.DataFrame = None) -> str: ...

@abstractmethod
def get_buildings(self) -> GeoDataFrame:
...
def get_buildings(self) -> GeoDataFrame: ...

@abstractmethod
def get_projection(self, name: str) -> IProjection:
...
def get_projection(self, name: str) -> IProjection: ...

@abstractmethod
def save_projection(self, measure: IProjection) -> None:
...
def save_projection(self, measure: IProjection) -> None: ...

@abstractmethod
def edit_projection(self, measure: IProjection) -> None:
...
def edit_projection(self, measure: IProjection) -> None: ...

@abstractmethod
def delete_projection(self, name: str):
...
def delete_projection(self, name: str): ...

@abstractmethod
def copy_projection(self, old_name: str, new_name: str, new_description: str):
...
def copy_projection(self, old_name: str, new_name: str, new_description: str): ...

@abstractmethod
def get_event(self, name: str) -> IEvent:
...
def get_event(self, name: str) -> IEvent: ...

@abstractmethod
def save_event(self, measure: IEvent) -> None:
...
def save_event(self, measure: IEvent) -> None: ...

@abstractmethod
def write_to_csv(self, name: str, event: IEvent, df: pd.DataFrame) -> None:
...
def write_to_csv(self, name: str, event: IEvent, df: pd.DataFrame) -> None: ...

@abstractmethod
def write_cyc(self, event: IEvent, track: TropicalCyclone):
...
def write_cyc(self, event: IEvent, track: TropicalCyclone): ...

@abstractmethod
def edit_event(self, measure: IEvent) -> None:
...
def edit_event(self, measure: IEvent) -> None: ...

@abstractmethod
def delete_event(self, name: str):
...
def delete_event(self, name: str): ...

@abstractmethod
def copy_event(self, old_name: str, new_name: str, new_description: str):
...
def copy_event(self, old_name: str, new_name: str, new_description: str): ...

@abstractmethod
def get_measure(self, name: str) -> IMeasure:
...
def get_measure(self, name: str) -> IMeasure: ...

@abstractmethod
def save_measure(self, measure: IMeasure) -> None:
...
def save_measure(self, measure: IMeasure) -> None: ...

@abstractmethod
def edit_measure(self, measure: IMeasure):
...
def edit_measure(self, measure: IMeasure): ...

@abstractmethod
def delete_measure(self, name: str):
...
def delete_measure(self, name: str): ...

@abstractmethod
def copy_measure(self, old_name: str, new_name: str, new_description: str):
...
def copy_measure(self, old_name: str, new_name: str, new_description: str): ...

@abstractmethod
def get_strategy(self, name: str) -> IStrategy:
...
def get_strategy(self, name: str) -> IStrategy: ...

@abstractmethod
def save_strategy(self, measure: IStrategy) -> None:
...
def save_strategy(self, measure: IStrategy) -> None: ...

@abstractmethod
def delete_strategy(self, name: str):
...
def delete_strategy(self, name: str): ...

@abstractmethod
def get_scenario(self, name: str) -> IScenario:
...
def get_scenario(self, name: str) -> IScenario: ...

@abstractmethod
def save_scenario(self, measure: IScenario) -> None:
...
def save_scenario(self, measure: IScenario) -> None: ...

@abstractmethod
def edit_scenario(self, measure: IScenario) -> None:
...
def edit_scenario(self, measure: IScenario) -> None: ...

@abstractmethod
def delete_scenario(self, name: str):
...
def delete_scenario(self, name: str): ...

@abstractmethod
def get_benefit(self, name: str) -> IBenefit:
...
def get_benefit(self, name: str) -> IBenefit: ...

@abstractmethod
def save_benefit(self, benefit: IBenefit) -> None:
...
def save_benefit(self, benefit: IBenefit) -> None: ...

@abstractmethod
def edit_benefit(self, measure: IBenefit) -> None:
...
def edit_benefit(self, measure: IBenefit) -> None: ...

@abstractmethod
def delete_benefit(self, name: str) -> None:
...
def delete_benefit(self, name: str) -> None: ...

@abstractmethod
def check_benefit_scenarios(self, benefit: IBenefit) -> None:
...
def check_benefit_scenarios(self, benefit: IBenefit) -> None: ...

@abstractmethod
def create_benefit_scenarios(self, benefit: IBenefit) -> None:
...
def create_benefit_scenarios(self, benefit: IBenefit) -> None: ...

@abstractmethod
def run_benefit(self, benefit_name: Union[str, list[str]]) -> None:
...
def run_benefit(self, benefit_name: Union[str, list[str]]) -> None: ...

@abstractmethod
def get_model_boundary(self) -> dict[str, Any]:
...
def get_model_boundary(self) -> dict[str, Any]: ...

@abstractmethod
def get_projections(self) -> dict[str, Any]:
...
def get_projections(self) -> dict[str, Any]: ...

@abstractmethod
def get_events(self) -> dict[str, Any]:
...
def get_events(self) -> dict[str, Any]: ...

@abstractmethod
def get_measures(self) -> dict[str, Any]:
...
def get_measures(self) -> dict[str, Any]: ...

@abstractmethod
def get_strategies(self) -> dict[str, Any]:
...
def get_strategies(self) -> dict[str, Any]: ...

@abstractmethod
def get_scenarios(self) -> dict[str, Any]:
...
def get_scenarios(self) -> dict[str, Any]: ...

@abstractmethod
def get_benefits(self) -> dict[str, Any]:
...
def get_benefits(self) -> dict[str, Any]: ...

@abstractmethod
def get_outputs(self) -> dict[str, Any]:
...
def get_outputs(self) -> dict[str, Any]: ...

@abstractmethod
def run_scenario(self, scenario_name: Union[str, list[str]]) -> None:
...
def run_scenario(self, scenario_name: Union[str, list[str]]) -> None: ...
3 changes: 1 addition & 2 deletions flood_adapt/object_model/interface/scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,4 @@ def save(self, filepath: Union[str, os.PathLike]):
...

@abstractmethod
def run(self) -> None:
...
def run(self) -> None: ...
12 changes: 6 additions & 6 deletions flood_adapt/object_model/interface/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ class Obs_pointModel(BaseModel):

name: Union[int, str]
description: Optional[str] = ""
ID: Optional[
int
] = None # if the observation station is also a tide gauge, this ID should be the same as for obs_station
ID: Optional[int] = (
None # if the observation station is also a tide gauge, this ID should be the same as for obs_station
)
lat: float
lon: float

Expand Down Expand Up @@ -242,9 +242,9 @@ class SiteModel(BaseModel):
obs_point: Optional[list[Obs_pointModel]] = None
benefits: BenefitsModel
scs: Optional[SCSModel] = None # optional for the US to use SCS rainfall curves
standard_objects: Optional[
StandardObjectModel
] = StandardObjectModel() # optional for the US to use standard objects
standard_objects: Optional[StandardObjectModel] = (
StandardObjectModel()
) # optional for the US to use standard objects


class ISite(ABC):
Expand Down
24 changes: 12 additions & 12 deletions tests/test_integrator/test_hazard_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,16 +548,16 @@ def test_multiple_rivers(test_db: None):
# Overwrite river data of Event
test_scenario.direct_impacts.hazard.event.attrs.river[0].source = "constant"
test_scenario.direct_impacts.hazard.event.attrs.river[1].source = "shape"
test_scenario.direct_impacts.hazard.event.attrs.river[
0
].constant_discharge = UnitfulDischarge(value=2000.0, units="cfs")
test_scenario.direct_impacts.hazard.event.attrs.river[0].constant_discharge = (
UnitfulDischarge(value=2000.0, units="cfs")
)
test_scenario.direct_impacts.hazard.event.attrs.river[1].shape_type = "gaussian"
test_scenario.direct_impacts.hazard.event.attrs.river[
1
].base_discharge = UnitfulDischarge(value=1000.0, units="cfs")
test_scenario.direct_impacts.hazard.event.attrs.river[
1
].shape_peak = UnitfulDischarge(value=2500.0, units="cfs")
test_scenario.direct_impacts.hazard.event.attrs.river[1].base_discharge = (
UnitfulDischarge(value=1000.0, units="cfs")
)
test_scenario.direct_impacts.hazard.event.attrs.river[1].shape_peak = (
UnitfulDischarge(value=2500.0, units="cfs")
)
test_scenario.direct_impacts.hazard.event.attrs.river[1].shape_duration = 8
test_scenario.direct_impacts.hazard.event.attrs.river[1].shape_peak_time = 0

Expand All @@ -576,9 +576,9 @@ def test_multiple_rivers(test_db: None):
test_scenario.direct_impacts.hazard.site.attrs.river[1].name = name
test_scenario.direct_impacts.hazard.site.attrs.river[1].x_coordinate = x
test_scenario.direct_impacts.hazard.site.attrs.river[1].y_coordinate = y
test_scenario.direct_impacts.hazard.site.attrs.river[
1
].mean_discharge = UnitfulDischarge(value=mean_discharge, units="cfs")
test_scenario.direct_impacts.hazard.site.attrs.river[1].mean_discharge = (
UnitfulDischarge(value=mean_discharge, units="cfs")
)
test_scenario.direct_impacts.hazard.site.attrs.river[1].description = description

# Change name of reference model
Expand Down

0 comments on commit 4cec458

Please sign in to comment.