Skip to content

Commit

Permalink
Fix mypy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Hofer-Julian committed Mar 13, 2024
1 parent 6281c30 commit 5d5bd8b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion python/ribasim/ribasim/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def add(self, node: Node, tables: Sequence[TableModel[Any]] | None = None) -> No
node_type=self.__class__.__name__,
)
self.node.df = (
node_table # type: ignore
node_table
if self.node.df is None
else pd.concat([self.node.df, node_table])
)
Expand Down
2 changes: 1 addition & 1 deletion python/ribasim/ribasim/geometry/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def add(
if self.df is None:
self.df = table_to_append
else:
self.df = pd.concat([self.df, table_to_append]) # type: ignore
self.df = pd.concat([self.df, table_to_append])

def get_where_edge_type(self, edge_type: str) -> NDArray[np.bool_]:
assert self.df is not None
Expand Down
7 changes: 3 additions & 4 deletions python/ribasim/ribasim/input_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,9 @@ def _write_table(self, path: FilePath) -> None:
----------
path : FilePath
"""

gdf = gpd.GeoDataFrame(data=self.df)
gdf = gdf.set_geometry("geometry")
gdf.to_file(path, layer=self.tablename(), driver="GPKG", mode="a")
if self.df is None:
return

Check warning on line 365 in python/ribasim/ribasim/input_base.py

View check run for this annotation

Codecov / codecov/patch

python/ribasim/ribasim/input_base.py#L365

Added line #L365 was not covered by tests
self.df.to_file(path, layer=self.tablename(), driver="GPKG", mode="a")

def sort(self):
if self.df is not None:
Expand Down

0 comments on commit 5d5bd8b

Please sign in to comment.