From 78f16e5e2130dbef3f4bfa1e251df0a7f32066bd Mon Sep 17 00:00:00 2001 From: "Haoyu (Daniel)" Date: Sun, 20 Oct 2024 13:55:00 +0800 Subject: [PATCH] drop guard for from ruamel.yaml import YAML --- src/monty/json.py | 8 ++------ src/monty/serialization.py | 5 +---- 2 files changed, 3 insertions(+), 10 deletions(-) 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