From 9cbea5fcba6785ecb617103a67d76707e1dbc3cd Mon Sep 17 00:00:00 2001 From: Rishabh Raj Date: Mon, 14 Apr 2014 02:59:00 +0530 Subject: [PATCH] Fix to incorporate a more generalised duplicate removal and JSON dump to string --- doc/ext/notebook.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/ext/notebook.py b/doc/ext/notebook.py index bb2a6c1c215..9efe122e6cb 100644 --- a/doc/ext/notebook.py +++ b/doc/ext/notebook.py @@ -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 @@ -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): @@ -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())