Skip to content

Commit

Permalink
autoformat: isort & black
Browse files Browse the repository at this point in the history
  • Loading branch information
veenstrajelmer committed Jul 31, 2024
1 parent 55ea92a commit 2553b2d
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 16 deletions.
1 change: 1 addition & 0 deletions hydrolib/core/basemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
also represents a file on disk.
"""

import logging
import shutil
from abc import ABC, abstractclassmethod, abstractmethod
Expand Down
1 change: 1 addition & 0 deletions hydrolib/core/dflowfm/bc/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
AstronomicCorrection, Constant, T3D.
"""

import logging
import re
from pathlib import Path
Expand Down
1 change: 0 additions & 1 deletion hydrolib/core/dflowfm/extold/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def serialize(
config: SerializerConfig,
save_settings: ModelSaveSettings,
) -> None:

"""
Serialize the given data and write it to a file at the given path.
Expand Down
2 changes: 2 additions & 0 deletions hydrolib/core/dflowfm/gui/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
namespace for storing the branches as branches.gui file
"""

# TODO reconsider the definition and/or filename of the branches.gui (from Prisca)

import logging
Expand All @@ -14,6 +15,7 @@

logger = logging.getLogger(__name__)


# FIXME: GUI does not recongnize this section yet
class BranchGeneral(INIGeneral):
"""The branches.gui file's `[General]` section with file meta data."""
Expand Down
2 changes: 1 addition & 1 deletion hydrolib/core/dflowfm/ini/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def feed_line(self, line: str) -> None:
line (str): The line to parse
"""
if not self._is_empty_line(line):
for (is_line_type, handle_line_type) in self._feed_line[self._state]:
for is_line_type, handle_line_type in self._feed_line[self._state]:
if is_line_type(line):
handle_line_type(line)
break
Expand Down
1 change: 1 addition & 0 deletions hydrolib/core/dflowfm/ini/util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""util.py provides additional utility methods related to handling ini files.
"""

from datetime import datetime
from enum import Enum
from operator import eq
Expand Down
6 changes: 3 additions & 3 deletions hydrolib/core/dflowfm/obs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class ObservationPoint(INIBasedModel):

class Comments(INIBasedModel.Comments):
name: Optional[str] = "Name of the observation point (max. 255 characters)."
locationtype: Optional[
str
] = "Only when x and y are also specified. 1d: snap to closest 1D grid point, 2d: snap to closest 2D grid cell centre, all: snap to closest 1D or 2D point."
locationtype: Optional[str] = (
"Only when x and y are also specified. 1d: snap to closest 1D grid point, 2d: snap to closest 2D grid cell centre, all: snap to closest 1D or 2D point."
)
branchid: Optional[str] = Field(
"Branch on which the observation point is located.", alias="branchId"
)
Expand Down
2 changes: 2 additions & 0 deletions hydrolib/core/dflowfm/structure/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
structure namespace for storing the contents of an [FMModel][hydrolib.core.dflowfm.mdu.models.FMModel]'s structure file.
"""

# TODO Implement the following structures
# - Gate

Expand Down Expand Up @@ -35,6 +36,7 @@

ForcingData = Union[float, TimModel, ForcingModel]


# TODO: handle comment blocks
# TODO: handle duplicate keys
class Structure(INIBasedModel):
Expand Down
16 changes: 8 additions & 8 deletions hydrolib/core/rr/meteo/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ def serialize(event_data: Dict, config: SerializerConfig) -> str:
**event_data,
**BuiEventSerializer.get_timedelta_fields(ts_duration),
}
event_data[
"timeseries_length"
] = BuiEventSerializer.serialize_timeseries_length(
event_data["timeseries_length"]
event_data["timeseries_length"] = (
BuiEventSerializer.serialize_timeseries_length(
event_data["timeseries_length"]
)
)
event_data[
"precipitation_per_timestep"
] = BuiEventSerializer.serialize_precipitation_per_timestep(
event_data["precipitation_per_timestep"], config
event_data["precipitation_per_timestep"] = (
BuiEventSerializer.serialize_precipitation_per_timestep(
event_data["precipitation_per_timestep"], config
)
)
if "event_idx" not in event_data.keys():
event_data["event_idx"] = 1
Expand Down
4 changes: 3 additions & 1 deletion tests/dflowfm/test_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ class TestLateral:
"""Class to test all methods contained in the
hydrolib.core.dflowfm.ext.models.Lateral class"""

location_error: str = "nodeId or branchId and chainage or xCoordinates, yCoordinates and numCoordinates should be provided"
location_error: str = (
"nodeId or branchId and chainage or xCoordinates, yCoordinates and numCoordinates should be provided"
)

class TestValidateCoordinates:
"""
Expand Down
3 changes: 2 additions & 1 deletion tests/dflowfm/test_mdu.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ def _get_expected_observationcrosssections(self):
`tests/data/input/obscrsfile_cases/ObservationPoints_crs.ini`.
Returns:
[ObservationCrossSection]: the objects contained in the fully loaded obs_crs.ini file."""
[ObservationCrossSection]: the objects contained in the fully loaded obs_crs.ini file.
"""

objects = [
ObservationCrossSection(
Expand Down
2 changes: 1 addition & 1 deletion tests/dflowfm/test_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1882,7 +1882,7 @@ def test_create_a_pump_with_missing_list(self, listname: str, lengthname: int):
correctlist = list(range(correctlength))
listargs = {key: correctlist for (key, _) in self._pumplists}
listargs.pop(listname) # Remove one list argument
for (_, _lengthname) in self._pumplists:
for _, _lengthname in self._pumplists:
listargs[_lengthname] = correctlength
listargs["controlside"] = "both"

Expand Down

0 comments on commit 2553b2d

Please sign in to comment.