Skip to content

Commit b51eb00

Browse files
committed
more cleanup
1 parent 42f6ae3 commit b51eb00

File tree

16 files changed

+41
-58
lines changed

16 files changed

+41
-58
lines changed

docs/conf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import os
1616
import shutil
17+
from typing import Any
1718

1819
# If extensions (or modules to document with autodoc) are in another directory,
1920
# add these directories to sys.path here. If the directory is relative to the
@@ -61,7 +62,7 @@
6162
# built documents.
6263
#
6364

64-
version_ns: dict = {}
65+
version_ns: dict[str, Any] = {}
6566
here = os.path.dirname(__file__)
6667
version_py = os.path.join(here, os.pardir, "ipykernel", "_version.py")
6768
with open(version_py) as f:
@@ -150,7 +151,7 @@
150151
# Add any paths that contain custom static files (such as style sheets) here,
151152
# relative to this directory. They are copied after the builtin static files,
152153
# so a file named "default.css" will overwrite the builtin "default.css".
153-
html_static_path: list = []
154+
html_static_path: list[str] = []
154155

155156
# Add any extra paths that contain custom files (such as robots.txt or
156157
# .htaccess) here, relative to this directory. These files are copied
@@ -217,7 +218,7 @@
217218

218219
# -- Options for LaTeX output ---------------------------------------------
219220

220-
latex_elements: dict = {}
221+
latex_elements: dict[str, object] = {}
221222

222223
# Grouping the document tree into LaTeX files. List of tuples
223224
# (source start file, target name, title,

examples/embedding/inprocess_terminal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import tornado
55
from jupyter_console.ptshell import ZMQTerminalInteractiveShell
66

7-
from ipykernel.inprocess import InProcessKernelManager
7+
from ipykernel.inprocess.manager import InProcessKernelManager
88

99

1010
def print_process_id():

ipykernel/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
pattern = r"(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)"
1111
match = re.match(pattern, __version__)
1212
assert match is not None
13-
parts: list = [int(match[part]) for part in ["major", "minor", "patch"]]
13+
parts: list[object] = [int(match[part]) for part in ["major", "minor", "patch"]]
1414
if match["rest"]:
1515
parts.append(match["rest"])
1616
version_info = tuple(parts)

ipykernel/debugger.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(self, event_callback, log):
9090
self.tcp_buffer = ""
9191
self._reset_tcp_pos()
9292
self.event_callback = event_callback
93-
self.message_queue: Queue = Queue()
93+
self.message_queue: Queue[t.Any] = Queue()
9494
self.log = log
9595

9696
def _reset_tcp_pos(self):
@@ -101,7 +101,7 @@ def _reset_tcp_pos(self):
101101

102102
def _put_message(self, raw_msg):
103103
self.log.debug("QUEUE - _put_message:")
104-
msg = t.cast(dict, jsonapi.loads(raw_msg))
104+
msg = t.cast(dict[str, t.Any], jsonapi.loads(raw_msg))
105105
if msg["type"] == "event":
106106
self.log.debug("QUEUE - received event:")
107107
self.log.debug(msg)
@@ -291,7 +291,7 @@ def __init__(
291291
self.is_started = False
292292
self.event_callback = event_callback
293293
self.just_my_code = just_my_code
294-
self.stopped_queue: Queue = Queue()
294+
self.stopped_queue: Queue[t.Any] = Queue()
295295

296296
self.started_debug_handlers = {}
297297
for msg_type in Debugger.started_debug_msg_types:

ipykernel/gui/gtk3embed.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
import sys
1515

1616
# Third-party
17-
import gi # type:ignore[import]
17+
import gi
1818

1919
gi.require_version("Gdk", "3.0")
2020
gi.require_version("Gtk", "3.0")
21-
from gi.repository import GObject, Gtk # type:ignore[import]
21+
from gi.repository import GObject, Gtk
2222

2323
# -----------------------------------------------------------------------------
2424
# Classes and functions

ipykernel/gui/gtkembed.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
import sys
1515

1616
# Third-party
17-
import gobject # type:ignore[import]
18-
import gtk # type:ignore[import]
17+
import gobject
18+
import gtk
1919

2020
# -----------------------------------------------------------------------------
2121
# Classes and functions

ipykernel/inprocess/blocking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class BlockingInProcessChannel(InProcessChannel):
2424
def __init__(self, *args, **kwds):
2525
super().__init__(*args, **kwds)
26-
self._in_queue: Queue = Queue()
26+
self._in_queue: Queue[object] = Queue()
2727

2828
def call_handlers(self, msg):
2929
self._in_queue.put(msg)

ipykernel/inprocess/channels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class InProcessChannel:
1414
"""Base class for in-process channels."""
1515

16-
proxy_methods: list = []
16+
proxy_methods: list[object] = []
1717

1818
def __init__(self, client=None):
1919
super().__init__()

ipykernel/iostream.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from binascii import b2a_hex
1414
from collections import deque
1515
from io import StringIO, TextIOBase
16-
from typing import Any, Optional
16+
from typing import Any, Optional, Callable
1717
from weakref import WeakSet
1818

1919
import zmq
@@ -67,8 +67,8 @@ def __init__(self, socket, pipe=False):
6767
if pipe:
6868
self._setup_pipe_in()
6969
self._local = threading.local()
70-
self._events: deque = deque()
71-
self._event_pipes: WeakSet = WeakSet()
70+
self._events: deque[Callable[..., Any]] = deque()
71+
self._event_pipes: WeakSet[Any] = WeakSet()
7272
self._setup_event_pipe()
7373
self.thread = threading.Thread(target=self._thread_main, name="IOPub")
7474
self.thread.daemon = True

ipykernel/kernelbase.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def __init__(self, **kwargs):
263263
for msg_type in self.control_msg_types:
264264
self.control_handlers[msg_type] = getattr(self, msg_type)
265265

266-
self.control_queue: Queue = Queue()
266+
self.control_queue: Queue[Any] = Queue()
267267

268268
def dispatch_control(self, msg):
269269
self.control_queue.put_nowait(msg)
@@ -279,7 +279,7 @@ async def poll_control_queue(self):
279279

280280
async def _flush_control_queue(self):
281281
"""Flush the control queue, wait for processing of any pending messages"""
282-
tracer_future: t.Union[concurrent.futures.Future, asyncio.Future]
282+
tracer_future: t.Union[concurrent.futures.Future[object], asyncio.Future[object]]
283283
if self.control_thread:
284284
control_loop = self.control_thread.io_loop
285285
# concurrent.futures.Futures are threadsafe
@@ -531,7 +531,7 @@ def schedule_dispatch(self, dispatch, *args):
531531
def start(self):
532532
"""register dispatchers for streams"""
533533
self.io_loop = ioloop.IOLoop.current()
534-
self.msg_queue: Queue = Queue()
534+
self.msg_queue: Queue[Any] = Queue()
535535
self.io_loop.add_callback(self.dispatch_queue)
536536

537537
self.control_stream.on_recv(self.dispatch_control, copy=False)

0 commit comments

Comments
 (0)