Coverage for lib/ansible/parsing/plugin_docs.py : 67%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# Copyright (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
""" Search for assignment of the DOCUMENTATION and EXAMPLES variables in the given file. Parse DOCUMENTATION from YAML and return the YAML doc or None together with EXAMPLES, as plain text. """
'doc': None, 'plainexamples': None, 'returndocs': None, 'metadata': None }
'DOCUMENTATION': 'doc', 'EXAMPLES': 'plainexamples', 'RETURN': 'returndocs', }
except AttributeError: # skip errors can happen when trying to use the normal code display.warning("Failed to assign id for %s on %s, skipping" % (t, filename)) continue
data[varkey] = ast.literal_eval(child.value) else: # string should be yaml else: # not yaml, should be a simple string
# Metadata is per-file and a dict rather than per-plugin/function and yaml
# remove version for x in ('version', 'metadata_version'): if x in data['metadata']: del data['metadata'][x] except: if verbose: display.error("unable to parse %s" % filename) if not ignore_errors: raise
|