Mercurial > hgrepos > Python > libs > ConfigMix
changeset 135:b7b0cea8ec6e
Document "configmix.yaml.loadXXX()" functions
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Thu, 05 Apr 2018 09:23:44 +0200 |
| parents | 2f2e819e8d17 |
| children | eee1dd1f99bf |
| files | configmix/yaml.py |
| diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/configmix/yaml.py Thu Apr 05 09:12:29 2018 +0200 +++ b/configmix/yaml.py Thu Apr 05 09:23:44 2018 +0200 @@ -151,6 +151,10 @@ def load(stream, Loader=ConfigLoader): + """Parse the given `stream` and return a Python object constructed + from for the first document in the stream. + + """ data = yaml.load(stream, Loader) if OrderedDict: if not isinstance(data, OrderedDict): @@ -159,6 +163,10 @@ def load_all(stream, Loader=ConfigLoader): + """Parse the given `stream` and return a sequence of Python objects + corresponding to the documents in the `stream`. + + """ data_all = yaml.load_all(stream, Loader) if OrderedDict: for data in data_all: @@ -168,6 +176,13 @@ def safe_load(stream): + """Parse the given `stream` and return a Python object constructed + from for the first document in the stream. + + Recognize only standard YAML tags and cannot construct an + arbitrary Python object. + + """ data = yaml.load(stream, Loader=ConfigSafeLoader) if OrderedDict: if not isinstance(data, OrderedDict): @@ -176,6 +191,12 @@ def safe_load_all(stream): + """Return the list of all decoded YAML documents in the file `stream`. + + Recognize only standard YAML tags and cannot construct an + arbitrary Python object. + + """ data_all = yaml.load_all(stream, Loader=ConfigSafeLoader) if OrderedDict: for data in data_all:
