5252
5353from ipykernel .jsonutil import json_clean
5454
55- from .shell import ShellThread
5655from ._version import kernel_protocol_version
56+ from .shell import ShellThread
5757
5858
5959def DEBUG (msg ):
@@ -622,12 +622,7 @@ async def execute_request(self, socket, ident, parent):
622622 kwargs .update (cell_id = cell_id )
623623
624624 reply_content = self .do_execute (
625- code ,
626- silent ,
627- store_history ,
628- user_expressions ,
629- allow_stdin ,
630- ** kwargs
625+ code , silent , store_history , user_expressions , allow_stdin , ** kwargs
631626 )
632627 DEBUG (f"execute_request { parent ['header' ].get ('shell_id' )} " )
633628
@@ -673,7 +668,7 @@ def do_execute(
673668 allow_stdin = False ,
674669 * ,
675670 cell_id = None ,
676- shell_id = None
671+ shell_id = None ,
677672 ):
678673 """Execute user code. Must be overridden by subclasses."""
679674 raise NotImplementedError
@@ -873,9 +868,7 @@ async def is_complete_request(self, socket, ident, parent):
873868 if inspect .isawaitable (reply_content ):
874869 reply_content = await reply_content
875870 reply_content = json_clean (reply_content )
876- reply_msg = self .session .send (
877- socket , "is_complete_reply" , reply_content , parent , ident
878- )
871+ reply_msg = self .session .send (socket , "is_complete_reply" , reply_content , parent , ident )
879872 self .log .debug ("%s" , reply_msg )
880873
881874 def do_is_complete (self , code ):
@@ -889,9 +882,7 @@ async def debug_request(self, socket, ident, parent):
889882 if inspect .isawaitable (reply_content ):
890883 reply_content = await reply_content
891884 reply_content = json_clean (reply_content )
892- reply_msg = self .session .send (
893- socket , "debug_reply" , reply_content , parent , ident
894- )
885+ reply_msg = self .session .send (socket , "debug_reply" , reply_content , parent , ident )
895886 self .log .debug ("%s" , reply_msg )
896887
897888 def get_process_metric_value (self , process , name , attribute = None ):
@@ -937,9 +928,7 @@ async def usage_request(self, socket, ident, parent):
937928 reply_content ["host_cpu_percent" ] = cpu_percent
938929 reply_content ["cpu_count" ] = psutil .cpu_count (logical = True )
939930 reply_content ["host_virtual_memory" ] = dict (psutil .virtual_memory ()._asdict ())
940- reply_msg = self .session .send (
941- socket , "usage_reply" , reply_content , parent , ident
942- )
931+ reply_msg = self .session .send (socket , "usage_reply" , reply_content , parent , ident )
943932 self .log .debug ("%s" , reply_msg )
944933
945934 async def do_debug_request (self , msg ):
@@ -1013,9 +1002,7 @@ async def clear_request(self, socket, idents, parent): # pragma: no cover
10131002 "clear_request is deprecated in kernel_base. It is only part of IPython parallel"
10141003 )
10151004 content = self .do_clear ()
1016- self .session .send (
1017- socket , "clear_reply" , ident = idents , parent = parent , content = content
1018- )
1005+ self .session .send (socket , "clear_reply" , ident = idents , parent = parent , content = content )
10191006
10201007 def do_clear (self ):
10211008 """DEPRECATED since 4.0.3"""
0 commit comments