@@ -114,12 +114,13 @@ class NotebookClient(LoggingConfigurable):
114
114
If a cell execution was interrupted after a timeout, don't wait for
115
115
the execute_reply from the kernel (e.g. KeyboardInterrupt error).
116
116
Instead, return an execute_reply with the given error, which should
117
- be of the following form:
118
- {
119
- 'ename': str, # Exception name, as a string
120
- 'evalue': str, # Exception value, as a string
121
- 'traceback': list(str), # traceback frames, as strings
122
- }
117
+ be of the following form::
118
+
119
+ {
120
+ 'ename': str, # Exception name, as a string
121
+ 'evalue': str, # Exception value, as a string
122
+ 'traceback': list(str), # traceback frames, as strings
123
+ }
123
124
"""
124
125
),
125
126
).tag (config = True )
@@ -838,6 +839,7 @@ async def _async_handle_timeout(
838
839
return execute_reply
839
840
return None
840
841
else :
842
+ assert cell is not None
841
843
raise CellTimeoutError .error_from_timeout_and_cell (
842
844
"Cell execution timed out" , timeout , cell
843
845
)
@@ -1015,7 +1017,7 @@ async def async_execute_cell(
1015
1017
1016
1018
def process_message (
1017
1019
self , msg : t .Dict , cell : NotebookNode , cell_index : int
1018
- ) -> t .Optional [t . List ]:
1020
+ ) -> t .Optional [NotebookNode ]:
1019
1021
"""
1020
1022
Processes a kernel message, updates cell state, and returns the
1021
1023
resulting output object that was appended to cell.outputs.
@@ -1033,7 +1035,7 @@ def process_message(
1033
1035
1034
1036
Returns
1035
1037
-------
1036
- output : dict
1038
+ output : NotebookNode
1037
1039
The execution output payload (or None for no output).
1038
1040
1039
1041
Raises
@@ -1082,6 +1084,7 @@ def output(
1082
1084
) -> t .Optional [NotebookNode ]:
1083
1085
1084
1086
msg_type = msg ['msg_type' ]
1087
+ out = None
1085
1088
1086
1089
parent_msg_id = msg ['parent_header' ].get ('msg_id' )
1087
1090
if self .output_hook_stack [parent_msg_id ]:
@@ -1112,7 +1115,7 @@ def output(
1112
1115
1113
1116
outs .append (out )
1114
1117
1115
- return out
1118
+ return out # type:ignore[no-any-return]
1116
1119
1117
1120
def clear_output (self , outs : t .List , msg : t .Dict , cell_index : int ) -> None :
1118
1121
0 commit comments