Skip to content

Commit f9b48f1

Browse files
committed
Pin traitlets>=5.2.2
1 parent e6aa4a2 commit f9b48f1

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

nbclient/cli.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ class NbClientApp(JupyterApp):
3535
An application used to execute notebook files (``*.ipynb``)
3636
"""
3737

38-
version = __version__
38+
version = Unicode(__version__)
3939
name = 'jupyter-execute'
4040
aliases = nbclient_aliases
4141
flags = nbclient_flags
4242

43-
description = Unicode("An application used to execute notebook files (*.ipynb)")
43+
description = "An application used to execute notebook files (*.ipynb)"
4444
notebooks = List([], help="Path of notebooks to convert").tag(config=True)
4545
timeout: int = Integer(
4646
None,

nbclient/client.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
from .util import ensure_async, run_hook, run_sync
4040

4141

42-
def timestamp(msg: t.Optional[Dict] = None) -> str:
42+
def timestamp(msg: t.Optional[t.Dict] = None) -> str:
4343
if msg and 'header' in msg: # The test mocks don't provide a header, so tolerate that
4444
msg_header = msg['header']
4545
if 'date' in msg_header and isinstance(msg_header['date'], datetime.datetime):
@@ -288,7 +288,9 @@ class NotebookClient(LoggingConfigurable):
288288
""",
289289
).tag(config=True)
290290

291-
kernel_manager_class: KernelManager = Type(config=True, help='The kernel manager class to use.')
291+
kernel_manager_class = Type(
292+
config=True, klass=KernelManager, help='The kernel manager class to use.'
293+
)
292294

293295
on_notebook_start: t.Optional[t.Callable] = Callable(
294296
default_value=None,
@@ -390,7 +392,7 @@ def _kernel_manager_class_default(self) -> t.Type[KernelManager]:
390392

391393
return AsyncKernelManager
392394

393-
_display_id_map: t.Dict[str, t.Dict] = Dict(
395+
_display_id_map = Dict(
394396
help=dedent(
395397
"""
396398
mapping of locations of outputs with a given display_id
@@ -423,7 +425,7 @@ def _kernel_manager_class_default(self) -> t.Type[KernelManager]:
423425
""",
424426
).tag(config=True)
425427

426-
resources: t.Dict = Dict(
428+
resources = Dict(
427429
help=dedent(
428430
"""
429431
Additional resources used in the conversion process. For example,
@@ -560,7 +562,7 @@ async def async_start_new_kernel_client(self) -> KernelClient:
560562
try:
561563
self.kc = self.km.client()
562564
await ensure_async(self.kc.start_channels()) # type:ignore[func-returns-value]
563-
await ensure_async(self.kc.wait_for_ready(timeout=self.startup_timeout))
565+
await ensure_async(self.kc.wait_for_ready(timeout=self.startup_timeout)) # type:ignore
564566
except Exception as e:
565567
self.log.error(
566568
"Error occurred while starting new kernel client for kernel {}: {}".format(
@@ -851,7 +853,7 @@ async def _async_handle_timeout(
851853

852854
async def _async_check_alive(self) -> None:
853855
assert self.kc is not None
854-
if not await ensure_async(self.kc.is_alive()):
856+
if not await ensure_async(self.kc.is_alive()): # type:ignore
855857
self.log.error("Kernel died while waiting for execute reply.")
856858
raise DeadKernelError("Kernel died")
857859

nbclient/tests/test_client.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,11 @@ def test_mock_wrapper(self):
211211
cell_mock = NotebookNode(
212212
source='"foo" = "bar"', metadata={}, cell_type='code', outputs=[]
213213
)
214-
executor = NotebookClient({}) # type:ignore
214+
215+
class NotebookClientWithParentID(NotebookClient):
216+
parent_id: str
217+
218+
executor = NotebookClientWithParentID({}) # type:ignore
215219
executor.nb = {'cells': [cell_mock]} # type:ignore
216220

217221
# self.kc.iopub_channel.get_msg => message_mock.side_effect[i]

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
jupyter_client>=6.1.5
22
nbformat>=5.0
33
nest_asyncio
4-
traitlets>=5.0.0
4+
traitlets>=5.2.2

0 commit comments

Comments
 (0)