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

OmegaConf object doesn't support a .copy method #82

Closed
mannatsingh opened this issue Nov 12, 2019 · 1 comment · Fixed by #83
Closed

OmegaConf object doesn't support a .copy method #82

mannatsingh opened this issue Nov 12, 2019 · 1 comment · Fixed by #83

Comments

@mannatsingh
Copy link

A dict is supposed to have a .copy() method (https://docs.python.org/3/library/stdtypes.html#dict.copy). For an OmegaConf object to be compatible with a dict's API, it should also support the copy() method -

>>> from omegaconf import OmegaConf
>>> conf = OmegaConf.create({"a": 2, "b": [1,2,3]})
>>> conf
{'a': 2, 'b': [1, 2, 3]}
>>> conf.copy()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not callable
@omry
Copy link
Owner

omry commented Nov 13, 2019

Thanks for reporting.
For now please use:

from omegaconf import OmegaConf
import copy
conf = OmegaConf.create({"a": 2, "b": [1,2,3]})
conf2 = copy.deepcopy(conf)

I will look into implementing shallow copy as conf.copy() but it may not be trivial, the only support copy right now is deep copy.

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.

2 participants