diff --git a/pkgs/jaml/jaml/_config.py b/pkgs/jaml/jaml/_config.py index dd919322ae..e118ca17cf 100644 --- a/pkgs/jaml/jaml/_config.py +++ b/pkgs/jaml/jaml/_config.py @@ -332,7 +332,7 @@ def dumps(self) -> str: dump = staticmethod(lambda obj, fp: fp.write(Config.dumps(obj))) # type: ignore # ───────────────────────────────────────────────────────── resolution - def resolve(self) -> Dict[str, Any]: + def resolve(self, strip_quotes: bool = True) -> Dict[str, Any]: logger.debug("\n\n\n\n⮕ [resolve] entered...") from ._eval import safe_eval from ._fstring import _eval_fstrings @@ -464,7 +464,7 @@ def repl(m): final[k] = v else: final[k] = _expand(v, collapsed) - return _strip_quotes(final) + return _strip_quotes(final) if strip_quotes else final def render(self, context: Optional[Dict[str, Any]] = None) -> Dict[str, Any]: """ diff --git a/pkgs/jaml/jaml/api.py b/pkgs/jaml/jaml/api.py index e0abe87994..5b02bf190a 100644 --- a/pkgs/jaml/jaml/api.py +++ b/pkgs/jaml/jaml/api.py @@ -80,7 +80,8 @@ def loads(s: str) -> Dict[str, Any]: transformer = ConfigTransformer() transformer._context = type("Context", (), {"text": s}) config = transformer.transform(parse_tree) - return config.resolve() # Resolve and return plain dictionary + # Preserve surrounding quotes during load to match specification tests + return config.resolve(strip_quotes=False) def load(fp: IO[str]) -> Dict[str, Any]: