Skip to content

Commit

Permalink
fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Sep 9, 2023
1 parent a8dd626 commit 7fdc65d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
8 changes: 5 additions & 3 deletions ipykernel/eventloops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions ipykernel/ipkernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions ipykernel/kernelapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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:.}"

Expand Down

0 comments on commit 7fdc65d

Please sign in to comment.