Skip to content

Commit

Permalink
Pin traitlets>=5.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed May 31, 2022
1 parent e6aa4a2 commit f9b48f1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions nbclient/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ class NbClientApp(JupyterApp):
An application used to execute notebook files (``*.ipynb``)
"""

version = __version__
version = Unicode(__version__)
name = 'jupyter-execute'
aliases = nbclient_aliases
flags = nbclient_flags

description = Unicode("An application used to execute notebook files (*.ipynb)")
description = "An application used to execute notebook files (*.ipynb)"
notebooks = List([], help="Path of notebooks to convert").tag(config=True)
timeout: int = Integer(
None,
Expand Down
14 changes: 8 additions & 6 deletions nbclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from .util import ensure_async, run_hook, run_sync


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

kernel_manager_class: KernelManager = Type(config=True, help='The kernel manager class to use.')
kernel_manager_class = Type(
config=True, klass=KernelManager, help='The kernel manager class to use.'
)

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

return AsyncKernelManager

_display_id_map: t.Dict[str, t.Dict] = Dict(
_display_id_map = Dict(
help=dedent(
"""
mapping of locations of outputs with a given display_id
Expand Down Expand Up @@ -423,7 +425,7 @@ def _kernel_manager_class_default(self) -> t.Type[KernelManager]:
""",
).tag(config=True)

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

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

Expand Down
6 changes: 5 additions & 1 deletion nbclient/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,11 @@ def test_mock_wrapper(self):
cell_mock = NotebookNode(
source='"foo" = "bar"', metadata={}, cell_type='code', outputs=[]
)
executor = NotebookClient({}) # type:ignore

class NotebookClientWithParentID(NotebookClient):
parent_id: str

executor = NotebookClientWithParentID({}) # type:ignore
executor.nb = {'cells': [cell_mock]} # type:ignore

# self.kc.iopub_channel.get_msg => message_mock.side_effect[i]
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
jupyter_client>=6.1.5
nbformat>=5.0
nest_asyncio
traitlets>=5.0.0
traitlets>=5.2.2

0 comments on commit f9b48f1

Please sign in to comment.