Skip to content

Commit

Permalink
Apply review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollonval committed May 15, 2024
1 parent a563aa6 commit 733bd59
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions jupyter_client/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,11 @@ def _recv(self, **kwargs: t.Any) -> t.Dict[str, t.Any]:
ident, smsg = self.session.feed_identities(msg)
return self.session.deserialize(smsg)

def get_msg(self, timeout: t.Optional[int] = None) -> t.Dict[str, t.Any]:
def get_msg(self, timeout: t.Optional[float] = None) -> t.Dict[str, t.Any]:
"""Gets a message if there is one that is ready."""
assert self.socket is not None
if timeout is not None:
timeout *= 1000 # seconds to ms
ready = self.socket.poll(timeout)
timeout_ms = None if timeout is None else int(timeout * 1000) # seconds to ms
ready = self.socket.poll(timeout_ms)
if ready:
res = self._recv()
return res
Expand Down Expand Up @@ -305,9 +304,8 @@ async def get_msg( # type:ignore[override]
) -> t.Dict[str, t.Any]:
"""Gets a message if there is one that is ready."""
assert self.socket is not None
if timeout is not None:
timeout *= 1000 # seconds to ms
ready = await self.socket.poll(timeout)
timeout_ms = None if timeout is None else int(timeout * 1000) # seconds to ms
ready = await self.socket.poll(timeout_ms)
if ready:
res = await self._recv()
return res
Expand Down

0 comments on commit 733bd59

Please sign in to comment.