Open trias702 opened 1 year ago
Here's a workaround using resolvers:
>>> OmegaConf.register_new_resolver("three_question_marks", lambda: "???")
>>> cfg = OmegaConf.create("a: ${three_question_marks:}");
>>> OmegaConf.to_object(cfg)
{'a': '???'}
That worked great, thank you kindly!
On Mon, 6 Feb 2023, 01:45 Jasha Sommer-Simpson, @.***> wrote:
Here's a hack using resolvers to get the job done:
OmegaConf.register_new_resolver("three_question_marks", lambda: "???")>>> cfg = OmegaConf.create("a: ${three_question_marks:}");>>> OmegaConf.to_object(cfg) {'a': '???'}
— Reply to this email directly, view it on GitHub https://github.com/omry/omegaconf/issues/1056#issuecomment-1418795700, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGFLGNGW2RXPWLUJSRIHCUDWWDB4DANCNFSM6AAAAAAUM7CNKM . You are receiving this because you authored the thread.Message ID: @.***>
I'm creating a ListConfig out of a python list of strings, and one element of my python list is '???', a python string with 3 question marks.
Unfortunately, if I include such a string into ListConfig, and later that ListConfig is part of a resolve call (for example OmegaConf.to_object()), then OmegaConf throws an error for Missing Value, because ??? is a special, reserved phrase.
How can I properly escape ??? so this doesn't happen?