fix merge

pull/72635/head
Brian Coca 2 years ago
parent 17ff64ff4e
commit f27f5724fe

@ -127,6 +127,7 @@ def read_docstring_from_python_file(filename, verbose=True, ignore_errors=True):
""" """
data = _init_doc_dict() data = _init_doc_dict()
try: try:
with open(filename, 'rb') as b_module_data: with open(filename, 'rb') as b_module_data:
M = ast.parse(b_module_data.read()) M = ast.parse(b_module_data.read())
@ -141,8 +142,8 @@ def read_docstring_from_python_file(filename, verbose=True, ignore_errors=True):
display.warning("Building documentation, failed to assign id for %s on %s, skipping" % (t, filename)) display.warning("Building documentation, failed to assign id for %s on %s, skipping" % (t, filename))
continue continue
if theid in DOCSTRING_TO_VAR: if theid in string_to_vars:
varkey = DOCSTRING_TO_VAR[theid] varkey = string_to_vars[theid]
if isinstance(child.value, ast.Dict): if isinstance(child.value, ast.Dict):
data[varkey] = ast.literal_eval(child.value) data[varkey] = ast.literal_eval(child.value)
else: else:

@ -30,6 +30,7 @@ from ansible.module_utils.common._collections_compat import Mapping
from ansible.module_utils.compat.importlib import import_module from ansible.module_utils.compat.importlib import import_module
from ansible.module_utils.six import string_types from ansible.module_utils.six import string_types
from ansible.parsing.utils.yaml import from_yaml from ansible.parsing.utils.yaml import from_yaml
from ansible.parsing.yaml.loader import AnsibleLoader
from ansible.plugins import get_plugin_class, MODULE_CACHE, PATH_CACHE, PLUGIN_PATH_CACHE from ansible.plugins import get_plugin_class, MODULE_CACHE, PATH_CACHE, PLUGIN_PATH_CACHE
from ansible.utils.collection_loader import AnsibleCollectionConfig, AnsibleCollectionRef from ansible.utils.collection_loader import AnsibleCollectionConfig, AnsibleCollectionRef
from ansible.utils.collection_loader._collection_finder import _AnsibleCollectionFinder, _get_collection_metadata from ansible.utils.collection_loader._collection_finder import _AnsibleCollectionFinder, _get_collection_metadata

@ -11,7 +11,7 @@ from ansible.release import __version__ as ansible_version
from ansible.errors import AnsibleError, AnsibleParserError, AnsiblePluginNotFound from ansible.errors import AnsibleError, AnsibleParserError, AnsiblePluginNotFound
from ansible.module_utils.six import string_types from ansible.module_utils.six import string_types
from ansible.module_utils.common.text.converters import to_native from ansible.module_utils.common.text.converters import to_native
from ansible.parsing.plugin_docs import read_docstring from ansible.parsing.plugin_docs import read_docstring, string_to_vars
from ansible.module_utils.common._collections_compat import MutableMapping, MutableSet, MutableSequence from ansible.module_utils.common._collections_compat import MutableMapping, MutableSet, MutableSequence
from ansible.parsing.yaml.loader import AnsibleLoader from ansible.parsing.yaml.loader import AnsibleLoader
@ -234,7 +234,7 @@ def get_docstring(filename, fragment_loader, verbose=False, ignore_errors=False,
data = read_docstring(filename, verbose=verbose, ignore_errors=ignore_errors) data = read_docstring(filename, verbose=verbose, ignore_errors=ignore_errors)
for section in FRAGMENTS: for section in FRAGMENTS:
key = DOCSTRING_TO_VAR[section] key = string_to_vars[section]
if data.get(key, False): if data.get(key, False):
# add fragments to documentation # add fragments to documentation
@ -281,12 +281,7 @@ def get_versioned_doclink(path):
return '(unable to create versioned doc link for path {0}: {1})'.format(path, to_native(ex)) return '(unable to create versioned doc link for path {0}: {1})'.format(path, to_native(ex))
<<<<<<< HEAD
def _find_adjacent(path, plugin, extensions): def _find_adjacent(path, plugin, extensions):
=======
def get_pymodule_docs(pymodule, path=None, section=None, floader=None):
''' faster method that gets docs from loaded python module '''
>>>>>>> af01693d20 (add path to keep it 'relative')
adjacent = Path(path) adjacent = Path(path)

Loading…
Cancel
Save