@@ -115,7 +115,11 @@ def _context_default(self) -> zmq.Context:
115
115
116
116
def __del__ (self ):
117
117
"""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
+ ):
119
123
if self .channels_running :
120
124
if self .log :
121
125
self .log .warning ("Could not destroy zmq context for %s" , self )
@@ -349,7 +353,9 @@ def shell_channel(self) -> t.Any:
349
353
url = self ._make_url ("shell" )
350
354
self .log .debug ("connecting shell channel to %s" , url )
351
355
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]
353
359
return self ._shell_channel
354
360
355
361
@property
@@ -359,7 +365,9 @@ def iopub_channel(self) -> t.Any:
359
365
url = self ._make_url ("iopub" )
360
366
self .log .debug ("connecting iopub channel to %s" , url )
361
367
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]
363
371
return self ._iopub_channel
364
372
365
373
@property
@@ -369,7 +377,9 @@ def stdin_channel(self) -> t.Any:
369
377
url = self ._make_url ("stdin" )
370
378
self .log .debug ("connecting stdin channel to %s" , url )
371
379
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]
373
383
return self ._stdin_channel
374
384
375
385
@property
@@ -378,7 +388,9 @@ def hb_channel(self) -> t.Any:
378
388
if self ._hb_channel is None :
379
389
url = self ._make_url ("hb" )
380
390
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]
382
394
return self ._hb_channel
383
395
384
396
@property
@@ -388,7 +400,9 @@ def control_channel(self) -> t.Any:
388
400
url = self ._make_url ("control" )
389
401
self .log .debug ("connecting control channel to %s" , url )
390
402
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]
392
406
return self ._control_channel
393
407
394
408
async def _async_is_alive (self ) -> bool :
0 commit comments