Skip to content

Commit

Permalink
Fix importing code frontend.
Browse files Browse the repository at this point in the history
  • Loading branch information
cindytsai committed Feb 19, 2024
1 parent 9e28ee8 commit cb86cb6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion yt_libyt/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,12 @@ def __init__(self, units_override=None, unit_system="cgs"):
for name in yt.frontends.api._frontends:
if self._code_frontend == name.lower():
# Import frontend dataset
# The naming rule of dataset class is XXXDataset, XXX doesn't necessarily need to be all capital
frontend = importlib.import_module(f"yt.frontends.{name.lower()}.api")
frontend_dataset = getattr(frontend, f"{name.upper()}Dataset")
frontend_dataset = None
for _ in dir(frontend):
if _.endswith("Dataset"):
frontend_dataset = getattr(frontend, _)

# Borrow frontend's field info
self._field_info_class = frontend_dataset._field_info_class
Expand Down

0 comments on commit cb86cb6

Please sign in to comment.