Commit 9170bc4b authored by Jonathan Klimt's avatar Jonathan Klimt Committed by Jonathan Klimt
Browse files

Adapted set_inheritance_diagram.py so that it does not set the inheritance...

Adapted set_inheritance_diagram.py so that it does not set the inheritance diagram multiple times and does not modify files unnecessary.
parent 700c7481
......@@ -22,23 +22,27 @@ for file in os.listdir(directory):
if file.endswith(".rst"):
file_path = os.path.abspath(file)
fh, abs_path = mkstemp()
found_inheritance = False
with open(fh, 'w') as new_file:
with open(os.path.join(directory, file)) as old_file:
for line in old_file:
if 'undoc-members' in line:
continue
else:
new_file.write(line)
if 'automodule' in line:
name = line.split('::')[1]
elif 'show-inheritance' in line:
if 'show-inheritance' in line:
new_file.write('\nInheritance Diagram:\n')
new_file.write('""""""""""""""""""""\n')
new_file.write('.. inheritance-diagram:: ' + name)
new_file.write(' :parts: 1\n')
new_file.write('')
new_file.write('')
found_inheritance = True
else:
new_file.write(line)
remove(os.path.join(directory, file))
move(abs_path, os.path.join(directory, file))
if found_inheritance:
remove(os.path.join(directory, file))
move(abs_path, os.path.join(directory, file))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment