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

Add support for dict,tuple,list for parity with OmegaConf 2.2.3 #297

Merged
merged 8 commits into from Aug 19, 2022

Conversation

rsokl
Copy link
Contributor

@rsokl rsokl commented Aug 19, 2022

This PR improves hydra-zen's type sanitization behavior for empty sequences, and it adds parity with omegaconf==2.2.3's support for bare dict, list, and tuple annotations.

Before:

>>> from hydra_zen.structured_configs._utils import sanitized_type

>>> sanitized_type(typing.Tuple)
typing.Any

>>> sanitized_type(list)
typing.Any
>>> sanitized_type(tuple)
typing.Any
>>> sanitized_type(dict)
typing.Any

After:

# For omegaconf < 2.2.3
>>> sanitized_type(typing.Tuple)
typing.Any
>>> sanitized_type(list)
typing.List
>>> sanitized_type(tuple)
typing.Any
>>> sanitized_type(dict)
typing.Dict

# For 2.2.3 <= omegaconf
>>> sanitized_type(typing.Tuple)
typing.Tuple
>>> sanitized_type(list)
list
>>> sanitized_type(tuple)
tuple
>>> sanitized_type(dict)
dict

@rsokl rsokl added enhancement New feature or request hydra/omegaconf Tied to behavior of hydra/omegaconf labels Aug 19, 2022
@rsokl rsokl merged commit 04d4f9c into main Aug 19, 2022
@rsokl rsokl deleted the sanitized-type-omegaconf-2p2p3 branch August 19, 2022 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hydra/omegaconf Tied to behavior of hydra/omegaconf
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant