Skip to content

Commit

Permalink
Lazily load yaml to avoid libyaml dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
amosjyng committed Jul 3, 2023
1 parent fa548bb commit 59e1c36
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 59e1c36

Please sign in to comment.