18574: Fixes documentation formatting.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Wed, 2 Mar 2022 21:44:34 +0000 (18:44 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Wed, 2 Mar 2022 21:44:34 +0000 (18:44 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

doc/sdk/python/cookbook.html.textile.liquid

index cce25f1a37b52589db9badcd3405577dc24cf0b3..f3186ebbb6d76d66221860f669960cb9737688eb 100644 (file)
@@ -304,18 +304,19 @@ h2. Querying the vocabulary definition
 The Python SDK provides facilities to interact with the "active metadata vocabulary":{{ site.baseurl }}/admin/metadata-vocabulary.html in the system. The developer can do key and value lookups in a case-insensitive manner:
 
 {% codeblock as python %}
->>> from arvados import api, vocabulary
->>> voc = vocabulary.load_vocabulary(api('v1'))
->>> [k.identifier for k in set(voc.key_aliases.values())]
-['IDTAGCOLORS', 'IDTAGFRUITS', 'IDTAGCOMMENT', 'IDTAGIMPORTANCES', 'IDTAGCATEGORIES', 'IDTAGSIZES', 'IDTAGANIMALS']
->>> voc['IDTAGSIZES'].preferred_label
-'Size'
->>> [v.preferred_label for v in set(voc['size'].value_aliases.values())]
-['S', 'M', 'L', 'XL', 'XS']
->>> voc['size']['s'].aliases
-['S', 'small']
->>> voc['size']['Small'].identifier
-'IDVALSIZES2'
+from arvados import api, vocabulary
+voc = vocabulary.load_vocabulary(api('v1'))
+
+[k.identifier for k in set(voc.key_aliases.values())]
+# Example output: ['IDTAGCOLORS', 'IDTAGFRUITS', 'IDTAGCOMMENT', 'IDTAGIMPORTANCES', 'IDTAGCATEGORIES', 'IDTAGSIZES', 'IDTAGANIMALS']
+voc['IDTAGSIZES'].preferred_label
+# Example output: 'Size'
+[v.preferred_label for v in set(voc['size'].value_aliases.values())]
+# Example output: ['S', 'M', 'L', 'XL', 'XS']
+voc['size']['s'].aliases
+# Example output: ['S', 'small']
+voc['size']['Small'].identifier
+# Example output: 'IDVALSIZES2'
 {% endcodeblock %}
 
 h2. Translating between vocabulary identifiers and labels
@@ -323,8 +324,11 @@ h2. Translating between vocabulary identifiers and labels
 Client software might need to present properties to the user in a human-readable form or take input from the user without requiring them to remember identifiers. For these cases, there're a couple of conversion methods that take a dictionary as input like this:
 
 {% codeblock as python %}
->>> voc.convert_to_labels({'IDTAGIMPORTANCES': 'IDVALIMPORTANCES1'})
-{'Importance': 'Critical'}
->>> voc.convert_to_identifiers({'creature': 'elephant'})
-{'IDTAGANIMALS': 'IDVALANIMALS3'}
+from arvados import api, vocabulary
+voc = vocabulary.load_vocabulary(api('v1'))
+
+voc.convert_to_labels({'IDTAGIMPORTANCES': 'IDVALIMPORTANCES1'})
+# Example output: {'Importance': 'Critical'}
+voc.convert_to_identifiers({'creature': 'elephant'})
+# Example output: {'IDTAGANIMALS': 'IDVALANIMALS3'}
 {% endcodeblock %}
\ No newline at end of file