Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding stream kwarg to current.new_output #3162

Merged
merged 1 commit into from
Apr 12, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion IPython/nbformat/v3/nbbase.py
Expand Up @@ -53,7 +53,7 @@ def from_dict(d):
def new_output(output_type=None, output_text=None, output_png=None,
output_html=None, output_svg=None, output_latex=None, output_json=None,
output_javascript=None, output_jpeg=None, prompt_number=None,
etype=None, evalue=None, traceback=None):
etype=None, evalue=None, traceback=None, stream=None):
"""Create a new code cell with input and output"""
output = NotebookNode()
if output_type is not None:
Expand Down Expand Up @@ -89,6 +89,9 @@ def new_output(output_type=None, output_text=None, output_png=None,
if traceback is not None:
output.traceback = [unicode(frame) for frame in list(traceback)]

if output_type == u'stream':
output.stream = 'stdout' if stream is None else unicode(stream)

return output


Expand Down
1 change: 1 addition & 0 deletions IPython/nbformat/v3/tests/nbexamples.py
Expand Up @@ -93,6 +93,7 @@
output_text='foo\rbar\r\n'
),new_output(
output_type=u'stream',
stream='stderr',
output_text='\rfoo\rbar\n'
)]
))
Expand Down