IPython Documentation

Table Of Contents

Previous topic

nbformat.v2.nbxml

Next topic

parallel.apps.baseapp

This Page

nbformat.v2.rwbase

Module: nbformat.v2.rwbase

Inheritance diagram for IPython.nbformat.v2.rwbase:

Base classes and utilities for readers and writers.

Authors:

  • Brian Granger

Classes

NotebookReader

class IPython.nbformat.v2.rwbase.NotebookReader

Bases: object

A class for reading notebooks.

__init__()

x.__init__(...) initializes x; see help(type(x)) for signature

read(fp, **kwargs)

Read a notebook from a file like object

reads(s, **kwargs)

Read a notebook from a string.

NotebookWriter

class IPython.nbformat.v2.rwbase.NotebookWriter

Bases: object

A class for writing notebooks.

__init__()

x.__init__(...) initializes x; see help(type(x)) for signature

write(nb, fp, **kwargs)

Write a notebook to a file like object

writes(nb, **kwargs)

Write a notebook to a string.

Functions

IPython.nbformat.v2.rwbase.base64_decode(nb)

Restore all bytes objects in the notebook from base64-encoded strings.

Note: This is never used

IPython.nbformat.v2.rwbase.base64_encode(nb)

Base64 encode all bytes objects in the notebook.

These will be b64-encoded unicode strings

Note: This is never used

IPython.nbformat.v2.rwbase.rejoin_lines(nb)

rejoin multiline text into strings

For reversing effects of split_lines(nb).

This only rejoins lines that have been split, so if text objects were not split they will pass through unchanged.

Used when reading JSON files that may have been passed through split_lines.

IPython.nbformat.v2.rwbase.restore_bytes(nb)

Restore bytes of image data from unicode-only formats.

Base64 encoding is handled elsewhere. Bytes objects in the notebook are always b64-encoded. We DO NOT encode/decode around file formats.

IPython.nbformat.v2.rwbase.split_lines(nb)

split likely multiline text into lists of strings

For file output more friendly to line-based VCS. rejoin_lines(nb) will reverse the effects of split_lines(nb).

Used when writing JSON files.