Skip to content

Commit

Permalink
Lazily load yaml to avoid libyaml dependency (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
stuhlmueller authored Jul 17, 2023
2 parents c338477 + 59e1c36 commit ab59d0b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ice/metrics/gold_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
from pydantic import BaseModel
from pydantic.generics import GenericModel
from structlog.stdlib import get_logger
from yaml import CLoader as Loader
from yaml import load

from ice.paper import Paper
from ice.settings import settings
Expand Down Expand Up @@ -60,6 +58,9 @@ class Config:
def _parse_answer(
_answer: str, model: Type[ParsedGoldStandardType]
) -> ParsedGoldStandardType:
from yaml import CLoader as Loader
from yaml import load

data = load(_answer, Loader=Loader)
return model.parse_obj(data)

Expand Down

0 comments on commit ab59d0b

Please sign in to comment.