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

Introduce new oc.env and oc.decode resolvers #606

Merged
merged 32 commits into from
Mar 18, 2021
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
44cae19
Introduce new `oc.env` and `oc.decode` resolvers
odelalleau Feb 11, 2021
bfa7f6a
Allow `oc.decode` to evaluate interpolations
odelalleau Mar 16, 2021
da51671
Improve documentation of `oc.decode`
odelalleau Mar 16, 2021
c2091c9
Update docs/source/usage.rst
odelalleau Mar 16, 2021
f947002
Update news/573.api_change
odelalleau Mar 16, 2021
0db0d1f
Update omegaconf/_utils.py
odelalleau Mar 16, 2021
38d3e07
Update omegaconf/_utils.py
odelalleau Mar 16, 2021
66a09b9
Remove the USERID example
odelalleau Mar 16, 2021
e77de84
Show example of quoted string as default value for `oc.env`
odelalleau Mar 16, 2021
0588723
Remove duplicated comments (# #)
odelalleau Mar 16, 2021
ac88c26
Validate default value of `oc.env` even when not used
odelalleau Mar 16, 2021
23dcae2
Simplify tests with recwarn
odelalleau Mar 16, 2021
d7571ff
Use convenience `show()` function in doc to show type and value
odelalleau Mar 16, 2021
b4690e0
Update doc on string interpolations
odelalleau Mar 17, 2021
00245cf
More readable test formatting
odelalleau Mar 17, 2021
a68c595
Improve comment formatting
odelalleau Mar 17, 2021
a0a6ec7
Restore interpolation examples
odelalleau Mar 17, 2021
2a7a756
Update docs/notebook/Tutorial.ipynb
odelalleau Mar 17, 2021
ef9b254
Update docs/source/usage.rst
odelalleau Mar 17, 2021
a2401b3
Update docs/source/usage.rst
odelalleau Mar 17, 2021
aa0170f
Rephrasing in doc
odelalleau Mar 17, 2021
c1100dc
Use `show()` function in doc
odelalleau Mar 17, 2021
0a2725f
Raise a KeyError instead of ValidationError for missing env variables
odelalleau Mar 17, 2021
518f430
Remove handling of "null" as default in legacy env resolver
odelalleau Mar 17, 2021
91b775e
Update news
odelalleau Mar 17, 2021
5429c05
Explicit typing for the default value of the `oc.env` resolver
odelalleau Mar 17, 2021
1f29fd9
Use a more appropriate exception type
odelalleau Mar 17, 2021
48df088
Update tests/test_interpolation.py
odelalleau Mar 17, 2021
3b7b4ec
Safer markers for default values
odelalleau Mar 17, 2021
3107001
Fix coverage
odelalleau Mar 17, 2021
5dcda42
Use more appropriate TypeError
odelalleau Mar 18, 2021
4800df9
Refactor: consistent use of _DEFAULT_MARKER_
odelalleau Mar 18, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve comment formatting
odelalleau committed Mar 18, 2021
commit a68c595aaf88e03074e3572e65e44f9ee7f042d7
8 changes: 6 additions & 2 deletions tests/test_interpolation.py
Original file line number Diff line number Diff line change
@@ -457,9 +457,13 @@ def test_legacy_env_values_are_typed(
assert c.my_key == expected


# DEPRECATED: remove `recwarn` in 2.2 with the legacy env resolver
@pytest.mark.parametrize("env_func", ["env", "oc.env"])
def test_env_default_none(monkeypatch: Any, recwarn: Any, env_func: str) -> None:
def test_env_default_none(
monkeypatch: Any,
# DEPRECATED: remove `recwarn` in 2.2 with the legacy env resolver
recwarn: Any,
env_func: str,
) -> None:
monkeypatch.delenv("MYKEY", raising=False)
c = OmegaConf.create({"my_key": "${%s:MYKEY, null}" % env_func})
assert c.my_key is None