Mercurial > repos > shellac > sam_consensus_v3
annotate env/lib/python3.9/site-packages/pyaml-20.4.0.dist-info/METADATA @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
| author | shellac | 
|---|---|
| date | Mon, 22 Mar 2021 18:12:50 +0000 | 
| parents | |
| children | 
| rev | line source | 
|---|---|
| 0 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 1 Metadata-Version: 2.1 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 2 Name: pyaml | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 3 Version: 20.4.0 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 4 Summary: PyYAML-based module to produce pretty and readable YAML-serialized data | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 5 Home-page: https://github.com/mk-fg/pretty-yaml | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 6 Author: Mike Kazantsev | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 7 Author-email: mk.fraggod@gmail.com | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 8 License: WTFPL | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 9 Keywords: yaml serialization pretty print format human readable readability | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 10 Platform: UNKNOWN | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 11 Classifier: Development Status :: 4 - Beta | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 12 Classifier: Intended Audience :: Developers | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 13 Classifier: Programming Language :: Python | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 14 Classifier: Programming Language :: Python :: 2.7 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 15 Classifier: Programming Language :: Python :: 3.5 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 16 Classifier: Topic :: Software Development | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 17 Classifier: Topic :: Software Development :: Libraries :: Python Modules | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 18 Requires-Dist: PyYAML | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 19 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 20 pretty-yaml (or pyaml) | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 21 ====================== | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 22 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 23 PyYAML-based python module to produce pretty and readable YAML-serialized data. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 24 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 25 This module is for serialization only, see `ruamel.yaml`_ module for literate | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 26 YAML parsing (keeping track of comments, spacing, line/column numbers of values, etc). | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 27 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 28 [note: to dump stuff parsed by ruamel.yaml with this module, use only ``YAML(typ='safe')`` there] | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 29 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 30 .. contents:: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 31 :backlinks: none | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 32 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 33 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 34 Warning | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 35 ------- | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 36 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 37 Prime goal of this module is to produce human-readable output that can be easily | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 38 manipulated and re-used, but maybe with some occasional caveats. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 39 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 40 One good example of such "caveat" is that e.g. ``{'foo': '123'}`` will serialize | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 41 to ``foo: 123``, which for PyYAML would be a bug, as 123 will then be read back | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 42 as an integer from that, but here it's a feature. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 43 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 44 So please do not rely on the thing to produce output that can always be | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 45 deserialized exactly to what was exported, at least - use PyYAML (e.g. with | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 46 options from the next section) for that. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 47 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 48 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 49 What this module does and why | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 50 ----------------------------- | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 51 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 52 YAML is generally nice and easy format to read *if* it was written by humans. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 53 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 54 PyYAML can a do fairly decent job of making stuff readable, and the best | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 55 combination of parameters for such output that I've seen so far is probably this one:: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 56 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 57 >>> m = [123, 45.67, {1: None, 2: False}, u'some text'] | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 58 >>> data = dict(a=u'asldnsa\nasldpáknsa\n', b=u'whatever text', ma=m, mb=m) | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 59 >>> yaml.safe_dump(data, sys.stdout, allow_unicode=True, default_flow_style=False) | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 60 a: 'asldnsa | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 61 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 62 asldpáknsa | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 63 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 64 ' | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 65 b: whatever text | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 66 ma: &id001 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 67 - 123 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 68 - 45.67 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 69 - 1: null | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 70 2: false | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 71 - some text | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 72 mb: *id001 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 73 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 74 pyaml tries to improve on that a bit, with the following tweaks: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 75 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 76 * Most human-friendly representation options in PyYAML (that I know of) get | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 77 picked as defaults. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 78 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 79 * Does not dump "null" values, if possible, replacing these with just empty | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 80 strings, which have the same meaning but reduce visual clutter and are easier | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 81 to edit. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 82 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 83 * Dicts, sets, OrderedDicts, defaultdicts, namedtuples, etc are representable | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 84 and get sorted on output (OrderedDicts and namedtuples keep their ordering), | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 85 so that output would be as diff-friendly as possible, and not arbitrarily | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 86 depend on python internals. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 87 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 88 It appears that at least recent PyYAML versions also do such sorting for | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 89 python dicts. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 90 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 91 * List items get indented, as they should be. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 92 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 93 * bytestrings that can't be auto-converted to unicode raise error, as yaml has | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 94 no "binary bytes" (i.e. unix strings) type. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 95 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 96 * Attempt is made to pick more readable string representation styles, depending | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 97 on the value, e.g.:: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 98 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 99 >>> yaml.safe_dump(cert, sys.stdout) | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 100 cert: '-----BEGIN CERTIFICATE----- | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 101 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 102 MIIH3jCCBcagAwIBAgIJAJi7AjQ4Z87OMA0GCSqGSIb3DQEBCwUAMIHBMRcwFQYD | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 103 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 104 VQQKFA52YWxlcm9uLm5vX2lzcDEeMBwGA1UECxMVQ2VydGlmaWNhdGUgQXV0aG9y | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 105 ... | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 106 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 107 >>> pyaml.p(cert): | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 108 cert: | | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 109 -----BEGIN CERTIFICATE----- | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 110 MIIH3jCCBcagAwIBAgIJAJi7AjQ4Z87OMA0GCSqGSIb3DQEBCwUAMIHBMRcwFQYD | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 111 VQQKFA52YWxlcm9uLm5vX2lzcDEeMBwGA1UECxMVQ2VydGlmaWNhdGUgQXV0aG9y | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 112 ... | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 113 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 114 * "force_embed" option to avoid having &id stuff scattered all over the output | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 115 (which might be beneficial in some cases, hence the option). | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 116 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 117 * "&id" anchors, if used, get labels from the keys they get attached to, | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 118 not just use meaningless enumerators. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 119 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 120 * "string_val_style" option to only apply to strings that are values, not keys, | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 121 i.e:: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 122 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 123 >>> pyaml.p(data, string_val_style='"') | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 124 key: "value\nasldpáknsa\n" | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 125 >>> yaml.safe_dump(data, sys.stdout, allow_unicode=True, default_style='"') | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 126 "key": "value\nasldpáknsa\n" | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 127 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 128 * "sort_dicts=False" option to leave dict item ordering to python, and not | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 129 force-sort them in yaml output, which can be important for python 3.6+ where | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 130 they retain ordering info. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 131 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 132 * Has an option to add vertical spacing (empty lines) between keys on different | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 133 depths, to make output much more seekable. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 134 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 135 Result for the (rather meaningless) example above (without any additional | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 136 tweaks):: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 137 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 138 >>> pyaml.p(data) | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 139 a: | | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 140 asldnsa | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 141 asldpáknsa | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 142 b: 'whatever text' | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 143 ma: &ma | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 144 - 123 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 145 - 45.67 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 146 - 1: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 147 2: false | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 148 - 'some text' | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 149 mb: *ma | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 150 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 151 ---------- | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 152 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 153 Extended example:: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 154 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 155 >>> pyaml.dump(conf, sys.stdout, vspacing=[2, 1]): | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 156 destination: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 157 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 158 encoding: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 159 xz: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 160 enabled: true | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 161 min_size: 5120 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 162 options: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 163 path_filter: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 164 - \.(gz|bz2|t[gb]z2?|xz|lzma|7z|zip|rar)$ | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 165 - \.(rpm|deb|iso)$ | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 166 - \.(jpe?g|gif|png|mov|avi|ogg|mkv|webm|mp[34g]|flv|flac|ape|pdf|djvu)$ | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 167 - \.(sqlite3?|fossil|fsl)$ | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 168 - \.git/objects/[0-9a-f]+/[0-9a-f]+$ | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 169 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 170 result: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 171 append_to_file: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 172 append_to_lafs_dir: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 173 print_to_stdout: true | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 174 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 175 url: http://localhost:3456/uri | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 176 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 177 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 178 filter: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 179 - /(CVS|RCS|SCCS|_darcs|\{arch\})/$ | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 180 - /\.(git|hg|bzr|svn|cvs)(/|ignore|attributes|tags)?$ | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 181 - /=(RELEASE-ID|meta-update|update)$ | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 182 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 183 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 184 http: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 185 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 186 ca_certs_files: /etc/ssl/certs/ca-certificates.crt | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 187 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 188 debug_requests: false | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 189 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 190 request_pool_options: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 191 cachedConnectionTimeout: 600 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 192 maxPersistentPerHost: 10 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 193 retryAutomatically: true | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 194 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 195 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 196 logging: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 197 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 198 formatters: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 199 basic: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 200 datefmt: '%Y-%m-%d %H:%M:%S' | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 201 format: '%(asctime)s :: %(name)s :: %(levelname)s: %(message)s' | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 202 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 203 handlers: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 204 console: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 205 class: logging.StreamHandler | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 206 formatter: basic | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 207 level: custom | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 208 stream: ext://sys.stderr | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 209 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 210 loggers: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 211 twisted: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 212 handlers: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 213 - console | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 214 level: 0 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 215 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 216 root: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 217 handlers: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 218 - console | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 219 level: custom | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 220 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 221 Note that unless there are many moderately wide and deep trees of data, which | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 222 are expected to be read and edited by people, it might be preferrable to | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 223 directly use PyYAML regardless, as it won't introduce another (rather pointless | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 224 in that case) dependency and a point of failure. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 225 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 226 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 227 Some Tricks | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 228 ----------- | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 229 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 230 * Pretty-print any yaml or json (yaml subset) file from the shell:: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 231 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 232 % python -m pyaml /path/to/some/file.yaml | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 233 % curl -s https://www.githubstatus.com/api/v2/summary.json | python -m pyaml | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 234 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 235 * Process and replace json/yaml file in-place:: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 236 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 237 % python -m pyaml -r file-with-json.data | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 238 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 239 * Easier "debug printf" for more complex data (all funcs below are aliases to | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 240 same thing):: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 241 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 242 pyaml.p(stuff) | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 243 pyaml.pprint(my_data) | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 244 pyaml.pprint('----- HOW DOES THAT BREAKS!?!?', input_data, some_var, more_stuff) | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 245 pyaml.print(data, file=sys.stderr) # needs "from __future__ import print_function" | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 246 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 247 * Force all string values to a certain style (see info on these in | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 248 `PyYAML docs`_):: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 249 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 250 pyaml.dump(many_weird_strings, string_val_style='|') | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 251 pyaml.dump(multiline_words, string_val_style='>') | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 252 pyaml.dump(no_want_quotes, string_val_style='plain') | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 253 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 254 Using ``pyaml.add_representer()`` (note \*p\*yaml) as suggested in | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 255 `this SO thread`_ (or `github-issue-7`_) should also work. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 256 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 257 * Control indent and width of the results:: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 258 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 259 pyaml.dump(wide_and_deep, indent=4, width=120) | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 260 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 261 These are actually keywords for PyYAML Emitter (passed to it from Dumper), | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 262 see more info on these in `PyYAML docs`_. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 263 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 264 * Dump multiple yaml documents into a file: ``pyaml.dump_all([data1, data2, data3], dst_file)`` | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 265 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 266 explicit_start=True is implied, unless explicit_start=False is passed. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 267 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 268 .. _PyYAML docs: http://pyyaml.org/wiki/PyYAMLDocumentation#Scalars | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 269 .. _this SO thread: http://stackoverflow.com/a/7445560 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 270 .. _github-issue-7: https://github.com/mk-fg/pretty-yaml/issues/7 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 271 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 272 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 273 Installation | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 274 ------------ | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 275 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 276 It's a regular package for Python (3.x or 2.x). | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 277 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 278 Module uses PyYAML_ for processing of the actual YAML files and should pull it | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 279 in as a dependency. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 280 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 281 Dependency on unidecode_ module is optional and should only be necessary if | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 282 same-id objects or recursion is used within serialized data. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 283 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 284 Be sure to use python3/python2, pip3/pip2, easy_install-... binaries below, | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 285 based on which python version you want to install the module for, if you have | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 286 several on the system (as is norm these days for py2-py3 transition). | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 287 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 288 Using pip_ is the best way:: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 289 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 290 % pip install pyaml | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 291 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 292 (add --user option to install into $HOME for current user only) | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 293 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 294 Or, if you don't have "pip" command:: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 295 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 296 % python -m ensurepip | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 297 % python -m pip install --upgrade pip | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 298 % python -m pip install pyaml | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 299 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 300 (same suggestion wrt "install --user" as above) | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 301 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 302 On a very old systems, one of these might work:: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 303 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 304 % curl https://bootstrap.pypa.io/get-pip.py | python | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 305 % pip install pyaml | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 306 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 307 % easy_install pyaml | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 308 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 309 % git clone --depth=1 https://github.com/mk-fg/pretty-yaml | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 310 % cd pretty-yaml | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 311 % python setup.py install | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 312 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 313 (all of install-commands here also have --user option, | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 314 see also `pip docs "installing" section`_) | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 315 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 316 Current-git version can be installed like this:: | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 317 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 318 % pip install 'git+https://github.com/mk-fg/pretty-yaml#egg=pyaml' | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 319 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 320 Note that to install stuff to system-wide PATH and site-packages (without | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 321 --user), elevated privileges (i.e. root and su/sudo) are often required. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 322 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 323 Use "...install --user", `~/.pydistutils.cfg`_ or virtualenv_ to do unprivileged | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 324 installs into custom paths. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 325 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 326 More info on python packaging can be found at `packaging.python.org`_. | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 327 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 328 .. _ruamel.yaml: https://bitbucket.org/ruamel/yaml/ | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 329 .. _PyYAML: http://pyyaml.org/ | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 330 .. _unidecode: http://pypi.python.org/pypi/Unidecode | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 331 .. _pip: http://pip-installer.org/ | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 332 .. _pip docs "installing" section: http://www.pip-installer.org/en/latest/installing.html | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 333 .. _~/.pydistutils.cfg: http://docs.python.org/install/index.html#distutils-configuration-files | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 334 .. _virtualenv: http://pypi.python.org/pypi/virtualenv | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 335 .. _packaging.python.org: https://packaging.python.org/installing/ | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 336 | 
| 
4f3585e2f14b
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
 shellac parents: diff
changeset | 337 | 
