Skip to content

Commit adced28

Browse files
committed
Apply review comments
1 parent db17dde commit adced28

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

imod/mf6/model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pathlib
77
import warnings
88
from pathlib import Path
9-
from typing import Any, List, Optional, Tuple, Union, cast
9+
from typing import Any, List, Optional, Tuple, Union
1010

1111
import cftime
1212
import jinja2
@@ -568,8 +568,8 @@ def _write(
568568
globaltimes=globaltimes,
569569
write_context=pkg_write_context,
570570
)
571-
elif issubclass(type(pkg), imod.mf6.HorizontalFlowBarrierBase):
572-
mf6_hfb_ls.append(cast(HorizontalFlowBarrierBase, pkg))
571+
elif isinstance(pkg, imod.mf6.HorizontalFlowBarrierBase):
572+
mf6_hfb_ls.append(pkg)
573573
else:
574574
pkg._write(
575575
pkgname=pkg_name,

imod/msw/model.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,7 @@ def _write_simulation_settings(self, directory: Path) -> None:
317317

318318
# Add IdfMapping settings
319319
idf_key = self.get_pkgkey(IdfMapping)
320-
if idf_key is None:
321-
raise ValueError("No IdfMapping package found in model")
322-
idf_pkg = cast(IdfMapping, self[idf_key])
320+
idf_pkg = cast(IdfMapping, self[idf_key]) # type: ignore[index]
323321
simulation_settings.update(idf_pkg._get_output_settings())
324322

325323
simulation_settings["unsa_svat_path"] = self._render_unsaturated_database_path(
@@ -361,9 +359,7 @@ def write(
361359

362360
# Get index and svat
363361
grid_key = self.get_pkgkey(GridData)
364-
if grid_key is None:
365-
raise ValueError("No GridData package found in model")
366-
grid_pkg = cast(GridData, self[grid_key])
362+
grid_pkg = cast(GridData, self[grid_key]) # type: ignore[index]
367363
index, svat = grid_pkg.generate_isactive_svat_arrays()
368364

369365
# write package contents
@@ -564,9 +560,7 @@ def split(
564560

565561
# First, handle the grid data and determine the overlap.
566562
grid_key = self.get_pkgkey(GridData)
567-
if grid_key is None:
568-
raise ValueError("No GridData package found in model")
569-
grid_pkg = cast(GridData, self[grid_key])
563+
grid_pkg = cast(GridData, self[grid_key]) # type: ignore[index]
570564
is_in_active_domain = {}
571565

572566
for submodel_name, submodel in partitioned_submodels.items():

0 commit comments

Comments
 (0)