omegaconf 2.3.0.dev1__tar.gz → 2.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {omegaconf-2.3.0.dev1/omegaconf.egg-info → omegaconf-2.3.1}/PKG-INFO +33 -8
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/README.md +16 -6
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/_utils.py +1 -1
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/dictconfig.py +1 -1
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/grammar/gen/OmegaConfGrammarLexer.py +1 -1
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/grammar/gen/OmegaConfGrammarParser.py +1 -1
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/grammar/gen/OmegaConfGrammarParserListener.py +1 -1
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/grammar/gen/OmegaConfGrammarParserVisitor.py +1 -1
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/omegaconf.py +35 -20
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/version.py +1 -1
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1/omegaconf.egg-info}/PKG-INFO +33 -8
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf.egg-info/SOURCES.txt +2 -2
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/pyproject.toml +1 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/setup.cfg +1 -1
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/setup.py +4 -3
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/__init__.py +2 -2
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/examples/dataclass_postponed_annotations.py +1 -1
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/examples/test_dataclass_example.py +6 -4
- omegaconf-2.3.1/tests/structured_conf/data/dataclasses.py +883 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/structured_conf/test_structured_basic.py +12 -4
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/structured_conf/test_structured_config.py +10 -3
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_to_container.py +19 -1
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_utils.py +1 -1
- omegaconf-2.3.0.dev1/tests/test_base.py +0 -18
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/LICENSE +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/MANIFEST.in +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/build_helpers/__init__.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/build_helpers/bin/antlr-4.9.3-complete.jar +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/build_helpers/build_helpers.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/build_helpers/test_helpers.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/__init__.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/_impl.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/base.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/basecontainer.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/errors.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/grammar/OmegaConfGrammarLexer.g4 +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/grammar/OmegaConfGrammarParser.g4 +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/grammar/__init__.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/grammar/gen/__init__.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/grammar_parser.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/grammar_visitor.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/listconfig.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/nodes.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/py.typed +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/resolvers/__init__.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/resolvers/oc/__init__.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/resolvers/oc/dict.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf.egg-info/dependency_links.txt +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf.egg-info/requires.txt +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf.egg-info/top_level.txt +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/pydevd_plugins/__init__.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/pydevd_plugins/extensions/__init__.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/pydevd_plugins/extensions/pydevd_plugin_omegaconf.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/requirements/base.txt +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/conftest.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/data/2.0.6.pickle +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/data/2.1.0.rc1.pickle +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/data/load.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/data/save.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/examples/__init__.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/examples/test_postponed_annotations.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/interpolation/__init__.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/interpolation/built_in_resolvers/__init__.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/interpolation/built_in_resolvers/test_oc_create.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/interpolation/built_in_resolvers/test_oc_decode.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/interpolation/built_in_resolvers/test_oc_deprecated.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/interpolation/built_in_resolvers/test_oc_dict.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/interpolation/built_in_resolvers/test_oc_env.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/interpolation/built_in_resolvers/test_oc_select.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/interpolation/test_custom_resolvers.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/interpolation/test_interpolation.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/structured_conf/__init__.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/structured_conf/data/__init__.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/structured_conf/data/attr_classes.py +0 -0
- /omegaconf-2.3.0.dev1/tests/structured_conf/data/dataclasses.py → /omegaconf-2.3.1/tests/structured_conf/data/dataclasses_pre_311.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_base_config.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_basic_ops_dict.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_basic_ops_list.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_compare_dictconfig_vs_dict.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_config_eq.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_create.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_errors.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_get_full_key.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_grammar.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_matrix.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_merge.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_nested_containers.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_nodes.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_omegaconf.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_pydev_resolver_plugin.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_readonly.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_select.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_serialization.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_struct.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_to_yaml.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_unions.py +0 -0
- {omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/tests/test_update.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: omegaconf
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.1
|
|
4
4
|
Summary: A flexible configuration library
|
|
5
5
|
Home-page: https://github.com/omry/omegaconf
|
|
6
6
|
Author: Omry Yadan
|
|
@@ -11,11 +11,26 @@ Classifier: Programming Language :: Python :: 3.7
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.8
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.9
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
15
|
Classifier: License :: OSI Approved :: BSD License
|
|
15
16
|
Classifier: Operating System :: OS Independent
|
|
16
17
|
Requires-Python: >=3.6
|
|
17
18
|
Description-Content-Type: text/markdown
|
|
18
19
|
License-File: LICENSE
|
|
20
|
+
Requires-Dist: antlr4-python3-runtime==4.9.*
|
|
21
|
+
Requires-Dist: PyYAML>=5.1.0
|
|
22
|
+
Requires-Dist: dataclasses; python_version == "3.6"
|
|
23
|
+
Dynamic: author
|
|
24
|
+
Dynamic: author-email
|
|
25
|
+
Dynamic: classifier
|
|
26
|
+
Dynamic: description
|
|
27
|
+
Dynamic: description-content-type
|
|
28
|
+
Dynamic: home-page
|
|
29
|
+
Dynamic: keywords
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
Dynamic: requires-dist
|
|
32
|
+
Dynamic: requires-python
|
|
33
|
+
Dynamic: summary
|
|
19
34
|
|
|
20
35
|
# OmegaConf
|
|
21
36
|
| | Description |
|
|
@@ -30,16 +45,26 @@ providing a consistent API regardless of how the configuration was created.
|
|
|
30
45
|
|
|
31
46
|
## Releases
|
|
32
47
|
|
|
33
|
-
### Stable (2.
|
|
34
|
-
OmegaConf 2.
|
|
35
|
-
* [What's new](https://github.com/omry/omegaconf/releases/tag/v2.
|
|
36
|
-
* [Documentation](https://omegaconf.readthedocs.io/en/2.
|
|
37
|
-
* [Source code](https://github.com/omry/omegaconf/tree/2.
|
|
48
|
+
### Stable (2.3)
|
|
49
|
+
OmegaConf 2.3 is the current stable version.
|
|
50
|
+
* [What's new](https://github.com/omry/omegaconf/releases/tag/v2.3.0)
|
|
51
|
+
* [Documentation](https://omegaconf.readthedocs.io/en/2.3_branch/)
|
|
52
|
+
* [Source code](https://github.com/omry/omegaconf/tree/2.3_branch)
|
|
38
53
|
|
|
39
54
|
Install with `pip install --upgrade omegaconf`
|
|
40
55
|
|
|
56
|
+
### Previous release (2.2)
|
|
57
|
+
|
|
58
|
+
* [What's new](https://github.com/omry/omegaconf/releases/tag/v2.1.1)
|
|
59
|
+
* [Documentation](https://omegaconf.readthedocs.io/en/2.1_branch/)
|
|
60
|
+
* [Slides](https://docs.google.com/presentation/d/e/2PACX-1vT_UIV7hCnquIbLUm4NnkUpXvPEh33IKiUEvPRF850WKA8opOlZOszjKdZ3tPmf8u7hGNP6HpqS-NT5/pub?start=false&loop=false&delayms=3000)
|
|
61
|
+
* [Source code](https://github.com/omry/omegaconf/tree/2.1_branch)
|
|
62
|
+
|
|
63
|
+
Install with `pip install omegaconf==2.1`
|
|
64
|
+
|
|
65
|
+
|
|
41
66
|
### Previous release (2.1)
|
|
42
|
-
|
|
67
|
+
|
|
43
68
|
* [What's new](https://github.com/omry/omegaconf/releases/tag/v2.1.1)
|
|
44
69
|
* [Documentation](https://omegaconf.readthedocs.io/en/2.1_branch/)
|
|
45
70
|
* [Slides](https://docs.google.com/presentation/d/e/2PACX-1vT_UIV7hCnquIbLUm4NnkUpXvPEh33IKiUEvPRF850WKA8opOlZOszjKdZ3tPmf8u7hGNP6HpqS-NT5/pub?start=false&loop=false&delayms=3000)
|
|
@@ -11,16 +11,26 @@ providing a consistent API regardless of how the configuration was created.
|
|
|
11
11
|
|
|
12
12
|
## Releases
|
|
13
13
|
|
|
14
|
-
### Stable (2.
|
|
15
|
-
OmegaConf 2.
|
|
16
|
-
* [What's new](https://github.com/omry/omegaconf/releases/tag/v2.
|
|
17
|
-
* [Documentation](https://omegaconf.readthedocs.io/en/2.
|
|
18
|
-
* [Source code](https://github.com/omry/omegaconf/tree/2.
|
|
14
|
+
### Stable (2.3)
|
|
15
|
+
OmegaConf 2.3 is the current stable version.
|
|
16
|
+
* [What's new](https://github.com/omry/omegaconf/releases/tag/v2.3.0)
|
|
17
|
+
* [Documentation](https://omegaconf.readthedocs.io/en/2.3_branch/)
|
|
18
|
+
* [Source code](https://github.com/omry/omegaconf/tree/2.3_branch)
|
|
19
19
|
|
|
20
20
|
Install with `pip install --upgrade omegaconf`
|
|
21
21
|
|
|
22
|
+
### Previous release (2.2)
|
|
23
|
+
|
|
24
|
+
* [What's new](https://github.com/omry/omegaconf/releases/tag/v2.1.1)
|
|
25
|
+
* [Documentation](https://omegaconf.readthedocs.io/en/2.1_branch/)
|
|
26
|
+
* [Slides](https://docs.google.com/presentation/d/e/2PACX-1vT_UIV7hCnquIbLUm4NnkUpXvPEh33IKiUEvPRF850WKA8opOlZOszjKdZ3tPmf8u7hGNP6HpqS-NT5/pub?start=false&loop=false&delayms=3000)
|
|
27
|
+
* [Source code](https://github.com/omry/omegaconf/tree/2.1_branch)
|
|
28
|
+
|
|
29
|
+
Install with `pip install omegaconf==2.1`
|
|
30
|
+
|
|
31
|
+
|
|
22
32
|
### Previous release (2.1)
|
|
23
|
-
|
|
33
|
+
|
|
24
34
|
* [What's new](https://github.com/omry/omegaconf/releases/tag/v2.1.1)
|
|
25
35
|
* [Documentation](https://omegaconf.readthedocs.io/en/2.1_branch/)
|
|
26
36
|
* [Slides](https://docs.google.com/presentation/d/e/2PACX-1vT_UIV7hCnquIbLUm4NnkUpXvPEh33IKiUEvPRF850WKA8opOlZOszjKdZ3tPmf8u7hGNP6HpqS-NT5/pub?start=false&loop=false&delayms=3000)
|
|
@@ -392,7 +392,7 @@ def get_dataclass_data(
|
|
|
392
392
|
is_optional, type_ = _resolve_optional(resolved_hints[field.name])
|
|
393
393
|
type_ = _resolve_forward(type_, obj.__module__)
|
|
394
394
|
has_default = field.default != dataclasses.MISSING
|
|
395
|
-
has_default_factory = field.default_factory != dataclasses.MISSING
|
|
395
|
+
has_default_factory = field.default_factory != dataclasses.MISSING
|
|
396
396
|
|
|
397
397
|
if not is_type:
|
|
398
398
|
value = getattr(obj, name)
|
|
@@ -459,7 +459,7 @@ class DictConfig(BaseContainer, MutableMapping[Any, Any]):
|
|
|
459
459
|
validate_key: bool = True,
|
|
460
460
|
throw_on_missing_value: bool = False,
|
|
461
461
|
throw_on_missing_key: bool = False,
|
|
462
|
-
) ->
|
|
462
|
+
) -> Optional[Node]:
|
|
463
463
|
try:
|
|
464
464
|
key = self._validate_and_normalize_key(key)
|
|
465
465
|
except KeyValidationError:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Generated from /home/
|
|
1
|
+
# Generated from /home/omry/dev/omegaconf/omegaconf/grammar/OmegaConfGrammarParser.g4 by ANTLR 4.9.3
|
|
2
2
|
# encoding: utf-8
|
|
3
3
|
from antlr4 import *
|
|
4
4
|
from io import StringIO
|
{omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/grammar/gen/OmegaConfGrammarParserListener.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Generated from /home/
|
|
1
|
+
# Generated from /home/omry/dev/omegaconf/omegaconf/grammar/OmegaConfGrammarParser.g4 by ANTLR 4.9.3
|
|
2
2
|
from antlr4 import *
|
|
3
3
|
if __name__ is not None and "." in __name__:
|
|
4
4
|
from .OmegaConfGrammarParser import OmegaConfGrammarParser
|
{omegaconf-2.3.0.dev1 → omegaconf-2.3.1}/omegaconf/grammar/gen/OmegaConfGrammarParserVisitor.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Generated from /home/
|
|
1
|
+
# Generated from /home/omry/dev/omegaconf/omegaconf/grammar/OmegaConfGrammarParser.g4 by ANTLR 4.9.3
|
|
2
2
|
from antlr4 import *
|
|
3
3
|
if __name__ is not None and "." in __name__:
|
|
4
4
|
from .OmegaConfGrammarParser import OmegaConfGrammarParser
|
|
@@ -80,18 +80,20 @@ Resolver = Callable[..., Any]
|
|
|
80
80
|
|
|
81
81
|
def II(interpolation: str) -> Any:
|
|
82
82
|
"""
|
|
83
|
-
Equivalent to
|
|
83
|
+
Equivalent to ``${interpolation}``
|
|
84
|
+
|
|
84
85
|
:param interpolation:
|
|
85
|
-
:return: input
|
|
86
|
+
:return: input ``${node}`` with type Any
|
|
86
87
|
"""
|
|
87
88
|
return "${" + interpolation + "}"
|
|
88
89
|
|
|
89
90
|
|
|
90
91
|
def SI(interpolation: str) -> Any:
|
|
91
92
|
"""
|
|
92
|
-
Use this for String interpolation, for example "http://${host}:${port}"
|
|
93
|
+
Use this for String interpolation, for example ``"http://${host}:${port}"``
|
|
94
|
+
|
|
93
95
|
:param interpolation: interpolation string
|
|
94
|
-
:return: input interpolation with type Any
|
|
96
|
+
:return: input interpolation with type ``Any``
|
|
95
97
|
"""
|
|
96
98
|
return interpolation
|
|
97
99
|
|
|
@@ -209,6 +211,7 @@ class OmegaConf:
|
|
|
209
211
|
) -> None:
|
|
210
212
|
"""
|
|
211
213
|
Save as configuration object to a file
|
|
214
|
+
|
|
212
215
|
:param config: omegaconf.Config object (DictConfig or ListConfig).
|
|
213
216
|
:param f: filename or file object
|
|
214
217
|
:param resolve: True to save a resolved config (defaults to False)
|
|
@@ -236,8 +239,9 @@ class OmegaConf:
|
|
|
236
239
|
def from_dotlist(dotlist: List[str]) -> DictConfig:
|
|
237
240
|
"""
|
|
238
241
|
Creates config from the content sys.argv or from the specified args list of not None
|
|
239
|
-
|
|
240
|
-
:
|
|
242
|
+
|
|
243
|
+
:param dotlist: A list of dotlist-style strings, e.g. ``["foo.bar=1", "baz=qux"]``.
|
|
244
|
+
:return: A ``DictConfig`` object created from the dotlist.
|
|
241
245
|
"""
|
|
242
246
|
conf = OmegaConf.create()
|
|
243
247
|
conf.merge_with_dotlist(dotlist)
|
|
@@ -256,6 +260,7 @@ class OmegaConf:
|
|
|
256
260
|
) -> Union[ListConfig, DictConfig]:
|
|
257
261
|
"""
|
|
258
262
|
Merge a list of previously created configs into a single one
|
|
263
|
+
|
|
259
264
|
:param configs: Input configs
|
|
260
265
|
:return: the merged config object.
|
|
261
266
|
"""
|
|
@@ -288,6 +293,7 @@ class OmegaConf:
|
|
|
288
293
|
Merge a list of previously created configs into a single one
|
|
289
294
|
This is much faster than OmegaConf.merge() as the input configs are not copied.
|
|
290
295
|
However, the input configs must not be used after this operation as will become inconsistent.
|
|
296
|
+
|
|
291
297
|
:param configs: Input configs
|
|
292
298
|
:return: the merged config object.
|
|
293
299
|
"""
|
|
@@ -377,16 +383,16 @@ class OmegaConf:
|
|
|
377
383
|
:param name: Name of the resolver.
|
|
378
384
|
:param resolver: Callable whose arguments are provided in the interpolation,
|
|
379
385
|
e.g., with ${foo:x,0,${y.z}} these arguments are respectively "x" (str),
|
|
380
|
-
0 (int) and the value of
|
|
381
|
-
:param replace: If set to
|
|
386
|
+
0 (int) and the value of ``y.z``.
|
|
387
|
+
:param replace: If set to ``False`` (default), then a ``ValueError`` is raised if
|
|
382
388
|
an existing resolver has already been registered with the same name.
|
|
383
|
-
If set to
|
|
389
|
+
If set to ``True``, then the new resolver replaces the previous one.
|
|
384
390
|
NOTE: The cache on existing config objects is not affected, use
|
|
385
|
-
|
|
391
|
+
``OmegaConf.clear_cache(cfg)`` to clear it.
|
|
386
392
|
:param use_cache: Whether the resolver's outputs should be cached. The cache is
|
|
387
393
|
based only on the string literals representing the resolver arguments, e.g.,
|
|
388
394
|
${foo:${bar}} will always return the same value regardless of the value of
|
|
389
|
-
|
|
395
|
+
``bar`` if the cache is enabled for ``foo``.
|
|
390
396
|
"""
|
|
391
397
|
if not callable(resolver):
|
|
392
398
|
raise TypeError("resolver must be callable")
|
|
@@ -452,6 +458,9 @@ class OmegaConf:
|
|
|
452
458
|
# noinspection PyProtectedMember
|
|
453
459
|
@staticmethod
|
|
454
460
|
def clear_resolvers() -> None:
|
|
461
|
+
"""
|
|
462
|
+
Clear(remove) all OmegaConf resolvers, then re-register OmegaConf's default resolvers.
|
|
463
|
+
"""
|
|
455
464
|
BaseContainer._resolvers = {}
|
|
456
465
|
register_default_resolvers()
|
|
457
466
|
|
|
@@ -515,9 +524,10 @@ class OmegaConf:
|
|
|
515
524
|
def masked_copy(conf: DictConfig, keys: Union[str, List[str]]) -> DictConfig:
|
|
516
525
|
"""
|
|
517
526
|
Create a masked copy of of this config that contains a subset of the keys
|
|
527
|
+
|
|
518
528
|
:param conf: DictConfig object
|
|
519
529
|
:param keys: keys to preserve in the copy
|
|
520
|
-
:return:
|
|
530
|
+
:return: The masked ``DictConfig`` object.
|
|
521
531
|
"""
|
|
522
532
|
from .dictconfig import DictConfig
|
|
523
533
|
|
|
@@ -540,17 +550,19 @@ class OmegaConf:
|
|
|
540
550
|
) -> Union[Dict[DictKeyType, Any], List[Any], None, str, Any]:
|
|
541
551
|
"""
|
|
542
552
|
Resursively converts an OmegaConf config to a primitive container (dict or list).
|
|
553
|
+
|
|
543
554
|
:param cfg: the config to convert
|
|
544
555
|
:param resolve: True to resolve all values
|
|
545
556
|
:param throw_on_missing: When True, raise MissingMandatoryValue if any missing values are present.
|
|
546
557
|
When False (the default), replace missing values with the string "???" in the output container.
|
|
547
558
|
:param enum_to_str: True to convert Enum keys and values to strings
|
|
548
559
|
:param structured_config_mode: Specify how Structured Configs (DictConfigs backed by a dataclass) are handled.
|
|
549
|
-
By default (
|
|
550
|
-
If
|
|
551
|
-
If
|
|
552
|
-
|
|
553
|
-
|
|
560
|
+
- By default (``structured_config_mode=SCMode.DICT``) structured configs are converted to plain dicts.
|
|
561
|
+
- If ``structured_config_mode=SCMode.DICT_CONFIG``, structured config nodes will remain as DictConfig.
|
|
562
|
+
- If ``structured_config_mode=SCMode.INSTANTIATE``, this function will instantiate structured configs
|
|
563
|
+
(DictConfigs backed by a dataclass), by creating an instance of the underlying dataclass.
|
|
564
|
+
|
|
565
|
+
See also OmegaConf.to_object.
|
|
554
566
|
:return: A dict or a list representing this config as a primitive container.
|
|
555
567
|
"""
|
|
556
568
|
if not OmegaConf.is_config(cfg):
|
|
@@ -737,9 +749,10 @@ class OmegaConf:
|
|
|
737
749
|
def to_yaml(cfg: Any, *, resolve: bool = False, sort_keys: bool = False) -> str:
|
|
738
750
|
"""
|
|
739
751
|
returns a yaml dump of this config object.
|
|
752
|
+
|
|
740
753
|
:param cfg: Config object, Structured Config type or instance
|
|
741
754
|
:param resolve: if True, will return a string with the interpolations resolved, otherwise
|
|
742
|
-
|
|
755
|
+
interpolations are preserved
|
|
743
756
|
:param sort_keys: If True, will print dict keys in sorted order. default False.
|
|
744
757
|
:return: A string containing the yaml representation.
|
|
745
758
|
"""
|
|
@@ -757,6 +770,7 @@ class OmegaConf:
|
|
|
757
770
|
def resolve(cfg: Container) -> None:
|
|
758
771
|
"""
|
|
759
772
|
Resolves all interpolations in the given config object in-place.
|
|
773
|
+
|
|
760
774
|
:param cfg: An OmegaConf container (DictConfig, ListConfig)
|
|
761
775
|
Raises a ValueError if the input object is not an OmegaConf container.
|
|
762
776
|
"""
|
|
@@ -774,8 +788,9 @@ class OmegaConf:
|
|
|
774
788
|
def missing_keys(cfg: Any) -> Set[str]:
|
|
775
789
|
"""
|
|
776
790
|
Returns a set of missing keys in a dotlist style.
|
|
777
|
-
|
|
778
|
-
|
|
791
|
+
|
|
792
|
+
:param cfg: An ``OmegaConf.Container``,
|
|
793
|
+
or a convertible object via ``OmegaConf.create`` (dict, list, ...).
|
|
779
794
|
:return: set of strings of the missing keys.
|
|
780
795
|
:raises ValueError: On input not representing a config.
|
|
781
796
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: omegaconf
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.1
|
|
4
4
|
Summary: A flexible configuration library
|
|
5
5
|
Home-page: https://github.com/omry/omegaconf
|
|
6
6
|
Author: Omry Yadan
|
|
@@ -11,11 +11,26 @@ Classifier: Programming Language :: Python :: 3.7
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.8
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.9
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
15
|
Classifier: License :: OSI Approved :: BSD License
|
|
15
16
|
Classifier: Operating System :: OS Independent
|
|
16
17
|
Requires-Python: >=3.6
|
|
17
18
|
Description-Content-Type: text/markdown
|
|
18
19
|
License-File: LICENSE
|
|
20
|
+
Requires-Dist: antlr4-python3-runtime==4.9.*
|
|
21
|
+
Requires-Dist: PyYAML>=5.1.0
|
|
22
|
+
Requires-Dist: dataclasses; python_version == "3.6"
|
|
23
|
+
Dynamic: author
|
|
24
|
+
Dynamic: author-email
|
|
25
|
+
Dynamic: classifier
|
|
26
|
+
Dynamic: description
|
|
27
|
+
Dynamic: description-content-type
|
|
28
|
+
Dynamic: home-page
|
|
29
|
+
Dynamic: keywords
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
Dynamic: requires-dist
|
|
32
|
+
Dynamic: requires-python
|
|
33
|
+
Dynamic: summary
|
|
19
34
|
|
|
20
35
|
# OmegaConf
|
|
21
36
|
| | Description |
|
|
@@ -30,16 +45,26 @@ providing a consistent API regardless of how the configuration was created.
|
|
|
30
45
|
|
|
31
46
|
## Releases
|
|
32
47
|
|
|
33
|
-
### Stable (2.
|
|
34
|
-
OmegaConf 2.
|
|
35
|
-
* [What's new](https://github.com/omry/omegaconf/releases/tag/v2.
|
|
36
|
-
* [Documentation](https://omegaconf.readthedocs.io/en/2.
|
|
37
|
-
* [Source code](https://github.com/omry/omegaconf/tree/2.
|
|
48
|
+
### Stable (2.3)
|
|
49
|
+
OmegaConf 2.3 is the current stable version.
|
|
50
|
+
* [What's new](https://github.com/omry/omegaconf/releases/tag/v2.3.0)
|
|
51
|
+
* [Documentation](https://omegaconf.readthedocs.io/en/2.3_branch/)
|
|
52
|
+
* [Source code](https://github.com/omry/omegaconf/tree/2.3_branch)
|
|
38
53
|
|
|
39
54
|
Install with `pip install --upgrade omegaconf`
|
|
40
55
|
|
|
56
|
+
### Previous release (2.2)
|
|
57
|
+
|
|
58
|
+
* [What's new](https://github.com/omry/omegaconf/releases/tag/v2.1.1)
|
|
59
|
+
* [Documentation](https://omegaconf.readthedocs.io/en/2.1_branch/)
|
|
60
|
+
* [Slides](https://docs.google.com/presentation/d/e/2PACX-1vT_UIV7hCnquIbLUm4NnkUpXvPEh33IKiUEvPRF850WKA8opOlZOszjKdZ3tPmf8u7hGNP6HpqS-NT5/pub?start=false&loop=false&delayms=3000)
|
|
61
|
+
* [Source code](https://github.com/omry/omegaconf/tree/2.1_branch)
|
|
62
|
+
|
|
63
|
+
Install with `pip install omegaconf==2.1`
|
|
64
|
+
|
|
65
|
+
|
|
41
66
|
### Previous release (2.1)
|
|
42
|
-
|
|
67
|
+
|
|
43
68
|
* [What's new](https://github.com/omry/omegaconf/releases/tag/v2.1.1)
|
|
44
69
|
* [Documentation](https://omegaconf.readthedocs.io/en/2.1_branch/)
|
|
45
70
|
* [Slides](https://docs.google.com/presentation/d/e/2PACX-1vT_UIV7hCnquIbLUm4NnkUpXvPEh33IKiUEvPRF850WKA8opOlZOszjKdZ3tPmf8u7hGNP6HpqS-NT5/pub?start=false&loop=false&delayms=3000)
|
|
@@ -44,7 +44,6 @@ pydevd_plugins/extensions/pydevd_plugin_omegaconf.py
|
|
|
44
44
|
requirements/base.txt
|
|
45
45
|
tests/__init__.py
|
|
46
46
|
tests/conftest.py
|
|
47
|
-
tests/test_base.py
|
|
48
47
|
tests/test_base_config.py
|
|
49
48
|
tests/test_basic_ops_dict.py
|
|
50
49
|
tests/test_basic_ops_list.py
|
|
@@ -92,4 +91,5 @@ tests/structured_conf/test_structured_basic.py
|
|
|
92
91
|
tests/structured_conf/test_structured_config.py
|
|
93
92
|
tests/structured_conf/data/__init__.py
|
|
94
93
|
tests/structured_conf/data/attr_classes.py
|
|
95
|
-
tests/structured_conf/data/dataclasses.py
|
|
94
|
+
tests/structured_conf/data/dataclasses.py
|
|
95
|
+
tests/structured_conf/data/dataclasses_pre_311.py
|
|
@@ -10,7 +10,6 @@ OmegaConf setup
|
|
|
10
10
|
"""
|
|
11
11
|
import pathlib
|
|
12
12
|
|
|
13
|
-
import pkg_resources
|
|
14
13
|
import setuptools
|
|
15
14
|
|
|
16
15
|
from build_helpers.build_helpers import (
|
|
@@ -24,8 +23,9 @@ from build_helpers.build_helpers import (
|
|
|
24
23
|
|
|
25
24
|
with pathlib.Path("requirements/base.txt").open() as requirements_txt:
|
|
26
25
|
install_requires = [
|
|
27
|
-
|
|
28
|
-
for
|
|
26
|
+
line.split("#")[0].strip()
|
|
27
|
+
for line in requirements_txt
|
|
28
|
+
if line.split("#")[0].strip()
|
|
29
29
|
]
|
|
30
30
|
|
|
31
31
|
|
|
@@ -64,6 +64,7 @@ with open("README.md", "r") as fh:
|
|
|
64
64
|
"Programming Language :: Python :: 3.8",
|
|
65
65
|
"Programming Language :: Python :: 3.9",
|
|
66
66
|
"Programming Language :: Python :: 3.10",
|
|
67
|
+
"Programming Language :: Python :: 3.11",
|
|
67
68
|
"License :: OSI Approved :: BSD License",
|
|
68
69
|
"Operating System :: OS Independent",
|
|
69
70
|
],
|
|
@@ -108,7 +108,7 @@ class ConcretePlugin(Plugin):
|
|
|
108
108
|
class FoobarParams:
|
|
109
109
|
foo: int = 10
|
|
110
110
|
|
|
111
|
-
params: FoobarParams = FoobarParams
|
|
111
|
+
params: FoobarParams = field(default_factory=FoobarParams)
|
|
112
112
|
|
|
113
113
|
|
|
114
114
|
@dataclass
|
|
@@ -117,7 +117,7 @@ class NestedInterpolationToMissing:
|
|
|
117
117
|
class BazParams:
|
|
118
118
|
baz: str = "${..name}"
|
|
119
119
|
|
|
120
|
-
subcfg: BazParams = BazParams
|
|
120
|
+
subcfg: BazParams = field(default_factory=BazParams)
|
|
121
121
|
name: str = MISSING
|
|
122
122
|
|
|
123
123
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `from __future__` has to be the very first thing in a module
|
|
2
2
|
# otherwise a syntax error is raised
|
|
3
|
-
from __future__ import annotations #
|
|
3
|
+
from __future__ import annotations # noqa # Python 3.6 linters complain
|
|
4
4
|
|
|
5
5
|
from dataclasses import dataclass, fields
|
|
6
6
|
from enum import Enum
|
|
@@ -161,7 +161,9 @@ class Group:
|
|
|
161
161
|
admin: User = User # type: ignore
|
|
162
162
|
|
|
163
163
|
# You can also specify different defaults for nested classes
|
|
164
|
-
manager: User =
|
|
164
|
+
manager: User = field(
|
|
165
|
+
default_factory=lambda: User(name="manager", height=Height.TALL)
|
|
166
|
+
)
|
|
165
167
|
|
|
166
168
|
|
|
167
169
|
def test_nesting() -> None:
|
|
@@ -343,7 +345,7 @@ def test_merge() -> None:
|
|
|
343
345
|
@dataclass
|
|
344
346
|
class Config:
|
|
345
347
|
num: int = 10
|
|
346
|
-
user: User = User(name=MISSING, height=MISSING)
|
|
348
|
+
user: User = field(default_factory=lambda: User(name=MISSING, height=MISSING))
|
|
347
349
|
domains: Dict[str, Domain] = field(default_factory=dict)
|
|
348
350
|
|
|
349
351
|
yaml = """
|
|
@@ -385,8 +387,8 @@ def test_merge_example() -> None:
|
|
|
385
387
|
|
|
386
388
|
@dataclass
|
|
387
389
|
class MyConfig:
|
|
388
|
-
server: Server = Server
|
|
389
|
-
log: Log = Log
|
|
390
|
+
server: Server = field(default_factory=Server)
|
|
391
|
+
log: Log = field(default_factory=Log)
|
|
390
392
|
users: List[str] = field(default_factory=list)
|
|
391
393
|
numbers: List[int] = field(default_factory=list)
|
|
392
394
|
|