Skip to content

Commit

Permalink
STY: Try to make mypy happy (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
IngridKJ committed Feb 18, 2025
1 parent b8d3d9a commit cacc1be
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
15 changes: 13 additions & 2 deletions src/porepy/applications/md_grids/model_geometries.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from __future__ import annotations

from typing import Union, cast

import numpy as np

import porepy as pp
from porepy.grids import mortar_grid
from porepy.grids.mdg_generation import _preprocess_cartesian_args

from . import domains, fracture_sets
Expand Down Expand Up @@ -255,7 +258,15 @@ def set_geometry(self) -> None:

# Finally replace the subdomains and interfaces in the original
# mixed-dimensional grid. Both can be done at the same time:
self.mdg.replace_subdomains_and_interfaces(sd_map=grid_map, intf_map=intf_map)

self.mdg.replace_subdomains_and_interfaces(
sd_map=grid_map,
intf_map=cast(
dict[
pp.MortarGrid,
Union[pp.MortarGrid, dict[mortar_grid.MortarSides, pp.Grid]],
],
intf_map,
),
)
# Create projections between local and global coordinates for fracture grids.
pp.set_local_coordinate_projections(self.mdg)
7 changes: 3 additions & 4 deletions src/porepy/grids/md_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from __future__ import annotations

from collections.abc import Mapping
from typing import Any, Callable, Iterable, Literal, Optional, Union, overload

import numpy as np
Expand Down Expand Up @@ -698,11 +697,11 @@ def copy(self) -> MixedDimensionalGrid:

def replace_subdomains_and_interfaces(
self,
sd_map: Optional[Mapping[pp.Grid, pp.Grid]] = None,
sd_map: Optional[dict[pp.Grid, pp.Grid]] = None,
intf_map: Optional[
Mapping[
dict[
pp.MortarGrid,
Union[pp.MortarGrid, Mapping[mortar_grid.MortarSides, pp.Grid]],
Union[pp.MortarGrid, dict[mortar_grid.MortarSides, pp.Grid]],
]
] = None,
tol: float = 1e-6,
Expand Down

0 comments on commit cacc1be

Please sign in to comment.