diff options
author | W. Trevor King <wking@drexel.edu> | 2010-02-07 17:53:53 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2010-02-07 17:53:53 -0500 |
commit | 977eff5af10b50ba6e6edb6abc4f40804c418b12 (patch) | |
tree | 77bd3dea340130bb1b446d5f7cc8d72000b5fba3 /libbe/storage/util/mapfile.py | |
parent | 8ccb71280c24480eb661fc668c31ff06bc7a3148 (diff) | |
download | bugseverywhere-977eff5af10b50ba6e6edb6abc4f40804c418b12.tar.gz |
Fixed docstrings so only Sphinx errors are "autosummary" and "missing attribute"
Diffstat (limited to 'libbe/storage/util/mapfile.py')
-rw-r--r-- | libbe/storage/util/mapfile.py | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/libbe/storage/util/mapfile.py b/libbe/storage/util/mapfile.py index 0b8af23..55863d7 100644 --- a/libbe/storage/util/mapfile.py +++ b/libbe/storage/util/mapfile.py @@ -16,10 +16,10 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -""" -Provide a means of saving and loading dictionaries of parameters. The -saved "mapfiles" should be clear, flat-text files, and allow easy merging of -independent/conflicting changes. +"""Serializing and deserializing dictionaries of parameters. + +The serialized "mapfiles" should be clear, flat-text strings, and allow +easy merging of independent/conflicting changes. """ import errno @@ -49,6 +49,10 @@ class InvalidMapfileContents(Exception): def generate(map): """Generate a YAML mapfile content string. + + Examples + -------- + >>> generate({'q':'p'}) 'q: p\\n\\n' >>> generate({'q':u'Fran\u00e7ais'}) @@ -73,6 +77,10 @@ def generate(map): >>> generate({'q':'p\\n'}) Traceback (most recent call last): IllegalValue: Illegal value "p\\n" + + See Also + -------- + parse : inverse """ keys = map.keys() keys.sort() @@ -97,8 +105,11 @@ def generate(map): return '\n'.join(lines) def parse(contents): - """ - Parse a YAML mapfile string. + """Parse a YAML mapfile string. + + Examples + -------- + >>> parse('q: p\\n\\n')['q'] 'p' >>> parse('q: \\'p\\'\\n\\n')['q'] @@ -119,6 +130,11 @@ def parse(contents): Traceback (most recent call last): ... InvalidMapfileContents: Invalid YAML contents + + See Also + -------- + generate : inverse + """ c = yaml.load(contents) if type(c) == types.StringType: |