Skip to content

Commit

Permalink
add YAML object as recommended in parallel PR#102
Browse files Browse the repository at this point in the history
  • Loading branch information
MilagrosMarin committed Jan 4, 2024
1 parent abc10df commit d6fe551
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion element_deeplabcut/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import os
import cv2
import csv
import ruamel.yaml as yaml
from ruamel.yaml import YAML
import inspect
import importlib
import numpy as np
Expand Down Expand Up @@ -239,6 +239,7 @@ def extract_new_body_parts(cls, dlc_config: dict, verbose: bool = True):
".yaml",
), f"dlc_config is neither dict nor filepath\n Check: {dlc_config_fp}"
if dlc_config_fp.suffix in (".yml", ".yaml"):
yaml = YAML(typ="safe", pure=True)
with open(dlc_config_fp, "rb") as f:
dlc_config = yaml.load(f)
# -- Check and insert new BodyPart --
Expand Down Expand Up @@ -381,6 +382,7 @@ def insert_new_model(
"dlc_config is not a filepath" + f"\n Check: {dlc_config_fp}"
)
if dlc_config_fp.suffix in (".yml", ".yaml"):
yaml = YAML(typ="safe", pure=True)
with open(dlc_config_fp, "rb") as f:
dlc_config = yaml.load(f)
if isinstance(params, dict):
Expand Down

0 comments on commit d6fe551

Please sign in to comment.