diff --git a/src/monty/json.py b/src/monty/json.py index f9899097..282cfad3 100644 --- a/src/monty/json.py +++ b/src/monty/json.py @@ -21,6 +21,8 @@ from typing import Any from uuid import UUID, uuid4 +from ruamel.yaml import YAML + try: import numpy as np except ImportError: @@ -41,17 +43,11 @@ except ImportError: bson = None -try: - from ruamel.yaml import YAML -except ImportError: - YAML = None - try: import orjson except ImportError: orjson = None - try: import torch except ImportError: diff --git a/src/monty/serialization.py b/src/monty/serialization.py index a17b9913..6732a674 100644 --- a/src/monty/serialization.py +++ b/src/monty/serialization.py @@ -9,10 +9,7 @@ import os from typing import TYPE_CHECKING -try: - from ruamel.yaml import YAML -except ImportError: - YAML = None # type: ignore[arg-type] +from ruamel.yaml import YAML from monty.io import zopen from monty.json import MontyDecoder, MontyEncoder