Show More
@@ -68,7 +68,7 b' def reads(s, as_version, **kwargs):' | |||||
68 | return nb |
|
68 | return nb | |
69 |
|
69 | |||
70 |
|
70 | |||
71 | def writes(nb, version, **kwargs): |
|
71 | def writes(nb, version=NO_CONVERT, **kwargs): | |
72 | """Write a notebook to a string in a given format in the given nbformat version. |
|
72 | """Write a notebook to a string in a given format in the given nbformat version. | |
73 |
|
73 | |||
74 | Any notebook format errors will be logged. |
|
74 | Any notebook format errors will be logged. | |
@@ -77,10 +77,10 b' def writes(nb, version, **kwargs):' | |||||
77 | ---------- |
|
77 | ---------- | |
78 | nb : NotebookNode |
|
78 | nb : NotebookNode | |
79 | The notebook to write. |
|
79 | The notebook to write. | |
80 | version : int |
|
80 | version : int, optional | |
81 | The nbformat version to write. |
|
81 | The nbformat version to write. | |
82 | If nb is not this version, it will be converted. |
|
82 | If unspecified, or specified as nbformat.NO_CONVERT, | |
83 | Pass nbformat.NO_CONVERT to prevent conversion. |
|
83 | the notebook's own version will be used and no conversion performed. | |
84 |
|
84 | |||
85 | Returns |
|
85 | Returns | |
86 | ------- |
|
86 | ------- | |
@@ -123,7 +123,7 b' def read(fp, as_version, **kwargs):' | |||||
123 | return reads(fp.read(), as_version, **kwargs) |
|
123 | return reads(fp.read(), as_version, **kwargs) | |
124 |
|
124 | |||
125 |
|
125 | |||
126 | def write(fp, nb, version, **kwargs): |
|
126 | def write(fp, nb, version=NO_CONVERT, **kwargs): | |
127 | """Write a notebook to a file in a given nbformat version. |
|
127 | """Write a notebook to a file in a given nbformat version. | |
128 |
|
128 | |||
129 | The file-like object must accept unicode input. |
|
129 | The file-like object must accept unicode input. | |
@@ -134,9 +134,11 b' def write(fp, nb, version, **kwargs):' | |||||
134 | Any file-like object with a write method that accepts unicode. |
|
134 | Any file-like object with a write method that accepts unicode. | |
135 | nb : NotebookNode |
|
135 | nb : NotebookNode | |
136 | The notebook to write. |
|
136 | The notebook to write. | |
137 | version : int |
|
137 | version : int, optional | |
138 | The nbformat version to write. |
|
138 | The nbformat version to write. | |
139 | If nb is not this version, it will be converted. |
|
139 | If nb is not this version, it will be converted. | |
|
140 | If unspecified, or specified as nbformat.NO_CONVERT, | |||
|
141 | the notebook's own version will be used and no conversion performed. | |||
140 | """ |
|
142 | """ | |
141 | s = writes(nb, version, **kwargs) |
|
143 | s = writes(nb, version, **kwargs) | |
142 | if isinstance(s, bytes): |
|
144 | if isinstance(s, bytes): |
General Comments 0
You need to be logged in to leave comments.
Login now