The base reference of "bottom" variable was relative to the "top+1" and
not to the whole readlines output. It ended up without all the lines.
That could work for some gists however for the model I was looking for (see
below) the sha1 key was not being parsed, as it was missing the last line.
tested with the following gist:
longjon/
1bf3aa1e0b8e788d7e1d
with open(readme_filename) as f:
lines = [line.strip() for line in f.readlines()]
top = lines.index('---')
- bottom = lines[top + 1:].index('---')
+ bottom = lines.index('---', top + 1)
frontmatter = yaml.load('\n'.join(lines[top + 1:bottom]))
assert all(key in frontmatter for key in required_keys)
return dirname, frontmatter