Skip to content

Commit

Permalink
Ensure KernelClient's API is complete
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed May 31, 2022
1 parent c817714 commit 6cefde9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 6 additions & 4 deletions jupyter_client/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from threading import Event
from threading import Thread

import zmq.asyncio
from zmq.asyncio import Context, Socket

from .channelsabc import HBChannelABC
from .session import Session
Expand Down Expand Up @@ -49,7 +49,7 @@ class HBChannel(Thread):

def __init__(
self,
context: t.Optional[zmq.asyncio.Context] = None,
context: t.Optional[Context] = None,
session: t.Optional[Session] = None,
address: t.Union[t.Tuple[str, int], str] = "",
):
Expand Down Expand Up @@ -193,7 +193,9 @@ def call_handlers(self, since_last_heartbeat: float) -> None:
class ZMQSocketChannel(object):
"""A ZMQ socket in an async API"""

def __init__(self, socket: zmq.asyncio.Socket, session: Session, loop: t.Any = None) -> None:
def __init__(
self, socket: Socket, session: Session, loop: t.Any = None
) -> None:
"""Create a channel.
Parameters
Expand All @@ -207,7 +209,7 @@ def __init__(self, socket: zmq.asyncio.Socket, session: Session, loop: t.Any = N
"""
super().__init__()

self.socket: t.Optional[zmq.asyncio.Socket] = socket
self.socket: t.Optional[Socket] = socket
self.session = session

async def _recv(self, **kwargs: t.Any) -> t.Dict[str, t.Any]:
Expand Down
8 changes: 8 additions & 0 deletions jupyter_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ class KernelClient(ConnectionFileMixin):
:meth:`get_shell_msg` to fetch messages from the shell channel.
"""

get_shell_msg: t.Union[t.Callable, t.Awaitable]
get_iopub_msg: t.Union[t.Callable, t.Awaitable]
get_stdin_msg: t.Union[t.Callable, t.Awaitable]
get_control_msg: t.Union[t.Callable, t.Awaitable]
wait_for_ready: t.Union[t.Callable, t.Awaitable] = _async_wait_for_ready
is_alive: t.Union[t.Callable, t.Awaitable]
execute_interactive: t.Union[t.Callable, t.Awaitable]

# The PyZMQ Context to use for communication with the kernel.
context = Instance(zmq.asyncio.Context)

Expand Down

0 comments on commit 6cefde9

Please sign in to comment.