fragments can now be a list
This commit is contained in:
parent
ea159ef9de
commit
42e355f9a3
1 changed files with 11 additions and 9 deletions
|
@ -54,19 +54,21 @@ def get_docstring(filename, verbose=False):
|
||||||
if isinstance(child, ast.Assign):
|
if isinstance(child, ast.Assign):
|
||||||
if 'DOCUMENTATION' in (t.id for t in child.targets):
|
if 'DOCUMENTATION' in (t.id for t in child.targets):
|
||||||
doc = yaml.safe_load(child.value.s)
|
doc = yaml.safe_load(child.value.s)
|
||||||
fragment_slug = doc.get('extends_documentation_fragment',
|
fragments = doc.get('extends_documentation_fragment', [])
|
||||||
'doesnotexist').lower()
|
|
||||||
|
if isinstance(fragments, basestring):
|
||||||
|
fragments = [ fragments ]
|
||||||
|
|
||||||
# Allow the module to specify a var other than DOCUMENTATION
|
# Allow the module to specify a var other than DOCUMENTATION
|
||||||
# to pull the fragment from, using dot notation as a separator
|
# to pull the fragment from, using dot notation as a separator
|
||||||
if '.' in fragment_slug:
|
for fragment_slug in fragments:
|
||||||
fragment_name, fragment_var = fragment_slug.split('.', 1)
|
fragment_slug = fragment_slug.lower()
|
||||||
fragment_var = fragment_var.upper()
|
if '.' in fragment_slug:
|
||||||
else:
|
fragment_name, fragment_var = fragment_slug.split('.', 1)
|
||||||
fragment_name, fragment_var = fragment_slug, 'DOCUMENTATION'
|
fragment_var = fragment_var.upper()
|
||||||
|
else:
|
||||||
|
fragment_name, fragment_var = fragment_slug, 'DOCUMENTATION'
|
||||||
|
|
||||||
|
|
||||||
if fragment_slug != 'doesnotexist':
|
|
||||||
fragment_class = fragment_loader.get(fragment_name)
|
fragment_class = fragment_loader.get(fragment_name)
|
||||||
assert fragment_class is not None
|
assert fragment_class is not None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue