From 2078dc64bcd2da3d13aed57f8ea26d37b31bee69 Mon Sep 17 00:00:00 2001 From: Josh Barnes Date: Tue, 3 May 2016 00:11:17 +0100 Subject: [PATCH] remove six requirement * use explicit unicode string, which is supported in python 2 and in python 3.3+ (notebook requires at least 3.3, so we can assume this if py3 is in use at all) * use splitlines, rather than StringIO.readlines --- extensions/pre_codefolding.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/extensions/pre_codefolding.py b/extensions/pre_codefolding.py index 5b44e83..b2d4d2e 100644 --- a/extensions/pre_codefolding.py +++ b/extensions/pre_codefolding.py @@ -5,19 +5,17 @@ by the codefolding extension """ from nbconvert.preprocessors import Preprocessor -from six import StringIO, unichr class CodeFoldingPreprocessor(Preprocessor): - fold_mark = unichr(8596) + fold_mark = u'↔' def fold_cell(self, cell, folded): """ Remove folded lines and add a '<->' at the parent line """ - f = StringIO(cell) - lines = f.readlines() + lines = cell.splitlines(True) if folded[0] == 0 and (lines[0][0] == '#' or lines[0][0] == '%') : # fold whole cell when first line is a comment or magic