From 1443d4ace34ad8b037cc8fb8515ba1eb87efbebc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 7 Mar 2023 09:22:40 +0100 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#273) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/python-jsonschema/check-jsonschema: 0.19.2 → 0.21.0](https://github.com/python-jsonschema/check-jsonschema/compare/0.19.2...0.21.0) - [github.com/psf/black: 22.12.0 → 23.1.0](https://github.com/psf/black/compare/22.12.0...23.1.0) - [github.com/charliermarsh/ruff-pre-commit: v0.0.207 → v0.0.254](https://github.com/charliermarsh/ruff-pre-commit/compare/v0.0.207...v0.0.254) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Lint * Update ruff==0.0.254 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: David Brochart --- .pre-commit-config.yaml | 6 +++--- nbclient/client.py | 8 ++------ nbclient/tests/test_client.py | 2 +- pyproject.toml | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 156ee59..8c9e2d8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.19.2 + rev: 0.21.0 hooks: - id: check-github-workflows @@ -31,12 +31,12 @@ repos: [mdformat-gfm, mdformat-frontmatter, mdformat-footnote] - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.207 + rev: v0.0.254 hooks: - id: ruff args: ["--fix"] diff --git a/nbclient/client.py b/nbclient/client.py index 50255fe..84912a2 100644 --- a/nbclient/client.py +++ b/nbclient/client.py @@ -43,7 +43,7 @@ def timestamp(msg: t.Optional[t.Dict] = None) -> str: formatted_time ): # docs indicate strftime may return empty string, so let's catch that too return formatted_time - except Exception: + except Exception: # noqa pass # fallback to a local time return datetime.datetime.utcnow().isoformat() + 'Z' @@ -616,7 +616,7 @@ async def async_setup_kernel(self, **kwargs: t.Any) -> t.AsyncGenerator: def on_signal(): """Handle signals.""" - asyncio.ensure_future(self._async_cleanup_kernel()) + self._async_cleanup_kernel_future = asyncio.ensure_future(self._async_cleanup_kernel()) atexit.unregister(self._cleanup_kernel) loop = asyncio.get_event_loop() @@ -750,7 +750,6 @@ async def _async_poll_for_reply( task_poll_output_msg: asyncio.Future, task_poll_kernel_alive: asyncio.Future, ) -> t.Dict: - msg: t.Dict assert self.kc is not None new_timeout: t.Optional[float] = None @@ -793,7 +792,6 @@ async def _async_poll_for_reply( async def _async_poll_output_msg( self, parent_msg_id: str, cell: NotebookNode, cell_index: int ) -> None: - assert self.kc is not None while True: msg = await ensure_async(self.kc.iopub_channel.get_msg(timeout=None)) @@ -828,7 +826,6 @@ def _get_timeout(self, cell: t.Optional[NotebookNode]) -> t.Optional[int]: async def _async_handle_timeout( self, timeout: int, cell: t.Optional[NotebookNode] = None ) -> t.Union[None, t.Dict]: - self.log.error("Timeout waiting for execute reply (%is)." % timeout) if self.interrupt_on_timeout: self.log.error("Interrupting kernel") @@ -886,7 +883,6 @@ def _passed_deadline(self, deadline: int) -> bool: async def _check_raise_for_error( self, cell: NotebookNode, cell_index: int, exec_reply: t.Optional[t.Dict] ) -> None: - if exec_reply is None: return None diff --git a/nbclient/tests/test_client.py b/nbclient/tests/test_client.py index 780e5e0..dce47de 100644 --- a/nbclient/tests/test_client.py +++ b/nbclient/tests/test_client.py @@ -561,7 +561,7 @@ def stop_channels(self) -> None: class TestExecute(NBClientTestsBase): """Contains test functions for execute.py""" - maxDiff = None # noqa + maxDiff = None def test_constructor(self): NotebookClient(nbformat.v4.new_notebook()) diff --git a/pyproject.toml b/pyproject.toml index e89a00a..8d18e3d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -115,7 +115,7 @@ dependencies = [ "black[jupyter]==22.10.0", "mdformat>0.7", "mdformat-gfm>=0.3.5", - "ruff==0.0.189" + "ruff==0.0.254" ] detached = true [tool.hatch.envs.lint.scripts]