Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error merging dict into a Dict[str, str] #246

Closed
omry opened this issue May 5, 2020 · 0 comments · Fixed by #247
Closed

Error merging dict into a Dict[str, str] #246

omry opened this issue May 5, 2020 · 0 comments · Fixed by #247

Comments

@omry
Copy link
Owner

omry commented May 5, 2020

from dataclasses import dataclass, field
from typing import Dict
from omegaconf import OmegaConf


@dataclass
class JobConf:
    env: Dict[str, str] = field(default_factory=dict)


cfg = OmegaConf.create({"job": JobConf})
res = OmegaConf.merge(cfg, {"job": {"env": {"abc": "ABC"}}})
assert res.job == {"env": {"abc": "ABC"}}

Results in:

AssertionError: Unsupported value type : <class 'str'>
        full_key: job.env
        reference_type=Dict[str, str]
        object_type=dict

        full_key: job
        reference_type=Optional[JobConf]
        object_type=JobConf

        full_key: 
        reference_type=Optional[Dict[Any, Any]]
        object_type=dict
@omry omry mentioned this issue May 5, 2020
Merged
@omry omry closed this as completed in #247 May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant