omry / omegaconf

Flexible Python configuration system. The last one you will ever need.
BSD 3-Clause "New" or "Revised" License
1.88k stars 98 forks source link

OmegaConf.resolve cannnot resolve a dictionary #1165

Open miaopas opened 4 months ago

miaopas commented 4 months ago

Describe the bug For a custom resolver that returns a dictionary, OmegaConf.resolve report error, but other functions like OmegaConf.to_container(cfg, resolve=True) will work

To Reproduce

OmegaConf.register_new_resolver('foo', lambda x: {x: 1}, replace=True)

c = """
key1: poly # (smooth, nonsmooth)
key2: ${foo:${key1}}
"""
cfg = OmegaConf.create(c)

# Works
OmegaConf.to_container(cfg, resolve=True) 

# Not working
OmegaConf.resolve(cfg)

Expected behavior OmegaConf.resolve should also work in this case?

Additional context