コード例 #1
0
ファイル: sagenb_reader.py プロジェクト: minrk/ExportSageNB
 def __init__(self, path):
     log.debug('opening notebook root directory: %s', path)
     self.path = path
     with open(os.path.join(path, 'worksheet.html'), 'rb') as f:
         self.ws = f.read().decode('utf-8')
     with open(os.path.join(path, 'worksheet_conf.pickle')) as f:
         self.conf = cPickle.load(f)
コード例 #2
0
ファイル: sagenb_reader.py プロジェクト: nthiery/ExportSageNB
 def __init__(self, path):
     log.debug('opening notebook root directory: %s', path)
     self.path = path
     with open(os.path.join(path, 'worksheet.html'), 'rb') as f:
         self.ws = f.read().decode('utf-8')
     with open(os.path.join(path, 'worksheet_conf.pickle')) as f:
         self.conf = cPickle.load(f)
コード例 #3
0
ファイル: sagenb_reader.py プロジェクト: minrk/ExportSageNB
 def _read_cell_output(self):
     assert self.is_cell_mid
     self.pos += 1
     accumulator = []
     while not (self.is_cell_back or self.is_finished):
         log.debug('Read cell output: %s', self.line)
         accumulator.append(self.get_line_and_forward())
     return unescape(u'\n'.join(accumulator).strip())
コード例 #4
0
ファイル: sagenb_reader.py プロジェクト: minrk/ExportSageNB
 def _try_read_text(self):
     accumulator = []
     while not (self.is_cell_front or self.is_finished):
         log.debug('Read text: %s', self.line)
         accumulator.append(self.get_line_and_forward())
     accumulator = u'\n'.join(accumulator).strip()
     if accumulator:
         return TextCell(accumulator)
コード例 #5
0
ファイル: sagenb_reader.py プロジェクト: nthiery/ExportSageNB
 def _read_cell_output(self):
     assert self.is_cell_mid
     self.pos += 1
     accumulator = []
     while not (self.is_cell_back or self.is_finished):
         log.debug('Read cell output: %s', self.line)
         accumulator.append(self.get_line_and_forward())
     return unescape(u'\n'.join(accumulator).strip())
コード例 #6
0
ファイル: sagenb_reader.py プロジェクト: nthiery/ExportSageNB
 def _try_read_text(self):
     accumulator = []
     while not (self.is_cell_front or self.is_finished):
         log.debug('Read text: %s', self.line)
         accumulator.append(self.get_line_and_forward())
     accumulator = u'\n'.join(accumulator).strip()
     if accumulator:
         return TextCell(accumulator)
コード例 #7
0
ファイル: sagenb_reader.py プロジェクト: minrk/ExportSageNB
 def __init__(self, worksheet_html):
     self.worksheet_lines = worksheet_html.splitlines()
     self.pos = 0
     self.index = -1
     log.debug('Worksheet has %s lines', len(self.worksheet_lines))
コード例 #8
0
ファイル: sagenb_reader.py プロジェクト: minrk/ExportSageNB
 def cells(self):
     for cell in WorksheetParser(self.ws):
         log.debug('Cell: %s', cell)
         yield cell
コード例 #9
0
ファイル: sagenb_reader.py プロジェクト: nthiery/ExportSageNB
 def __init__(self, worksheet_html):
     self.worksheet_lines = worksheet_html.splitlines()
     self.pos = 0
     self.index = -1
     log.debug('Worksheet has %s lines', len(self.worksheet_lines))
コード例 #10
0
ファイル: sagenb_reader.py プロジェクト: nthiery/ExportSageNB
 def cells(self):
     for cell in WorksheetParser(self.ws):
         log.debug('Cell: %s', cell)
         yield cell