Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkgs/jaml/jaml/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]:
"""
Expand Down
3 changes: 2 additions & 1 deletion pkgs/jaml/jaml/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
Loading