|
|
|
@ -52,7 +52,13 @@ def get_docstring(filename, verbose=False):
|
|
|
|
|
M = ast.parse(''.join(open(filename)))
|
|
|
|
|
for child in M.body:
|
|
|
|
|
if isinstance(child, ast.Assign):
|
|
|
|
|
if 'DOCUMENTATION' in (t.id for t in child.targets):
|
|
|
|
|
for t in child.targets:
|
|
|
|
|
try:
|
|
|
|
|
theid = t.id
|
|
|
|
|
except AttributeError as e:
|
|
|
|
|
continue #TODO: should log these to figure out why this happens
|
|
|
|
|
|
|
|
|
|
if 'DOCUMENTATION' in theid:
|
|
|
|
|
doc = yaml.safe_load(child.value.s)
|
|
|
|
|
fragments = doc.get('extends_documentation_fragment', [])
|
|
|
|
|
|
|
|
|
@ -98,10 +104,10 @@ def get_docstring(filename, verbose=False):
|
|
|
|
|
else:
|
|
|
|
|
raise Exception("Attempt to extend a documentation fragement of unknown type")
|
|
|
|
|
|
|
|
|
|
if 'EXAMPLES' in (t.id for t in child.targets):
|
|
|
|
|
elif 'EXAMPLES' in theid:
|
|
|
|
|
plainexamples = child.value.s[1:] # Skip first empty line
|
|
|
|
|
|
|
|
|
|
if 'RETURN' in (t.id for t in child.targets):
|
|
|
|
|
elif 'RETURN' in theid:
|
|
|
|
|
returndocs = child.value.s[1:]
|
|
|
|
|
except:
|
|
|
|
|
traceback.print_exc() # temp
|
|
|
|
|