Closed haberchr closed 1 month ago
The issue is caused by the loader function interpreting the dictitems as mutable I believe: https://github.com/yaml/pyyaml/blob/main/lib/yaml/constructor.py#L623
Could try to patch this by adding a custom YAML
constructor for FrozenDict
:
https://matthewpburruss.com/post/yaml/
While we're at it, @shanest, do you remember why the class tags in the YAML
files had to be expanded to contain so much text? I remember they didn't used to: !!python/object/new:ultk.util.frozendict.FrozenDict
instead of !FrozenDict
Relevant StackOverflow post on the tag types: https://stackoverflow.com/questions/9664113/what-does-a-single-exclamation-mark-do-in-yaml
I ran into this issue awhile ago and did implement custom load/save for the class to solve the issue; see https://github.com/CLMBRs/ultk/blob/main/src/ultk/util/frozendict.py . Are you working in a branch that might be behind main
on this front? If so, try merging main back into yours; if not, can you say more about what exactly is causing it?
(It's possible that you might also need to re-save the expressions you're trying to load, not positive about that)
Thanks for the suggestion to save the expressions! I am now able to load expressions again and see the !frozendict
tag correctly reflected in the saved expressions yaml
.
The addition of
FrozenDict
s toMeaning
breaks theyaml.load()
function (TypeError: FrozenDict is immutable
):