|
|
@ -52,7 +52,13 @@ def get_docstring(filename, verbose=False):
|
|
|
|
M = ast.parse(''.join(open(filename)))
|
|
|
|
M = ast.parse(''.join(open(filename)))
|
|
|
|
for child in M.body:
|
|
|
|
for child in M.body:
|
|
|
|
if isinstance(child, ast.Assign):
|
|
|
|
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)
|
|
|
|
doc = yaml.safe_load(child.value.s)
|
|
|
|
fragments = doc.get('extends_documentation_fragment', [])
|
|
|
|
fragments = doc.get('extends_documentation_fragment', [])
|
|
|
|
|
|
|
|
|
|
|
@ -98,10 +104,10 @@ def get_docstring(filename, verbose=False):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raise Exception("Attempt to extend a documentation fragement of unknown type")
|
|
|
|
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
|
|
|
|
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:]
|
|
|
|
returndocs = child.value.s[1:]
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
traceback.print_exc() # temp
|
|
|
|
traceback.print_exc() # temp
|
|
|
|