gen_vimdoc.py: lint #11593

This commit is contained in:
Daniel Hahler 2019-12-23 07:08:49 +01:00 committed by Justin M. Keyes
parent d6593d850a
commit 2e280dac7d

View File

@ -141,7 +141,7 @@ def debug_this(cond, o):
try: try:
name = o.nodeName name = o.nodeName
o = o.toprettyxml(indent=' ', newl='\n') o = o.toprettyxml(indent=' ', newl='\n')
except: except Exception:
pass pass
if ((callable(cond) and cond()) if ((callable(cond) and cond())
or (not callable(cond) and cond in o)): or (not callable(cond) and cond in o)):
@ -271,8 +271,6 @@ def doc_wrap(text, prefix='', width=70, func=False, indent=None):
return result return result
def update_params_map(parent, ret_map, width=62): def update_params_map(parent, ret_map, width=62):
"""Updates `ret_map` with name:desc key-value pairs extracted """Updates `ret_map` with name:desc key-value pairs extracted
from Doxygen XML node `parent`. from Doxygen XML node `parent`.
@ -293,8 +291,7 @@ def update_params_map(parent, ret_map, width=62):
desc = '' desc = ''
desc_node = get_child(node, 'parameterdescription') desc_node = get_child(node, 'parameterdescription')
if desc_node: if desc_node:
desc = fmt_node_as_vimhelp(desc_node, width=width, desc = fmt_node_as_vimhelp(desc_node, width=width, indent=(" " * len(name)))
indent=(' ' * len(name)))
ret_map[name] = desc ret_map[name] = desc
return ret_map return ret_map
@ -399,8 +396,9 @@ def para_as_map(parent, indent='', width=62):
} }
if is_inline(parent): if is_inline(parent):
chunks['text'] = clean_lines(doc_wrap(render_node(parent, ''), chunks["text"] = clean_lines(
indent=indent, width=width).strip()) doc_wrap(render_node(parent, ""), indent=indent, width=width).strip()
)
# Ordered dict of ordered lists. # Ordered dict of ordered lists.
groups = collections.OrderedDict([ groups = collections.OrderedDict([
@ -606,7 +604,7 @@ def extract_from_xml(filename, mode, fmt_vimhelp):
desc = find_first(member, 'detaileddescription') desc = find_first(member, 'detaileddescription')
if desc: if desc:
for child in desc.childNodes: for child in desc.childNodes:
paras.append(para_as_map(child)) #, width=width, indent=indent)) paras.append(para_as_map(child))
if DEBUG: if DEBUG:
print(textwrap.indent( print(textwrap.indent(
re.sub(r'\n\s*\n+', '\n', re.sub(r'\n\s*\n+', '\n',