Mercurial > hgrepos > Python > libs > ConfigMix
comparison doc/introduction.rst @ 134:2f2e819e8d17
Check the return type of the JSON and YAML loading functions: they must be a dict alike
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Thu, 05 Apr 2018 09:12:29 +0200 |
| parents | 05cb18c8697a |
| children | c87b0dc54e1d |
comparison
equal
deleted
inserted
replaced
| 133:05cb18c8697a | 134:2f2e819e8d17 |
|---|---|
| 20 | 20 |
| 21 Need the :mod:`yaml` package (e.g. ``pip install pyyaml``) | 21 Need the :mod:`yaml` package (e.g. ``pip install pyyaml``) |
| 22 | 22 |
| 23 .. note:: All strings are returned as Unicode text strings. | 23 .. note:: All strings are returned as Unicode text strings. |
| 24 | 24 |
| 25 .. note:: The root object must be a *mapping* and therefore decode into | 25 .. note:: The root object must be a *mapping* and therefore decode |
| 26 a Python :class:`dict` alike. | 26 into a Python :class:`dict` alike. This is checked by the |
| 27 implementation. | |
| 27 | 28 |
| 28 An example is: | 29 An example is: |
| 29 | 30 |
| 30 .. literalinclude:: ../tests/data/conf10.yml | 31 .. literalinclude:: ../tests/data/conf10.yml |
| 31 :language: yaml | 32 :language: yaml |
| 38 | 39 |
| 39 Read the JSON file with the help of Python's native :mod:`json` package. | 40 Read the JSON file with the help of Python's native :mod:`json` package. |
| 40 | 41 |
| 41 .. note:: All strings are returned as Unicode text strings. | 42 .. note:: All strings are returned as Unicode text strings. |
| 42 | 43 |
| 43 .. note:: The root object must be an *object* and therefore decode into | 44 .. note:: The root object must be an *object* and therefore decode |
| 44 a Python :class:`dict` alike. | 45 into a Python :class:`dict` alike. This is checked by the |
| 46 implementation. | |
| 45 | 47 |
| 46 .. todo:: Handle JSON comments by special attributes which will | 48 .. todo:: Handle JSON comments by special attributes which will |
| 47 filtered out on further processing. Javascript comments are | 49 filtered out on further processing. Javascript comments are |
| 48 not allowed by the JSON specification. | 50 not allowed by the JSON specification. |
| 49 | 51 |
