From fda9229a426d9c0e4496c700099a7126da72ba64 Mon Sep 17 00:00:00 2001 From: Gustavo Serra Scalet Date: Thu, 6 Aug 2015 14:37:20 -0300 Subject: [PATCH] Fix download model binary script to get correct lines on parsing table 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 --- scripts/download_model_binary.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/download_model_binary.py b/scripts/download_model_binary.py index 48e9015..03a50f6 100755 --- a/scripts/download_model_binary.py +++ b/scripts/download_model_binary.py @@ -32,7 +32,7 @@ def parse_readme_frontmatter(dirname): 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 -- 2.7.4