@@ -115,7 +115,11 @@ def _context_default(self) -> zmq.Context:
115115
116116 def __del__ (self ):
117117 """Handle garbage collection. Destroy context if applicable."""
118- if self ._created_context and self .context and not self .context .closed :
118+ if (
119+ self ._created_context
120+ and self .context is not None # type:ignore[redundant-expr]
121+ and not self .context .closed
122+ ):
119123 if self .channels_running :
120124 if self .log :
121125 self .log .warning ("Could not destroy zmq context for %s" , self )
@@ -349,7 +353,9 @@ def shell_channel(self) -> t.Any:
349353 url = self ._make_url ("shell" )
350354 self .log .debug ("connecting shell channel to %s" , url )
351355 socket = self .connect_shell (identity = self .session .bsession )
352- self ._shell_channel = self .shell_channel_class (socket , self .session , self .ioloop )
356+ self ._shell_channel = self .shell_channel_class (
357+ socket , self .session , self .ioloop
358+ ) # type:ignore[operator]
353359 return self ._shell_channel
354360
355361 @property
@@ -359,7 +365,9 @@ def iopub_channel(self) -> t.Any:
359365 url = self ._make_url ("iopub" )
360366 self .log .debug ("connecting iopub channel to %s" , url )
361367 socket = self .connect_iopub ()
362- self ._iopub_channel = self .iopub_channel_class (socket , self .session , self .ioloop )
368+ self ._iopub_channel = self .iopub_channel_class (
369+ socket , self .session , self .ioloop
370+ ) # type:ignore[operator]
363371 return self ._iopub_channel
364372
365373 @property
@@ -369,7 +377,9 @@ def stdin_channel(self) -> t.Any:
369377 url = self ._make_url ("stdin" )
370378 self .log .debug ("connecting stdin channel to %s" , url )
371379 socket = self .connect_stdin (identity = self .session .bsession )
372- self ._stdin_channel = self .stdin_channel_class (socket , self .session , self .ioloop )
380+ self ._stdin_channel = self .stdin_channel_class (
381+ socket , self .session , self .ioloop
382+ ) # type:ignore[operator]
373383 return self ._stdin_channel
374384
375385 @property
@@ -378,7 +388,9 @@ def hb_channel(self) -> t.Any:
378388 if self ._hb_channel is None :
379389 url = self ._make_url ("hb" )
380390 self .log .debug ("connecting heartbeat channel to %s" , url )
381- self ._hb_channel = self .hb_channel_class (self .context , self .session , url )
391+ self ._hb_channel = self .hb_channel_class (
392+ self .context , self .session , url
393+ ) # type:ignore[operator]
382394 return self ._hb_channel
383395
384396 @property
@@ -388,7 +400,9 @@ def control_channel(self) -> t.Any:
388400 url = self ._make_url ("control" )
389401 self .log .debug ("connecting control channel to %s" , url )
390402 socket = self .connect_control (identity = self .session .bsession )
391- self ._control_channel = self .control_channel_class (socket , self .session , self .ioloop )
403+ self ._control_channel = self .control_channel_class (
404+ socket , self .session , self .ioloop
405+ ) # type:ignore[operator]
392406 return self ._control_channel
393407
394408 async def _async_is_alive (self ) -> bool :
0 commit comments