@@ -47,7 +47,8 @@ def cb(typ, dat, contentType=None, **kwargs):
4747 # Do not display values entered by user for input
4848 continue
4949 else :
50- cb ("output" , part ["text" ], contentType = part .get ("contentType" ))
50+ ev_type = "debug" if typ in ["snoop" ] else "output"
51+ cb (ev_type , part ["text" ], contentType = part .get ("contentType" ))
5152 elif event_type == "input" :
5253 return cb ("input" , data ["prompt" ])
5354 elif event_type == "sleep" :
@@ -94,17 +95,17 @@ async def install_imports(self, source_code, ignore_missing=True):
9495 if not ignore_missing :
9596 raise
9697
97- def pre_run (self , source_code , mode = "exec" , top_level_await = False ):
98+ def pre_run (self , source_code , mode = "exec" , top_level_await = True ):
9899 self .override_globals ()
99100 return super ().pre_run (source_code , mode = mode , top_level_await = top_level_await )
100101
101- async def run_async (self , source_code , mode = "exec" , top_level_await = True ):
102+ async def run_async (self , source_code , mode = "exec" , top_level_await = True , snoop_config = None ):
102103 with self ._execute_context ():
103104 try :
104105 await self .install_imports (source_code , ignore_missing = False )
105106 code_obj = self .pre_run (source_code , mode = mode , top_level_await = top_level_await )
106107 if code_obj :
107- result = self .execute (code_obj , mode )
108+ result = self .execute (code_obj , mode = mode , snoop_config = to_py ( snoop_config ) )
108109 while isinstance (result , Awaitable ):
109110 result = await result
110111 return result
0 commit comments