diff --git a/ipykernel/eventloops.py b/ipykernel/eventloops.py index fe4e2059..ef54f410 100644 --- a/ipykernel/eventloops.py +++ b/ipykernel/eventloops.py @@ -429,7 +429,7 @@ async def close_loop(): close_loop() elif not loop.is_closed(): - loop.run_until_complete(close_loop) # type:ignore[call-overload] + loop.run_until_complete(close_loop) # type:ignore[arg-type] loop.close() @@ -567,8 +567,10 @@ def enable_gui(gui, kernel=None): loop = loop_map[gui] if ( - loop and kernel.eventloop is not None and kernel.eventloop is not loop - ): # type:ignore[unreachable] + loop + and kernel.eventloop is not None + and kernel.eventloop is not loop # type:ignore[unreachable] + ): msg = "Cannot activate multiple GUI eventloops" # type:ignore[unreachable] raise RuntimeError(msg) kernel.eventloop = loop diff --git a/ipykernel/ipkernel.py b/ipykernel/ipkernel.py index 5726a423..f82831cc 100644 --- a/ipykernel/ipkernel.py +++ b/ipykernel/ipkernel.py @@ -29,7 +29,7 @@ try: from IPython.core.interactiveshell import _asyncio_runner # type:ignore[attr-defined] except ImportError: - _asyncio_runner = None + _asyncio_runner = None # type:ignore[assignment] try: from IPython.core.completer import provisionalcompleter as _provisionalcompleter @@ -377,7 +377,7 @@ async def run_cell(*args, **kwargs): preprocessing_exc_tuple = sys.exc_info() if ( - _asyncio_runner + _asyncio_runner # type:ignore[truthy-bool] and shell.loop_runner is _asyncio_runner and asyncio.get_event_loop().is_running() and should_run_async( @@ -625,7 +625,7 @@ def do_apply(self, content, bufs, msg_id, reply_metadata): try: from ipyparallel.serialize import serialize_object, unpack_apply_message except ImportError: - from .serialize import serialize_object, unpack_apply_message # type:ignore[no-redef] + from .serialize import serialize_object, unpack_apply_message shell = self.shell try: diff --git a/ipykernel/kernelapp.py b/ipykernel/kernelapp.py index c507a633..990d6ba4 100644 --- a/ipykernel/kernelapp.py +++ b/ipykernel/kernelapp.py @@ -460,9 +460,9 @@ def init_blackhole(self): if self.no_stdout or self.no_stderr: blackhole = open(os.devnull, "w") # noqa if self.no_stdout: - sys.stdout = sys.__stdout__ = blackhole + sys.stdout = sys.__stdout__ = blackhole # type:ignore[misc] if self.no_stderr: - sys.stderr = sys.__stderr__ = blackhole + sys.stderr = sys.__stderr__ = blackhole # type:ignore[misc] def init_io(self): """Redirect input streams and set a display hook.""" diff --git a/pyproject.toml b/pyproject.toml index 9c3dd60d..cf4f8087 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -112,7 +112,7 @@ matrix.qt.features = [ [tool.hatch.envs.typing] features = ["test"] -dependencies = ["mypy>=0.990"] +dependencies = ["mypy>=1.5.1"] [tool.hatch.envs.typing.scripts] test = "mypy --install-types --non-interactive {args:.}"