Navigation Menu

Skip to content

Commit

Permalink
Fix to incorporate a more generalised duplicate removal and JSON dump…
Browse files Browse the repository at this point in the history
… to string
  • Loading branch information
sharky93 committed Apr 13, 2014
1 parent a57cf0d commit 9cbea5f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/ext/notebook.py
Expand Up @@ -49,7 +49,7 @@ def remove_continuous_duplicates(code):
"""
modified_code = []
modified_code = [self.code[i] for i in range(len(self.code)) if i == 0 or self.code[i] != self.code[i-1]]
modified_code = [code[i] for i in range(len(code)) if i == 0 or code[i] != code[i-1]]
return modified_code


Expand Down Expand Up @@ -154,7 +154,7 @@ def json(self):
The template JSON converted to a string with a two char indent.
"""
return json.dump(self.template, indent=2)
return json.dumps(self.template, indent=2)


def python_to_notebook(example_file, notebook_dir, notebook_path):
Expand Down Expand Up @@ -214,4 +214,4 @@ def python_to_notebook(example_file, notebook_dir, notebook_path):
source.append(line)

with open(notebook_path, 'w') as output:
output.write(nb.json(notebook_path))
output.write(nb.json())

0 comments on commit 9cbea5f

Please sign in to comment.