-
Notifications
You must be signed in to change notification settings - Fork 297
Description
Compare:
MultiKernelManager
(ok):
jupyter_client/jupyter_client/multikernelmanager.py
Lines 107 to 110 in 1f36fbf
@default("context") | |
def _context_default(self) -> zmq.Context: | |
self._created_context = True | |
return zmq.Context() |
KernelManager
(ok):
jupyter_client/jupyter_client/manager.py
Lines 126 to 134 in 1f36fbf
_created_context: Bool = Bool(False) | |
# The PyZMQ Context to use for communication with the kernel. | |
context: Instance = Instance(zmq.Context) | |
@default("context") | |
def _context_default(self) -> zmq.Context: | |
self._created_context = True | |
return zmq.Context() |
KernelClient
and AsyncKernelClient
(wrong?):
jupyter_client/jupyter_client/client.py
Lines 91 to 97 in 1f36fbf
context = Instance(zmq.Context) | |
_created_context = Bool(False) | |
def _context_default(self) -> zmq.Context: | |
self._created_context = True | |
return zmq.Context() |
jupyter_client/jupyter_client/asynchronous/client.py
Lines 36 to 40 in 1f36fbf
context = Instance(zmq.asyncio.Context) # type:ignore[arg-type] | |
def _context_default(self) -> zmq.asyncio.Context: | |
self._created_context = True | |
return zmq.asyncio.Context() |
Technically I think this is not wrong, just old way of doing things as per:
https://traitlets.readthedocs.io/en/stable/migration.html#dynamic-defaults-generation-with-decorators
The use of the magic methods
_{trait}_default
for dynamic default generation is not deprecated, but a new@default
method decorator is added