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
This commit is contained in:
Josh Barnes
2016-05-03 00:11:17 +01:00
parent babfa38c85
commit 2078dc64bc
+2 -4
View File
@@ -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