Show More
@@ -23,7 +23,6 b'' | |||
|
23 | 23 | }, |
|
24 | 24 | "outputs": [ |
|
25 | 25 | { |
|
26 | "metadata": {}, | |
|
27 | 26 | "name": "stdout", |
|
28 | 27 | "output_type": "stream", |
|
29 | 28 | "text": [ |
@@ -19,7 +19,6 b'' | |||
|
19 | 19 | }, |
|
20 | 20 | "outputs": [ |
|
21 | 21 | { |
|
22 | "metadata": {}, | |
|
23 | 22 | "name": "stdout", |
|
24 | 23 | "output_type": "stream", |
|
25 | 24 | "text": [ |
@@ -19,7 +19,6 b'' | |||
|
19 | 19 | }, |
|
20 | 20 | "outputs": [ |
|
21 | 21 | { |
|
22 | "metadata": {}, | |
|
23 | 22 | "name": "stdout", |
|
24 | 23 | "output_type": "stream", |
|
25 | 24 | "text": [ |
@@ -8,7 +8,6 b'' | |||
|
8 | 8 | }, |
|
9 | 9 | "outputs": [ |
|
10 | 10 | { |
|
11 | "metadata": {}, | |
|
12 | 11 | "name": "stdout", |
|
13 | 12 | "output_type": "stream", |
|
14 | 13 | "text": [ |
@@ -10,7 +10,6 b'' | |||
|
10 | 10 | { |
|
11 | 11 | "ename": "Exception", |
|
12 | 12 | "evalue": "message", |
|
13 | "metadata": {}, | |
|
14 | 13 | "output_type": "error", |
|
15 | 14 | "traceback": [ |
|
16 | 15 | "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", |
@@ -32,7 +31,6 b'' | |||
|
32 | 31 | }, |
|
33 | 32 | "outputs": [ |
|
34 | 33 | { |
|
35 | "metadata": {}, | |
|
36 | 34 | "name": "stdout", |
|
37 | 35 | "output_type": "stream", |
|
38 | 36 | "text": [ |
@@ -8,7 +8,6 b'' | |||
|
8 | 8 | }, |
|
9 | 9 | "outputs": [ |
|
10 | 10 | { |
|
11 | "metadata": {}, | |
|
12 | 11 | "name": "stdout", |
|
13 | 12 | "output_type": "stream", |
|
14 | 13 | "text": [ |
@@ -23,7 +23,6 b'' | |||
|
23 | 23 | }, |
|
24 | 24 | "outputs": [ |
|
25 | 25 | { |
|
26 | "metadata": {}, | |
|
27 | 26 | "name": "stdout", |
|
28 | 27 | "output_type": "stream", |
|
29 | 28 | "text": [ |
@@ -36,7 +36,6 b'' | |||
|
36 | 36 | "print(\"hello\")" |
|
37 | 37 | ], |
|
38 | 38 | "language": "python", |
|
39 | "metadata": {}, | |
|
40 | 39 | "outputs": [ |
|
41 | 40 | { |
|
42 | 41 | "output_type": "stream", |
@@ -31,7 +31,6 b'' | |||
|
31 | 31 | }, |
|
32 | 32 | "outputs": [ |
|
33 | 33 | { |
|
34 | "metadata": {}, | |
|
35 | 34 | "name": "stdout", |
|
36 | 35 | "output_type": "stream", |
|
37 | 36 | "text": [ |
@@ -54,6 +54,10 b' def new_output(output_type, output_text=None, output_png=None,' | |||
|
54 | 54 | if not isinstance(metadata, dict): |
|
55 | 55 | raise TypeError("metadata must be dict") |
|
56 | 56 | |
|
57 | ||
|
58 | if output_type in {u'pyout', 'display_data'}: | |
|
59 | output.metadata = metadata | |
|
60 | ||
|
57 | 61 | if output_type != 'pyerr': |
|
58 | 62 | if output_text is not None: |
|
59 | 63 | output.text = cast_unicode(output_text) |
@@ -86,8 +90,6 b' def new_output(output_type, output_text=None, output_png=None,' | |||
|
86 | 90 | |
|
87 | 91 | if output_type == u'stream': |
|
88 | 92 | output.stream = 'stdout' if stream is None else cast_unicode(stream) |
|
89 | else: | |
|
90 | output.metadata = metadata | |
|
91 | 93 | |
|
92 | 94 | return output |
|
93 | 95 |
@@ -295,7 +295,6 b'' | |||
|
295 | 295 | "description": "Type of cell output.", |
|
296 | 296 | "enum": ["pyerr"] |
|
297 | 297 | }, |
|
298 | "metadata": {"$ref": "#/definitions/misc/output_metadata"}, | |
|
299 | 298 | "ename": { |
|
300 | 299 | "description": "The name of the error.", |
|
301 | 300 | "type": "string" |
@@ -141,8 +141,8 b' def upgrade_output(output):' | |||
|
141 | 141 | - mime-type keys |
|
142 | 142 | - stream.stream -> stream.name |
|
143 | 143 | """ |
|
144 | output.setdefault('metadata', NotebookNode()) | |
|
145 | 144 | if output['output_type'] in {'pyout', 'display_data'}: |
|
145 | output.setdefault('metadata', NotebookNode()) | |
|
146 | 146 | if output['output_type'] == 'pyout': |
|
147 | 147 | output['output_type'] = 'execute_result' |
|
148 | 148 | output['execution_count'] = output.pop('prompt_number', None) |
@@ -193,7 +193,6 b' def downgrade_output(output):' | |||
|
193 | 193 | output['output_type'] = 'pyerr' |
|
194 | 194 | elif output['output_type'] == 'stream': |
|
195 | 195 | output['stream'] = output.pop('name') |
|
196 | output.pop('metadata') | |
|
197 | 196 | return output |
|
198 | 197 | |
|
199 | 198 | def upgrade_outputs(outputs): |
@@ -46,11 +46,11 b' def new_output(output_type, data=None, **kwargs):' | |||
|
46 | 46 | output.data = from_dict(data) |
|
47 | 47 | |
|
48 | 48 | # populate defaults: |
|
49 | output.setdefault('metadata', NotebookNode()) | |
|
50 | 49 | if output_type == 'stream': |
|
51 | 50 | output.setdefault('name', 'stdout') |
|
52 | 51 | output.setdefault('text', '') |
|
53 | 52 | elif output_type in {'execute_result', 'display_data'}: |
|
53 | output.setdefault('metadata', NotebookNode()) | |
|
54 | 54 | output.setdefault('data', NotebookNode()) |
|
55 | 55 | validate(output, output_type) |
|
56 | 56 | return output |
@@ -235,13 +235,12 b'' | |||
|
235 | 235 | "description": "Stream output from a code cell.", |
|
236 | 236 | "type": "object", |
|
237 | 237 | "additionalProperties": false, |
|
238 |
"required": ["output_type", |
|
|
238 | "required": ["output_type", "name", "text"], | |
|
239 | 239 | "properties": { |
|
240 | 240 | "output_type": { |
|
241 | 241 | "description": "Type of cell output.", |
|
242 | 242 | "enum": ["stream"] |
|
243 | 243 | }, |
|
244 | "metadata": {"$ref": "#/definitions/misc/output_metadata"}, | |
|
245 | 244 | "name": { |
|
246 | 245 | "description": "The name of the stream (stdout, stderr).", |
|
247 | 246 | "type": "string" |
@@ -257,13 +256,12 b'' | |||
|
257 | 256 | "description": "Output of an error that occurred during code cell execution.", |
|
258 | 257 | "type": "object", |
|
259 | 258 | "additionalProperties": false, |
|
260 |
"required": ["output_type" |
|
|
259 | "required": ["output_type", "ename", "evalue", "traceback"], | |
|
261 | 260 | "properties": { |
|
262 | 261 | "output_type": { |
|
263 | 262 | "description": "Type of cell output.", |
|
264 | 263 | "enum": ["error"] |
|
265 | 264 | }, |
|
266 | "metadata": {"$ref": "#/definitions/misc/output_metadata"}, | |
|
267 | 265 | "ename": { |
|
268 | 266 | "description": "The name of the error.", |
|
269 | 267 | "type": "string" |
General Comments 0
You need to be logged in to leave comments.
Login now