Skip to content

Commit

Permalink
fixup structured_config.rst code snippets (omry#922)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasha10 committed May 12, 2022
1 parent 0e00bf3 commit 5e6b33c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions docs/source/structured_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,29 @@ in the input class.


Currently, type hints supported in OmegaConf’s structured configs include:
- primitive types (int, float, bool, str, Path) and enum types (user-defined
subclasses of enum.Enum). See the :ref:`simple_types` section below.
- primitive types (``int``, ``float``, ``bool``, ``str``, ``Path``) and enum types
(user-defined subclasses of ``enum.Enum``). See the :ref:`simple_types` section below.
- structured config fields (i.e. MyConfig.x can have type hint MySubConfig).
See the :ref:`nesting_structured_configs` section below.
- optional types (any of the above can be wrapped in a typing.Optional[...]
- optional types (any of the above can be wrapped in a ``typing.Optional[...]``
annotation). See :ref:`other_special_features` below.
- dict and list types: typing.Dict[K, V] or typing.List[V], where K is
- dict and list types: ``typing.Dict[K, V]`` or ``typing.List[V]``, where K is
primitive or enum, and where V is any of the above (including nested dicts
or lists, e.g. `Dict[str, List[int]]`).
or lists, e.g. ``Dict[str, List[int]]``).
See the :ref:`lists` and :ref:`dictionaries` sections below.

.. _simple_types:

Simple types
^^^^^^^^^^^^
Simple types include
- int: numeric integers
- float: numeric floating point values
- bool: boolean values (True, False, On, Off etc)
- str: any string
- bytes: an immutable sequence of numbers in [0, 255]
- pathlib.Path: filesystem paths as represented by python's standard library `pathlib`
- Enums: User defined enums
- ``int``: numeric integers
- ``float``: numeric floating point values
- ``bool``: boolean values (True, False, On, Off etc)
- ``str``: any string
- ``bytes``: an immutable sequence of numbers in [0, 255]
- ``pathlib.Path``: filesystem paths as represented by python's standard library ``pathlib``
- ``Enums``: User defined enums

The following class defines fields with all simple types:

Expand Down

0 comments on commit 5e6b33c

Please sign in to comment.