Skip to content

Commit

Permalink
BUG: fix future incompatibility with yt 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Jan 21, 2023
1 parent 2abff90 commit 13a8347
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions yt_idefix/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,25 @@ def _setup_geometry(self) -> None:
"input prevails to allow working around hypothetical parsing bugs, "
"but it is very likely to result in an error in the general case."
)
self.geometry = from_input
geom_str = from_input
else:
assert from_disk
self.geometry = from_disk
geom_str = from_disk

def parse_geometry(geom: str):
import yt

if yt.version_info[:2] > (4, 1):
try:
from yt.geometry.api import Geometry # type: ignore [attr-defined]

return Geometry(geom)
except ImportError:
pass

return geom

self.geometry = parse_geometry(geom_str)

def _parse_inifile(self) -> None:
if not self._inifile:
Expand Down

0 comments on commit 13a8347

Please sign in to comment.