Skip to content

Commit

Permalink
Documented get_type()
Browse files Browse the repository at this point in the history
  • Loading branch information
omry committed Sep 1, 2020
1 parent e819bf3 commit 81ccf2e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions docs/source/structured_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ Python type annotation can be used by static type checkers like Mypy/Pyre or by
>>> with raises(ValidationError):
... conf.num = "foo"

This is duck-typing, the actual object type of `conf` is `DictConfig`. You can access the underlying
type using `OmegaConf.get_type()`:

.. doctest::

>>> type(conf)
<class 'omegaconf.dictconfig.DictConfig'>

>>> OmegaConf.get_type(conf)
<class 'SimpleTypes'>



Runtime type validation and conversion
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OmegaConf supports merging configs together, as well as overriding from the command line.
Expand Down
1 change: 1 addition & 0 deletions news/343.docs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Document OmegaConf.get_type()

0 comments on commit 81ccf2e

Please sign in to comment.